version WiLink_Driver_6.1.1.0.8 WiLink_Driver_6.1.1.0.8
authorshahar_levi@ti.com
Tue, 29 Jun 2010 12:34:26 +0100
changeset 0 10c42ec6c05f
child 1 37559704e0d0
version WiLink_Driver_6.1.1.0.8
.hgignore
.hgtags
Readme_wlan_FwNvs.txt
TWD/Ctrl/CmdBld.c
TWD/Ctrl/CmdBld.h
TWD/Ctrl/CmdBldCfg.c
TWD/Ctrl/CmdBldCfgIE.c
TWD/Ctrl/CmdBldCfgIE.h
TWD/Ctrl/CmdBldCmd.c
TWD/Ctrl/CmdBldCmdIE.c
TWD/Ctrl/CmdBldCmdIE.h
TWD/Ctrl/CmdBldDb.h
TWD/Ctrl/CmdBldItr.c
TWD/Ctrl/CmdBldItrIE.c
TWD/Ctrl/CmdBldItrIE.h
TWD/Ctrl/CmdQueue.c
TWD/Ctrl/CmdQueue.h
TWD/Ctrl/Export_Inc/CmdQueue_api.h
TWD/Data_Service/Export_Inc/RxQueue_api.h
TWD/Data_Service/Export_Inc/txCtrlBlk_api.h
TWD/Data_Service/Export_Inc/txHwQueue_api.h
TWD/Data_Service/RxQueue.c
TWD/Data_Service/txCtrlBlk.c
TWD/Data_Service/txHwQueue.c
TWD/FW_Transfer/CmdMBox.c
TWD/FW_Transfer/CmdMBox.h
TWD/FW_Transfer/Export_Inc/CmdMBox_api.h
TWD/FW_Transfer/Export_Inc/FwEvent_api.h
TWD/FW_Transfer/Export_Inc/HwInit_api.h
TWD/FW_Transfer/Export_Inc/eventMbox_api.h
TWD/FW_Transfer/Export_Inc/fwDebug_api.h
TWD/FW_Transfer/Export_Inc/rxXfer_api.h
TWD/FW_Transfer/Export_Inc/txResult_api.h
TWD/FW_Transfer/Export_Inc/txXfer_api.h
TWD/FW_Transfer/FwEvent.c
TWD/FW_Transfer/FwEvent.h
TWD/FW_Transfer/HwInit.c
TWD/FW_Transfer/HwInit.h
TWD/FW_Transfer/RxXfer.c
TWD/FW_Transfer/RxXfer.h
TWD/FW_Transfer/eventMbox.c
TWD/FW_Transfer/fwDebug.c
TWD/FW_Transfer/txResult.c
TWD/FW_Transfer/txXfer.c
TWD/FirmwareApi/public_commands.h
TWD/FirmwareApi/public_descriptors.h
TWD/FirmwareApi/public_event_mbox.h
TWD/FirmwareApi/public_host_int.h
TWD/FirmwareApi/public_infoele.h
TWD/FirmwareApi/public_radio.h
TWD/FirmwareApi/public_types.h
TWD/MacServices/Export_Inc/MacServices_api.h
TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h
TWD/MacServices/MacServices.c
TWD/MacServices/MacServices.h
TWD/MacServices/MeasurementSrv.c
TWD/MacServices/MeasurementSrv.h
TWD/MacServices/MeasurementSrvSM.c
TWD/MacServices/MeasurementSrvSM.h
TWD/MacServices/PowerSrv.c
TWD/MacServices/PowerSrv.h
TWD/MacServices/PowerSrvSM.c
TWD/MacServices/PowerSrvSM.h
TWD/MacServices/PowerSrv_API.h
TWD/MacServices/ScanSrv.c
TWD/MacServices/ScanSrv.h
TWD/MacServices/ScanSrvSM.c
TWD/MacServices/ScanSrvSM.h
TWD/MacServices/measurementSrvDbgPrint.c
TWD/TWDriver/Device.h
TWD/TWDriver/Device1273.h
TWD/TWDriver/TWDriver.c
TWD/TWDriver/TWDriver.h
TWD/TWDriver/TWDriverCtrl.c
TWD/TWDriver/TWDriverInternal.h
TWD/TWDriver/TWDriverMsr.h
TWD/TWDriver/TWDriverRadio.c
TWD/TWDriver/TWDriverRate.h
TWD/TWDriver/TWDriverScan.h
TWD/TWDriver/TWDriverTx.c
TWD/TwIf/TwIf.c
TWD/TwIf/TwIf.h
Txn/BusDrv.h
Txn/SdioBusDrv.c
Txn/TxnDefs.h
Txn/TxnQueue.c
Txn/TxnQueue.h
platforms/hw/host_platform_omap3430/Symbian/hpa/group/abld.bat
platforms/hw/host_platform_omap3430/Symbian/hpa/group/bld.inf
platforms/hw/host_platform_omap3430/Symbian/hpa/group/wlanhpa.mmp
platforms/hw/host_platform_omap3430/Symbian/hpa/src/tiwlanhpa.cpp
platforms/hw/host_platform_omap3430/Symbian/hpa/src/tiwlanhpa.h
platforms/os/Symbian/WVSS/group/omap3430/abld.bat
platforms/os/Symbian/WVSS/group/omap3430/bld.inf
platforms/os/Symbian/WVSS/group/omap3430/platformspecific.mmp
platforms/os/Symbian/WVSS/group/omap3430/twd_c_files.txt
platforms/os/Symbian/WVSS/group/omap3430/twd_inc_paths.txt
platforms/os/Symbian/WVSS/group/omap3430/wlanwvss.mmh
platforms/os/Symbian/WVSS/group/omap3430/wlanwvss.mmp
platforms/os/Symbian/WVSS/misc_files/radio_ini.h
platforms/os/Symbian/WVSS/src/external_inc/InternalCmdCodes.h
platforms/os/Symbian/WVSS/src/external_inc/OsApiDepend.h
platforms/os/Symbian/WVSS/src/external_inc/TI_IPC_Api.h
platforms/os/Symbian/WVSS/src/external_inc/coreDefaultParams.h
platforms/os/Symbian/WVSS/src/external_inc/paramout.h
platforms/os/Symbian/WVSS/src/hw/TIWlanHpaCB.cpp
platforms/os/Symbian/WVSS/src/hw/TIWlanHpaCB.h
platforms/os/Symbian/WVSS/src/os/RxBuf.h
platforms/os/Symbian/WVSS/src/os/external_inc.h
platforms/os/Symbian/WVSS/src/os/osTIType.h
platforms/os/Symbian/WVSS/src/os/osapi.cpp
platforms/os/Symbian/WVSS/src/os/pdd_names.h
platforms/os/Symbian/WVSS/src/os/spi_api.h
platforms/os/Symbian/WVSS/src/os/timerclient.cpp
platforms/os/Symbian/WVSS/src/os/timerclient.h
platforms/os/Symbian/WVSS/src/sdio/sdioadapter.cpp
platforms/os/Symbian/WVSS/src/sdio/sdioadapter.h
platforms/os/Symbian/WVSS/src/sdio/sdioclient.cpp
platforms/os/Symbian/WVSS/src/sdio/sdioclient.h
platforms/os/Symbian/WVSS/src/sdio/sdiodrv.h
platforms/os/Symbian/WVSS/src/utils/cdebugoutput.h
platforms/os/Symbian/WVSS/src/utils/gendebug.h
platforms/os/Symbian/WVSS/src/utils/wlantrace.cpp
platforms/os/Symbian/WVSS/src/utils/wlantrace.h
platforms/os/Symbian/WVSS/src/utils/wlantraceconfig.h
platforms/os/Symbian/WVSS/src/wha/TIWha.cpp
platforms/os/Symbian/WVSS/src/wha/TIWha.h
platforms/os/Symbian/WVSS/src/wha/TIWhaAdaptCb.cpp
platforms/os/Symbian/WVSS/src/wha/TIWhaAdaptCb.h
platforms/os/Symbian/WVSS/src/wha/TIWhaCb.cpp
platforms/os/Symbian/WVSS/src/wha/TIWhaDef.h
platforms/os/Symbian/WVSS/src/wha/TIWhaGemDef.h
platforms/os/Symbian/WVSS/src/wha/TIWhaPLTDef.h
platforms/os/Symbian/WVSS/src/wha/TIWhaTxRx.cpp
platforms/os/Symbian/WVSS/src/wha/TIWhaUtils.cpp
platforms/os/Symbian/WVSS/src/wha/TIWhaUtils.h
platforms/os/Symbian/wlanhwinit_stub/bwinscw/wlanhwinitu.def
platforms/os/Symbian/wlanhwinit_stub/eabi/wlanhwinitu.def
platforms/os/Symbian/wlanhwinit_stub/group/bld.inf
platforms/os/Symbian/wlanhwinit_stub/group/wlanhwinit.mmp
platforms/os/Symbian/wlanhwinit_stub/inc/radio_ini.h
platforms/os/Symbian/wlanhwinit_stub/inc/wlanhwinitmain.h
platforms/os/Symbian/wlanhwinit_stub/inc/wlanhwinittypes.h
platforms/os/Symbian/wlanhwinit_stub/rom/TI_wlanhwinit.iby
platforms/os/Symbian/wlanhwinit_stub/src/wlanhwinit.cpp
platforms/os/Symbian/wlanhwinit_stub/src/wlanhwinitmain.cpp
platforms/os/common/inc/IPCKernelApi.h
platforms/os/common/inc/WlanDrvCommon.h
platforms/os/common/inc/cli_cu_common.h
platforms/os/common/inc/osApi.h
platforms/os/common/inc/osDebug.h
platforms/os/common/inc/osRgstry.h
platforms/os/common/inc/spi_api.h
platforms/os/common/inc/tracebuf_api.h
utils/802_11Defs.h
utils/CmdInterfaceCodes.h
utils/GenSM.c
utils/GenSM.h
utils/ccx/osdot11ccx.h
utils/commonTypes.h
utils/context.c
utils/context.h
utils/freq.c
utils/freq.h
utils/fsm.c
utils/fsm.h
utils/mem.c
utils/mem.h
utils/osDot11.h
utils/queue.c
utils/queue.h
utils/rate.c
utils/rate.h
utils/report.c
utils/report.h
utils/stack.c
utils/stack.h
utils/tiQosTypes.h
utils/tidef.h
utils/timer.c
utils/timer.h
utils/version.h
wilink-firmware-nvs-6.1.0.0.299-win-Install.exe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgtags	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,2 @@
+ee6cd6008d58ff81ce6dbb9efe0ebb782b9bb6a2 WiLink_Driver_6.1.1.0.6
+bcd11d15909c34fbc856edbf2ec9932a6bcc2a36 WiLink_Driver_6.1.1.0.8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Readme_wlan_FwNvs.txt	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,23 @@
+###################################################################
+#
+#		CONNECTIVITY PACKAGE INSTALLATION STEPS
+#
+###################################################################
+
+1.
+	run wilink-firmware-nvs-6.1.0.0.299-win-Install.exe. 
+
+2.
+        Make sure you have selected the correct path to install the FW & NVS.
+        The correct path is root folder of the TI WLAN driver.
+        e.g. 
+                .
+                D:\sf\adaptation\wlan\ti\
+                C:\SF_SP30eMiniGui\sf\adaptation\wlan\ti
+        
+3.
+        This will place all the required files (FW & NVS) in their correct spot in your main package
+
+4.
+	Pay attention to read TI License Agreement.
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBld.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,2494 @@
+/*
+ * CmdBld.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdBld.c 
+ *  \brief Command builder main
+ *
+ *  \see   CmdBld.h 
+ */
+#define __FILE_ID__  FILE_ID_90
+#include "TWDriver.h"
+#include "osApi.h"
+#include "tidef.h"
+#include "report.h"
+#include "public_infoele.h"
+#include "CmdBld.h"
+#include "txResult_api.h"
+#include "CmdBldCmdIE.h"
+#include "CmdBldCfgIE.h"
+#include "CmdBldItrIE.h"
+#include "CmdQueue_api.h"
+#include "eventMbox_api.h"
+#include "TWDriverInternal.h"
+#include "HwInit_api.h"
+
+#define DEFAULT_TRACE_ENABLE                   0
+#define DEFAULT_TRACE_OUT                      0
+
+#define DEFAULT_PBCC_DYNAMIC_ENABLE_VAL        0
+#define DEFAULT_PBCC_DYNAMIC_INTERVAL          500
+#define DEFAULT_PBCC_DYNAMIC_IGNORE_MCAST      0
+
+#define DEFAULT_HW_RADIO_CHANNEL               11
+
+#define DEFAULT_CW_MIN                         15
+
+#define DEFAULT_USE_DEVICE_ERROR_INTERRUPT     1
+
+#define DEFAULT_UCAST_PRIORITY                 0
+
+#define DEFAULT_NUM_STATIONS                   1
+
+/* only for AP */
+/*  8 increase number of BC frames */
+#define DEFAULT_NUM_BCAST_TX_DESC              16  
+
+#define DEFAULT_BCAST_PRIORITY                 0x81
+
+/* hw access method*/
+typedef enum
+{
+    HW_ACCESS_BUS_SLAVE_INDIRECT    = 0,
+    HW_ACCESS_BUS_SLAVE_DIRECT      = 1,
+    HW_ACCESS_BUS_MASTER            = 2
+
+} EHwAccessMethod;
+
+typedef int (*TConfigFwCb) (TI_HANDLE, TI_STATUS);
+
+
+static TI_STATUS cmdBld_ConfigSeq               (TI_HANDLE hCmdBld);
+static TI_STATUS cmdBld_GetCurrentAssociationId (TI_HANDLE hCmdBld, TI_UINT16 *pAidVal);
+static TI_STATUS cmdBld_GetArpIpAddressesTable  (TI_HANDLE hCmdBld, TIpAddr *pIpAddr, TI_UINT8 *pEnabled , EIpVer *pIpVer);
+static TI_STATUS cmdBld_JoinCmpltForReconfigCb  (TI_HANDLE hCmdBld);
+static TI_STATUS cmdBld_DummyCb                 (TI_HANDLE hCmdBld);
+
+
+
+
+TI_HANDLE cmdBld_Create (TI_HANDLE hOs)
+{
+    TCmdBld        *pCmdBld;
+    TI_UINT32          uNumOfStations;
+    TI_UINT32      i;
+
+    /* Allocate the command builder */
+    pCmdBld = (TCmdBld *)os_memoryAlloc (hOs, sizeof(TCmdBld),MemoryNormal);
+    if (pCmdBld == NULL)
+    {
+        WLAN_OS_REPORT(("cmdBld_Create: Error memory allocation\n"));
+        return NULL;
+    }
+    os_memoryZero (hOs, (void *)pCmdBld, sizeof(TCmdBld));
+
+    pCmdBld->hOs = hOs;
+
+    /* Create the Params object */
+    /* make this code flat, move it to configure */
+    {
+        TWlanParams     *pWlanParams    = &DB_WLAN(pCmdBld);
+        TDmaParams      *pDmaParams     = &DB_DMA(pCmdBld);
+        TBssInfoParams  *pBssInfoParams = &DB_BSS(pCmdBld);
+        TGenCounters    *pGenCounters   = &DB_CNT(pCmdBld);
+
+        /* General counters */
+        pGenCounters->FcsErrCnt                     = 0;
+
+        /* BSS info paramaters */
+        pBssInfoParams->RadioChannel                = DEFAULT_HW_RADIO_CHANNEL;
+        pBssInfoParams->Ctrl                        = 0;
+        /*
+         * Intilaize the ctrl field in the BSS join structure 
+         * Only bit_7 in the ctrl field is vurrently in use.
+         * If bit_7 is on => Doing Tx flash before joining new AP 
+         */
+        pBssInfoParams->Ctrl                        |= JOIN_CMD_CTRL_TX_FLUSH;
+
+        /* WLAN parameters*/
+
+        /* Init filters as station (start/join with BssType will overwrite the values) */
+        cmdBld_SetRxFilter ((TI_HANDLE)pCmdBld, RX_CONFIG_OPTION_MY_DST_MY_BSS, RX_FILTER_OPTION_FILTER_ALL);
+        pWlanParams->UseDeviceErrorInterrupt        = DEFAULT_USE_DEVICE_ERROR_INTERRUPT;
+        /* Initialize the params object database fields */
+        pWlanParams->hwAccessMethod = HW_ACCESS_BUS_SLAVE_INDIRECT;
+        pWlanParams->maxSitesFragCollect = TWD_SITE_FRAG_COLLECT_DEF;
+        pWlanParams->RtsThreshold = TWD_RTS_THRESHOLD_DEF; 
+        pWlanParams->bJoin = TI_FALSE;
+        /* Soft Gemini defaults */
+        pWlanParams->SoftGeminiEnable = SG_DISABLE;
+        /* Beacon filter defaults */
+        pWlanParams->beaconFilterParams.desiredState    = TI_FALSE;
+        pWlanParams->beaconFilterParams.numOfElements   = DEF_NUM_STORED_FILTERS;
+        pWlanParams->beaconFilterIETable.numberOfIEs    = DEF_BEACON_FILTER_IE_TABLE_NUM;
+        pWlanParams->beaconFilterIETable.IETableSize    = BEACON_FILTER_IE_TABLE_DEF_SIZE;
+        /* Roaming  parameters */
+        pWlanParams->roamTriggers.BssLossTimeout    = NO_BEACON_DEFAULT_TIMEOUT;
+        pWlanParams->roamTriggers.TsfMissThreshold  = OUT_OF_SYNC_DEFAULT_THRESHOLD;
+        /* CoexActivity table */
+        pWlanParams->tWlanParamsCoexActivityTable.numOfElements = COEX_ACTIVITY_TABLE_DEF_NUM; 
+
+        /* DMA parameters */
+        /* Initialize the Params object database fields*/
+        pDmaParams->NumStations                     = DEFAULT_NUM_STATIONS;
+        uNumOfStations                              = (TI_UINT32)pDmaParams->NumStations;
+        /* 
+         * loop an all rssi_snr triggers and initialize only index number. 
+         * Reason: 'index' not initialized --> 'index = 0' --> triggers 1..7 will overrun trigger '0' in cmdBld_ConfigSeq
+         */
+        for (i = 0; i < NUM_OF_RSSI_SNR_TRIGGERS ; i++) 
+        {
+           pWlanParams->tRssiSnrTrigger[i].index = i;
+        }
+    }
+    
+    pCmdBld->uLastElpCtrlMode = ELPCTRL_MODE_NORMAL;
+    
+    /* Create security objects */
+    pCmdBld->tSecurity.eSecurityMode = TWD_CIPHER_NONE;
+    pCmdBld->tSecurity.uNumOfStations = uNumOfStations;
+    DB_KEYS(pCmdBld).pReconfKeys = (TSecurityKeys*)os_memoryAlloc (hOs, 
+                                        sizeof(TSecurityKeys) * (uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS),MemoryNormal);
+    os_memoryZero (hOs, 
+                   (void *)(DB_KEYS(pCmdBld).pReconfKeys), 
+                   sizeof(TSecurityKeys) * (uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS));
+
+
+    WLAN_INIT_REPORT(("cmdBld_Create end %x\n",(TI_HANDLE)pCmdBld));
+
+    return (TI_HANDLE)pCmdBld;
+}
+
+
+TI_STATUS cmdBld_Destroy (TI_HANDLE hCmdBld)
+{
+    TCmdBld      *pCmdBld = (TCmdBld *)hCmdBld;
+    TDmaParams   *pDmaParams = NULL;
+    TI_UINT32        uNumOfStations;
+    
+    if (pCmdBld == NULL)
+    {
+        return TI_OK;
+    }
+
+    pDmaParams = &DB_DMA(hCmdBld);
+
+    uNumOfStations = (TI_UINT32)pDmaParams->NumStations;
+
+    if (DB_KEYS(pCmdBld).pReconfKeys)
+    {
+        os_memoryFree (pCmdBld->hOs, 
+                       DB_KEYS(pCmdBld).pReconfKeys, 
+                       sizeof(TSecurityKeys) * (uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS));
+    }
+  
+    /* free the whalCtrl data structure */
+    os_memoryFree (pCmdBld->hOs, pCmdBld, sizeof(TCmdBld));
+    
+    return TI_OK;
+}
+
+TI_STATUS cmdBld_Restart (TI_HANDLE hCmdBld)
+{
+    TCmdBld      *pCmdBld = (TCmdBld *)hCmdBld;
+    
+    /* This init is for recovery stage */
+    pCmdBld->uLastElpCtrlMode = ELPCTRL_MODE_NORMAL;
+
+    /* 
+     * This call is to have the recovery process in AWAKE mode 
+     * Prevent move to sleep mode between Hw_Init and Fw_Init
+     */
+	cmdBld_CfgIeSleepAuth (hCmdBld, DB_WLAN(hCmdBld).minPowerLevel, NULL, NULL);
+
+    return TI_OK;
+}
+
+TI_STATUS cmdBld_Config (TI_HANDLE  hCmdBld, 
+                         TI_HANDLE  hReport, 
+                         void      *fFinalizeDownload, 
+                         TI_HANDLE  hFinalizeDownload, 
+                         TI_HANDLE  hEventMbox, 
+                         TI_HANDLE  hCmdQueue,
+                         TI_HANDLE  hTwIf)
+{
+    TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT32       index;
+    
+    pCmdBld->hReport = hReport;
+    pCmdBld->fFinalizeDownload = fFinalizeDownload;
+    pCmdBld->hFinalizeDownload = hFinalizeDownload;
+    pCmdBld->hEventMbox = hEventMbox;
+    pCmdBld->hCmdQueue = hCmdQueue;
+    pCmdBld->hTwIf  = hTwIf;
+
+    /* Reset all reconfig valid fields*/
+    DB_KEYS(pCmdBld).bHwEncDecrEnableValid = TI_FALSE;
+    DB_KEYS(pCmdBld).bDefaultKeyIdValid    = TI_FALSE;  
+    for (index = 0; 
+         index < pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS; 
+         index++)
+        (DB_KEYS(pCmdBld).pReconfKeys + index)->keyType = KEY_NULL;
+
+
+    return TI_OK;
+}
+
+
+
+static void cmdBld_ConfigFwCb (TI_HANDLE hCmdBld, TI_STATUS status, void *pData)
+{
+    TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
+    MemoryMap_t    *pMemMap = &pCmdBld->tMemMap;
+    TDmaParams     *pDmaParams = &DB_DMA(hCmdBld);
+
+    /* Arrived from callback */
+    if (pData)
+    {
+        TI_UINT32         *pSwap, i, uMemMapNumFields;
+
+        /* Solve endian problem (all fields are 32 bit) */
+        uMemMapNumFields = (sizeof(MemoryMap_t) - sizeof(EleHdrStruct)) % 4;
+        pSwap = (TI_UINT32* )&(pMemMap->codeStart);
+        for (i = 0; i < uMemMapNumFields; i++)
+        {
+            pSwap[i] = ENDIAN_HANDLE_LONG(pSwap[i]);
+        }
+    }
+
+    /* Save number of TX blocks */
+    pDmaParams->NumTxBlocks = pMemMap->numTxMemBlks;
+    /* Firmware Control block is internally pointing to TxResultInterface structure */
+    pDmaParams->fwTxResultInterface = pMemMap->trqBlock.controlBlock; 
+    pDmaParams->fwRxCBufPtr =           pMemMap->rxCBufPtr;
+    pDmaParams->fwTxCBufPtr =           pMemMap->txCBufPtr;
+    pDmaParams->fwRxControlPtr =        pMemMap->rxControlPtr;
+    pDmaParams->fwTxControlPtr =        pMemMap->txControlPtr;
+
+    pDmaParams->PacketMemoryPoolStart = (TI_UINT32)pMemMap->packetMemoryPoolStart;
+
+    /* Call the upper layer callback */
+    (*((TConfigFwCb)pCmdBld->fConfigFwCb)) (pCmdBld->hConfigFwCb, TI_OK);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ConfigFw()
+ ****************************************************************************
+ * DESCRIPTION: Configure the WLAN firmware
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT: None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ConfigFw (TI_HANDLE hCmdBld, void *fConfigFwCb, TI_HANDLE hConfigFwCb)
+{
+    TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
+
+    pCmdBld->fConfigFwCb = fConfigFwCb;
+    pCmdBld->hConfigFwCb = hConfigFwCb; 
+    pCmdBld->uIniSeq = 0;
+    /* should be re-initialized for recovery,   pCmdBld->uLastElpCtrlMode = ELPCTRL_MODE_KEEP_AWAKE; */
+
+    /* Start configuration sequence */
+    return cmdBld_ConfigSeq (hCmdBld);
+}
+
+
+typedef TI_STATUS (*TCmdCfgFunc) (TI_HANDLE);
+
+
+static TI_STATUS __cmd_probe_req (TI_HANDLE hCmdBld)
+{
+    TI_STATUS   tStatus = TI_OK;
+
+    /* keep space for 2.4 GHz probe request */
+    tStatus = cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                  NULL, 
+                                                  DB_WLAN(hCmdBld).probeRequestTemplateSize,
+                                                  CFG_TEMPLATE_PROBE_REQ_2_4,
+                                                  0,
+                                                  NULL,
+                                                  NULL);
+    if (TI_OK != tStatus)
+    {
+        return tStatus;
+    }
+
+    /* keep space for 5.0 GHz probe request */
+    return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                               NULL, 
+                                               DB_WLAN(hCmdBld).probeRequestTemplateSize,
+                                               CFG_TEMPLATE_PROBE_REQ_5,
+                                               0,
+                                             (void *)cmdBld_ConfigSeq,
+                                             hCmdBld); 
+}
+
+
+static TI_STATUS __cmd_null_data (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                             NULL, 
+                                             DB_WLAN(hCmdBld).nullTemplateSize,
+                                               TEMPLATE_NULL_DATA,
+                                               0,
+                                             (void *)cmdBld_ConfigSeq,
+                                             hCmdBld); 
+}
+
+static TI_STATUS __cmd_burst_mode_enable (TI_HANDLE hCmdBld)
+{
+	return cmdBld_CfgIeBurstMode (hCmdBld, 
+							  DB_AC(hCmdBld).isBurstModeEnabled, 
+							  (void *)cmdBld_ConfigSeq, 
+							  hCmdBld);
+}
+
+/*
+static TI_STATUS __cmd_smart_reflex_debug (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeSRDebug (hCmdBld, 
+							   &(DB_SR(hCmdBld).tSmartReflexDebugParams),
+							   (void *)cmdBld_ConfigSeq, 
+							   hCmdBld);
+}
+               
+
+static TI_STATUS __cmd_smart_reflex_state (TI_HANDLE hCmdBld)
+{
+	return cmdBld_CfgIeSRState (hCmdBld, 
+							   (uint8) DB_SR(hCmdBld).tSmartReflexState.enable, 
+							   (void *)cmdBld_ConfigSeq, 
+							   hCmdBld);
+}
+*/
+static TI_STATUS __cmd_disconn (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                             NULL, 
+                                             DB_WLAN(hCmdBld).disconnTemplateSize,
+                                             TEMPLATE_DISCONNECT,
+                                             0,
+                                             (void *)cmdBld_ConfigSeq,
+                                             hCmdBld); 
+}
+
+static TI_STATUS __cmd_ps_poll (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                             NULL, 
+                                             DB_WLAN(hCmdBld).PsPollTemplateSize,
+                                               TEMPLATE_PS_POLL,
+                                               0,
+                                             (void *)cmdBld_ConfigSeq,
+                                             hCmdBld); 
+}
+
+
+static TI_STATUS __cmd_qos_null_data (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                             NULL, 
+                                             DB_WLAN(hCmdBld).qosNullDataTemplateSize,
+                                               TEMPLATE_QOS_NULL_DATA,
+                                               0,
+                                             (void *)cmdBld_ConfigSeq,
+                                             hCmdBld); 
+}
+
+
+static TI_STATUS __cmd_probe_resp (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                             NULL, 
+                                             DB_WLAN(hCmdBld).probeResponseTemplateSize,
+                                               TEMPLATE_PROBE_RESPONSE,
+                                               0,
+                                             (void *)cmdBld_ConfigSeq,
+                                             hCmdBld); 
+}
+
+
+static TI_STATUS __cmd_beacon (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                             NULL, 
+                                             DB_WLAN(hCmdBld).beaconTemplateSize,
+                                               TEMPLATE_BEACON,
+                                               0,
+                                             (void *)cmdBld_ConfigSeq,
+                                             hCmdBld); 
+}
+
+static TI_STATUS __cmd_keep_alive_tmpl (TI_HANDLE hCmdBld)
+{
+    TI_UINT32   index;
+    TI_STATUS   status = TI_NOK;
+
+    /* 
+     * config templates 
+     * fisr configure all indexes but the last one with no CB, and than configure the last one 
+     * with a CB to continue configuration.
+     */
+    for (index = 0; index < KLV_MAX_TMPL_NUM - 1; index++)
+    {
+        status =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                      NULL, 
+                                                      MAX_TEMPLATES_SIZE,
+                                                      TEMPLATE_KLV,
+                                                      index,
+                                                      NULL,
+                                                      NULL);
+        if (TI_OK != status)
+        {
+            return status;
+        }
+    }
+
+    status =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                  NULL, 
+                                                  MAX_TEMPLATES_SIZE,
+                                                  TEMPLATE_KLV,
+                                                  index,
+                                                  (void *)cmdBld_ConfigSeq,
+                                                  hCmdBld);
+
+    return status;
+}
+
+
+static TI_STATUS __cfg_mem (TI_HANDLE hCmdBld)
+{
+    /* Configure the weight among the different hardware queues */
+    return cmdBld_CfgIeConfigMemory (hCmdBld, &DB_DMA(hCmdBld), (void *)cmdBld_ConfigSeq, hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rx_msdu_life_time (TI_HANDLE hCmdBld)
+{    
+    /* Configure the Rx Msdu Life Time (expiry time of de-fragmentation in FW) */
+    return cmdBld_CfgIeRxMsduLifeTime (hCmdBld, 
+                                       DB_WLAN(hCmdBld).MaxRxMsduLifetime, 
+                                       (void *)cmdBld_ConfigSeq, 
+                                       hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rx (TI_HANDLE hCmdBld)
+{    
+    return cmdBld_CfgIeRx (hCmdBld, 
+                           DB_WLAN(hCmdBld).RxConfigOption, 
+                           DB_WLAN(hCmdBld).RxFilterOption, 
+                           (void *)cmdBld_ConfigSeq, 
+                           hCmdBld);
+}
+
+
+static TI_STATUS __cfg_ac_params_0 (TI_HANDLE hCmdBld)
+{
+    /*
+     * NOTE: Set following parameter only if configured.
+     *       Otherwise, is contains garbage.
+     */
+
+    if (DB_AC(hCmdBld).isAcConfigured[0])
+    {
+        return cmdBld_CfgAcParams (hCmdBld, &DB_AC(hCmdBld).ac[0], (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+static TI_STATUS __cfg_ac_params_1 (TI_HANDLE hCmdBld)
+{
+    /*
+     * NOTE: Set following parameter only if configured.
+     *       Otherwise, is contains garbage.
+     */
+
+    if (DB_AC(hCmdBld).isAcConfigured[1])
+    {
+        return cmdBld_CfgAcParams (hCmdBld, &DB_AC(hCmdBld).ac[1], (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+static TI_STATUS __cfg_ac_params_2 (TI_HANDLE hCmdBld)
+{
+    /*
+     * NOTE: Set following parameter only if configured.
+     *       Otherwise, is contains garbage.
+     */
+
+    if (DB_AC(hCmdBld).isAcConfigured[2])
+    {
+        return cmdBld_CfgAcParams (hCmdBld, &DB_AC(hCmdBld).ac[2], (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+static TI_STATUS __cfg_ac_params_3 (TI_HANDLE hCmdBld)
+{
+    /*
+     * NOTE: Set following parameter only if configured.
+     *       Otherwise, is contains garbage.
+     */
+
+    if (DB_AC(hCmdBld).isAcConfigured[3])
+    {
+        return cmdBld_CfgAcParams (hCmdBld, &DB_AC(hCmdBld).ac[3], (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+static TI_STATUS __cfg_tid_0 (TI_HANDLE hCmdBld)
+{
+    /*
+     * NOTE: Set following parameter only if configured.
+     *       Otherwise, is contains garbage.
+     */
+    if (DB_QUEUES(hCmdBld).isQueueConfigured[0])
+    {
+        return cmdBld_CfgTid (hCmdBld, &DB_QUEUES(hCmdBld).queues[0], (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+static TI_STATUS __cfg_tid_1 (TI_HANDLE hCmdBld)
+{
+    /*
+     * NOTE: Set following parameter only if configured.
+     *       Otherwise, is contains garbage.
+     */
+    if (DB_QUEUES(hCmdBld).isQueueConfigured[1])
+    {
+        return cmdBld_CfgTid (hCmdBld, &DB_QUEUES(hCmdBld).queues[1], (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+static TI_STATUS __cfg_tid_2 (TI_HANDLE hCmdBld)
+{
+    /*
+     * NOTE: Set following parameter only if configured.
+     *       Otherwise, is contains garbage.
+     */
+    if (DB_QUEUES(hCmdBld).isQueueConfigured[2])
+    {
+        return cmdBld_CfgTid (hCmdBld, &DB_QUEUES(hCmdBld).queues[2], (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+static TI_STATUS __cfg_tid_3 (TI_HANDLE hCmdBld)
+{
+    /*
+     * NOTE: Set following parameter only if configured.
+     *       Otherwise, is contains garbage.
+     */
+    if (DB_QUEUES(hCmdBld).isQueueConfigured[3])
+    {
+        return cmdBld_CfgTid (hCmdBld, &DB_QUEUES(hCmdBld).queues[3], (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+static TI_STATUS __cfg_ps_rx_streaming (TI_HANDLE hCmdBld)
+{
+    TI_UINT32       index;
+    TI_STATUS        eStatus;
+    TPsRxStreaming *pPsRxStreaming;
+
+
+    if (!DB_WLAN(hCmdBld).bJoin)
+    {
+        return TI_NOK;
+    }
+
+    /* Config enabled streams (disable is the FW default). */
+    for (index = 0; index < MAX_NUM_OF_802_1d_TAGS - 1; index++)
+    {
+        pPsRxStreaming = &(DB_PS_STREAM(hCmdBld).tid[index]);
+
+        if (pPsRxStreaming->bEnabled)
+        {
+            eStatus = cmdBld_CfgPsRxStreaming (hCmdBld, pPsRxStreaming, NULL, NULL);
+            if (eStatus != TI_OK) 
+            {
+                return eStatus;
+            }
+        }
+    }
+
+    /* Set NOK for a case the following config is skipped, to indicate that no callback is expected */
+    eStatus = TI_NOK;
+
+    pPsRxStreaming = &(DB_PS_STREAM(hCmdBld).tid[MAX_NUM_OF_802_1d_TAGS - 1]);
+    if (pPsRxStreaming->bEnabled)
+    {
+        eStatus = cmdBld_CfgPsRxStreaming (hCmdBld, pPsRxStreaming, (void *)cmdBld_ConfigSeq, hCmdBld);
+        if (eStatus != TI_OK) 
+        {
+            return eStatus;
+        }
+    }
+
+    return eStatus; 
+    }
+
+
+static TI_STATUS __cfg_rx_data_filter (TI_HANDLE hCmdBld)
+{
+    TI_UINT32       index;
+    TI_STATUS       eStatus;
+    TRxDataFilter   *pFilters;
+
+
+    if (DB_RX_DATA_FLTR(hCmdBld).bEnabled) 
+    {
+        eStatus = cmdBld_CfgIeEnableRxDataFilter (hCmdBld, 
+                                                  DB_RX_DATA_FLTR(hCmdBld).bEnabled, 
+                                                  DB_RX_DATA_FLTR(hCmdBld).eDefaultAction, 
+                                                  NULL, 
+                                                  NULL);
+        if (eStatus != TI_OK) 
+        {
+            return eStatus;
+        }
+    }
+
+    /* 
+     * Config enabled filters (last one is separated to use the callback) 
+     */
+    for (index = 0; index < MAX_DATA_FILTERS - 1; index++)
+    {
+        pFilters = &(DB_RX_DATA_FLTR(hCmdBld).aRxDataFilter[index]);
+
+        if (pFilters->uCommand == ADD_FILTER)
+        {
+            eStatus = cmdBld_CfgIeRxDataFilter (hCmdBld, 
+                                                pFilters->uIndex, 
+                                                pFilters->uCommand, 
+                                                pFilters->eAction, 
+                                                pFilters->uNumFieldPatterns, 
+                                                pFilters->uLenFieldPatterns, 
+                                                pFilters->aFieldPattern, 
+                                                NULL, 
+                                                NULL);
+            if (eStatus != TI_OK) 
+    {
+                return eStatus;
+            }
+        }
+    }
+
+    /* Set NOK for a case the following config is skipped, to indicate that no callback is expected */
+        eStatus = TI_NOK;
+
+    pFilters = &(DB_RX_DATA_FLTR(hCmdBld).aRxDataFilter[MAX_DATA_FILTERS - 1]);
+    if (pFilters->uCommand == ADD_FILTER)
+    {
+        eStatus = cmdBld_CfgIeRxDataFilter (hCmdBld, 
+                                            pFilters->uIndex, 
+                                            pFilters->uCommand, 
+                                            pFilters->eAction, 
+                                            pFilters->uNumFieldPatterns, 
+                                            pFilters->uLenFieldPatterns, 
+                                            pFilters->aFieldPattern, 
+                                            (void *)cmdBld_ConfigSeq, 
+                                            hCmdBld);
+        if (eStatus != TI_OK) 
+        {
+            return eStatus;
+        }
+    }
+
+    return eStatus;
+}
+
+
+static TI_STATUS __cfg_pd_threshold (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIePacketDetectionThreshold (hCmdBld, 
+                                                 DB_WLAN(hCmdBld).PacketDetectionThreshold, 
+                                                 (void *)cmdBld_ConfigSeq, 
+                                                 hCmdBld);
+}
+
+
+static TI_STATUS __cfg_slot_time (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeSlotTime (hCmdBld, DB_WLAN(hCmdBld).SlotTime, (void *)cmdBld_ConfigSeq, hCmdBld);
+}
+
+
+static TI_STATUS __cfg_arp_ip_filter (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeArpIpFilter (hCmdBld, 
+                                    DB_WLAN(hCmdBld).arp_IP_addr, 
+                                    (TI_BOOL)DB_WLAN(hCmdBld).isArpIpFilteringEnabled, 
+                                    (void *)cmdBld_ConfigSeq, 
+                                    hCmdBld);
+}
+
+static TI_STATUS __cfg_group_address_table (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeGroupAdressTable (hCmdBld, 
+                                         DB_WLAN(hCmdBld).numGroupAddrs, 
+                                         DB_WLAN(hCmdBld).aGroupAddr, 
+                                         DB_WLAN(hCmdBld).isMacAddrFilteringnabled, 
+                                         (void *)cmdBld_ConfigSeq, 
+                                         hCmdBld);
+}
+
+
+static TI_STATUS __cfg_service_period_timeout (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeServicePeriodTimeout (hCmdBld, 
+                                             &DB_WLAN(hCmdBld).rxTimeOut, 
+                                             (void *)cmdBld_ConfigSeq, 
+                                             hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rts_threshold (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgRtsThreshold (hCmdBld, 
+                                   DB_WLAN(hCmdBld).RtsThreshold, 
+                                   (void *)cmdBld_ConfigSeq, 
+                                   hCmdBld);
+}
+
+static TI_STATUS __cfg_dco_itrim_params (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgDcoItrimParams (hCmdBld, 
+                                     DB_WLAN(hCmdBld).dcoItrimEnabled, 
+                                     DB_WLAN(hCmdBld).dcoItrimModerationTimeoutUsec, 
+                                     (void *)cmdBld_ConfigSeq, 
+                                     hCmdBld);
+}
+
+static TI_STATUS __cfg_fragment_threshold (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeFragmentThreshold (hCmdBld, 
+                                          DB_WLAN(hCmdBld).FragmentThreshold, 
+                                          (void *)cmdBld_ConfigSeq, 
+                                          hCmdBld);
+}
+
+
+static TI_STATUS __cfg_pm_config (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIePmConfig (hCmdBld, 
+                                 DB_WLAN(hCmdBld).uHostClkSettlingTime,
+                                 DB_WLAN(hCmdBld).uHostFastWakeupSupport, 
+                                 (void *)cmdBld_ConfigSeq, 
+                                 hCmdBld);
+}
+
+
+static TI_STATUS __cfg_beacon_filter_opt (TI_HANDLE hCmdBld)
+{
+    /* Set The Beacon Filter in HAL */
+    return cmdBld_CfgIeBeaconFilterOpt (hCmdBld, 
+                                        DB_WLAN(hCmdBld).beaconFilterParams.desiredState,
+                                        DB_WLAN(hCmdBld).beaconFilterParams.numOfElements, 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_beacon_filter_table (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeBeaconFilterTable (hCmdBld, 
+                                          DB_WLAN(hCmdBld).beaconFilterIETable.numberOfIEs,
+                                          DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
+                                          DB_WLAN(hCmdBld).beaconFilterIETable.IETableSize, 
+                                          (void *)cmdBld_ConfigSeq, 
+                                          hCmdBld);
+}
+
+
+static TI_STATUS __cfg_tx_cmplt_pacing (TI_HANDLE hCmdBld)
+{    
+    return cmdBld_CfgIeTxCmpltPacing (hCmdBld, 
+                                      DB_WLAN(hCmdBld).TxCompletePacingThreshold,
+                                      DB_WLAN(hCmdBld).TxCompletePacingTimeout,
+                                      (void *)cmdBld_ConfigSeq, 
+                                      hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rx_intr_pacing (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeRxIntrPacing (hCmdBld, 
+                                     DB_WLAN(hCmdBld).RxIntrPacingThreshold,
+                                     DB_WLAN(hCmdBld).RxIntrPacingTimeout,
+                         (void *)cmdBld_ConfigSeq, 
+                               hCmdBld);
+}
+
+#if 0
+#ifdef TI_TEST
+    static TI_STATUS __cfg_coex_activity_table (TI_HANDLE hCmdBld)
+    {
+        TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
+        TI_UINT32 uNumberOfIEs = DB_WLAN(hCmdBld).tWlanParamsCoexActivityTable.numOfElements;
+        TCoexActivity *CoexActivityTable = DB_WLAN(hCmdBld).tWlanParamsCoexActivityTable.entry;
+        TI_STATUS   status = TI_NOK;
+        TI_UINT32   index;
+    
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , " CoexActivity, uNumberOfIEs=%d\n", uNumberOfIEs);
+        if (uNumberOfIEs == 0)
+        {
+            return status;
+        }
+        /* 
+         * config CoexActivity table 
+         * first configure all indexes but the last one with no CB, and than configure the last one 
+         * with a CB to continue configuration.
+         */
+        for (index = 0; index < uNumberOfIEs-1; index++)
+        {
+            TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , " CoexActivity, send %d\n", index);
+            status =  cmdBld_CfgIeCoexActivity (hCmdBld, &CoexActivityTable[index], 
+                                                    NULL, NULL);
+            if (TI_OK != status)
+            {
+                return status;
+            }
+        }
+    
+        /* Send last activity with a callback to continue config sequence */
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , " CoexActivity, send last %d\n", index);
+        status =  cmdBld_CfgIeCoexActivity (hCmdBld, &CoexActivityTable[index], 
+                                                (void *)cmdBld_ConfigSeq, hCmdBld);
+    
+        return status;
+    }
+#endif
+#endif
+
+static TI_STATUS __cfg_cca_threshold (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeCcaThreshold (hCmdBld, 
+                                     DB_WLAN(hCmdBld).EnergyDetection, 
+                                     (void *)cmdBld_ConfigSeq, 
+                                     hCmdBld);
+}
+
+
+static TI_STATUS __cfg_bcn_brc_options (TI_HANDLE hCmdBld)
+{
+    TPowerMgmtConfig powerMgmtConfig;                   
+
+    /* Beacon broadcast options */
+    powerMgmtConfig.BcnBrcOptions = DB_WLAN(hCmdBld).BcnBrcOptions;
+	powerMgmtConfig.ConsecutivePsPollDeliveryFailureThreshold = DB_WLAN(hCmdBld).ConsecutivePsPollDeliveryFailureThreshold;
+
+    return cmdBld_CfgIeBcnBrcOptions (hCmdBld, 
+                                      &powerMgmtConfig, 
+                                      (void *)cmdBld_ConfigSeq, 
+                                      hCmdBld);
+}
+
+
+static TI_STATUS __cmd_enable_rx (TI_HANDLE hCmdBld)
+{
+    /* Enable rx path on the hardware */
+    return cmdBld_CmdEnableRx (hCmdBld, (void *)cmdBld_ConfigSeq, hCmdBld);
+}
+
+
+static TI_STATUS __cmd_enable_tx (TI_HANDLE hCmdBld)
+{
+    /* Enable tx path on the hardware */
+    return cmdBld_CmdEnableTx (hCmdBld, 
+                               DB_DEFAULT_CHANNEL(hCmdBld), 
+                               (void *)cmdBld_ConfigSeq, 
+                               hCmdBld);
+}
+
+
+static TI_STATUS __cfg_ps_wmm (TI_HANDLE hCmdBld)
+{
+    /* ACX for a work around for Wi-Fi test */
+    return cmdBld_CfgIePsWmm (hCmdBld, 
+                              DB_WLAN(hCmdBld).WiFiWmmPS, 
+                              (void *)cmdBld_ConfigSeq, 
+                              hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_weights (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Weights for Average calculations */
+    return cmdBld_CfgIeRssiSnrWeights (hCmdBld, 
+                                       &DB_WLAN(hCmdBld).tRssiSnrWeights, 
+                                       (void *)cmdBld_ConfigSeq, 
+                                       hCmdBld);
+}
+
+
+static TI_STATUS __cfg_event_scan_cmplt (TI_HANDLE hCmdBld)
+{    
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+
+    /* Enable the scan complete interrupt source */
+    return eventMbox_UnMaskEvent (pCmdBld->hEventMbox, 
+                               TWD_OWN_EVENT_SCAN_CMPLT, 
+                               (void *)cmdBld_ConfigSeq, 
+                               hCmdBld);
+}
+
+static TI_STATUS __cfg_event_sps_scan_cmplt (TI_HANDLE hCmdBld)
+{    
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return eventMbox_UnMaskEvent (pCmdBld->hEventMbox, 
+                               TWD_OWN_EVENT_SPS_SCAN_CMPLT, 
+                               (void *)cmdBld_ConfigSeq, 
+                               hCmdBld);
+}
+
+static TI_STATUS __cfg_event_plt_rx_calibration_cmplt (TI_HANDLE hCmdBld)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return eventMbox_UnMaskEvent (pCmdBld->hEventMbox, 
+                               TWD_OWN_EVENT_PLT_RX_CALIBRATION_COMPLETE, 
+                               (void *)cmdBld_ConfigSeq, 
+                               hCmdBld);
+}
+
+
+static TI_STATUS __cfg_hw_enc_dec_enable (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgHwEncDecEnable (hCmdBld, TI_TRUE, (void *)cmdBld_ConfigSeq, hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_trigger_0 (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Troggers */
+    return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).tRssiSnrTrigger[0], 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_trigger_1 (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Troggers */
+    return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).tRssiSnrTrigger[1], 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_trigger_2 (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Troggers */
+    return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).tRssiSnrTrigger[2], 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_trigger_3 (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Troggers */
+    return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).tRssiSnrTrigger[3], 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_trigger_4 (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Troggers */
+    return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).tRssiSnrTrigger[4], 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_trigger_5 (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Troggers */
+    return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).tRssiSnrTrigger[5], 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_trigger_6 (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Troggers */
+    return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).tRssiSnrTrigger[6], 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rssi_snr_trigger_7 (TI_HANDLE hCmdBld)
+{
+    /* RSSI/SNR Troggers */
+    return  cmdBld_CfgIeRssiSnrTrigger (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).tRssiSnrTrigger[7], 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_max_tx_retry (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeMaxTxRetry (hCmdBld, 
+                                   &DB_WLAN(hCmdBld).roamTriggers, 
+                                   (void *)cmdBld_ConfigSeq, 
+                                   hCmdBld);
+}
+
+
+
+static TI_STATUS __cfg_split_scan_timeout (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CmdIeSetSplitScanTimeOut (hCmdBld, 
+                                            DB_WLAN(hCmdBld).uSlicedScanTimeOut, 
+                                            (void *)cmdBld_ConfigSeq, 
+                                            hCmdBld);
+}
+
+
+static TI_STATUS __cfg_conn_monit_params (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeConnMonitParams (hCmdBld, 
+                                        &DB_WLAN(hCmdBld).roamTriggers, 
+                                        (void *)cmdBld_ConfigSeq, 
+                                        hCmdBld);
+}
+
+
+static TI_STATUS __cfg_bet (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgBet (hCmdBld, 
+                          DB_WLAN(hCmdBld).BetEnable, 
+                          DB_WLAN(hCmdBld).MaximumConsecutiveET,
+                          (void *)cmdBld_ConfigSeq, 
+                          hCmdBld);
+}
+                
+
+static TI_STATUS __cfg_cts_protection (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeCtsProtection (hCmdBld,
+                                      DB_WLAN(hCmdBld).CtsToSelf, 
+                                      (void *)cmdBld_ConfigSeq, 
+                                      hCmdBld);
+}
+
+
+static TI_STATUS __cfg_radio_params (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgIeRadioParams (hCmdBld, 
+                                    &DB_RADIO(hCmdBld), 
+                                    (void *)cmdBld_ConfigSeq, 
+                                    hCmdBld);
+}
+
+static TI_STATUS __cfg_platform_params (TI_HANDLE hCmdBld)
+{
+    return cmdBld_CfgPlatformGenParams(hCmdBld, 
+                                      &DB_GEN(hCmdBld), 
+                                      (void *)cmdBld_ConfigSeq, 
+                                      hCmdBld);
+}
+
+
+
+static TI_STATUS __cfg_tx_rate_policy (TI_HANDLE hCmdBld)
+{
+    /*
+     * JOIN (use the local parameters), otherwize the CORE will reconnect
+     */
+    if (DB_WLAN(hCmdBld).bJoin)
+    {
+        /* Set TxRatePolicy */
+        return cmdBld_CfgTxRatePolicy (hCmdBld, 
+                                       &DB_BSS(hCmdBld).TxRateClassParams, 
+                                       (void *)cmdBld_ConfigSeq, 
+                                       hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cmd_beacon_join (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).Beacon.Size != 0)
+    {
+        return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                   &(DB_TEMP(hCmdBld).Beacon), 
+                                                 (TI_UINT16)DB_TEMP(hCmdBld).Beacon.Size,
+                                                   TEMPLATE_BEACON,
+                                                   0,
+                                                 (void *)cmdBld_ConfigSeq,
+                                                 hCmdBld);
+    }
+
+    return TI_NOK;
+}
+    
+static TI_STATUS __cmd_probe_resp_join (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).ProbeResp.Size != 0)
+    {
+        return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                   &(DB_TEMP(hCmdBld).ProbeResp), 
+                                                 (TI_UINT16)DB_TEMP(hCmdBld).ProbeResp.Size,
+                                                   TEMPLATE_PROBE_RESPONSE,
+                                                   0,
+                                                 (void *)cmdBld_ConfigSeq,
+                                                 hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cmd_probe_req_join (TI_HANDLE hCmdBld)
+{
+    TI_STATUS   tStatus;
+
+    /* set Probe Req template also if join == false ! */
+    if (DB_TEMP(hCmdBld).ProbeReq24.Size != 0)
+    {
+        tStatus =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                       &(DB_TEMP(hCmdBld).ProbeReq24), 
+                                                       (TI_UINT16)DB_TEMP(hCmdBld).ProbeReq24.Size,
+                                                       CFG_TEMPLATE_PROBE_REQ_2_4,
+                                                       0,
+                                                       NULL,
+                                                       NULL);
+        if (TI_OK != tStatus)
+        {
+            return tStatus;
+        }
+    }
+
+    /* set Probe Req template also if join == false ! */
+    if (DB_TEMP(hCmdBld).ProbeReq50.Size != 0)
+    {
+        return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                   &(DB_TEMP(hCmdBld).ProbeReq50), 
+                                                   (TI_UINT16)DB_TEMP(hCmdBld).ProbeReq50.Size,
+                                                   CFG_TEMPLATE_PROBE_REQ_5,
+                                                   0,
+                                                 (void *)cmdBld_ConfigSeq,
+                                                 hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cmd_null_data_join (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).NullData.Size != 0)
+    {
+        return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                   &(DB_TEMP(hCmdBld).NullData), 
+                                                 (TI_UINT16)DB_TEMP(hCmdBld).NullData.Size,
+                                                   TEMPLATE_NULL_DATA,
+                                                   0,
+                                                 (void *)cmdBld_ConfigSeq,
+                                                 hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+static TI_STATUS __cmd_disconn_join (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).Disconn.Size != 0)
+    {
+        return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                   &(DB_TEMP(hCmdBld).Disconn), 
+                                                   (TI_UINT16)DB_TEMP(hCmdBld).Disconn.Size,
+                                                   TEMPLATE_DISCONNECT,
+                                                   0,
+                                                   (void *)cmdBld_ConfigSeq,
+                                                   hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+static TI_STATUS __cmd_ps_poll_join (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).PsPoll.Size != 0)
+    {
+        return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                   &(DB_TEMP(hCmdBld).PsPoll), 
+                                                 (TI_UINT16)DB_TEMP(hCmdBld).PsPoll.Size,
+                                                   TEMPLATE_PS_POLL,
+                                                   0,
+                                                 (void *)cmdBld_ConfigSeq,
+                                                 hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cmd_keep_alive_tmpl_join (TI_HANDLE hCmdBld)
+{
+    TI_UINT32   index;
+    TI_STATUS   status = TI_NOK;
+
+    /* 
+     * config templates 
+     * first configure all indexes but the last one with no CB, and than configure the last one 
+     * with a CB to continue configuration.
+     */
+    for (index = 0; index < KLV_MAX_TMPL_NUM - 1; index++)
+    {
+        if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).KeepAlive[ index ].Size != 0)
+        {
+            status =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                          &(DB_TEMP(hCmdBld).KeepAlive[index]), 
+                                                          (TI_UINT16)DB_TEMP(hCmdBld).KeepAlive[index].Size,
+                                                          TEMPLATE_KLV,
+                                                          index,
+                                                          NULL,
+                                                          NULL);
+            if (TI_OK != status)
+            {
+                return status;
+            }
+        }
+    }
+
+    if (DB_WLAN(hCmdBld).bJoin && DB_TEMP(hCmdBld).KeepAlive[ index ].Size != 0)
+    {
+        status =  cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                                      &(DB_TEMP(hCmdBld).KeepAlive[index]), 
+                                                      (TI_UINT16)DB_TEMP(hCmdBld).KeepAlive[index].Size,
+                                                      TEMPLATE_KLV,
+                                                      index,
+                                                      (void *)cmdBld_ConfigSeq,
+                                                      hCmdBld);
+        if (TI_OK != status)
+        {
+            return status;
+        }
+    }
+
+    return status;
+}
+
+
+static TI_STATUS __cmd_keep_alive_params(TI_HANDLE hCmdBld)
+{
+    TI_UINT32   index;
+    TI_STATUS   status;
+
+    /* config gloabl enable / disable flag */
+    cmdBld_CfgKeepAliveEnaDis (hCmdBld, DB_KLV(hCmdBld).enaDisFlag, NULL, NULL);
+
+    /* 
+     * config per-template params 
+     * fisr configure all indexes but the last one with no CB, and than configure the last one 
+     * with a CB to continue configuration.
+     */
+    for (index = 0; index < KLV_MAX_TMPL_NUM - 1; index++)
+    {
+        if (DB_WLAN(hCmdBld).bJoin && DB_KLV(hCmdBld).keepAliveParams[ index ].enaDisFlag != 0)
+        {
+            status =  cmdBld_CmdIeConfigureKeepAliveParams (hCmdBld, 
+                                                            index,
+                                                            DB_KLV(hCmdBld).keepAliveParams[ index ].enaDisFlag,
+                                                            DB_KLV(hCmdBld).keepAliveParams[ index ].trigType,
+                                                            DB_KLV(hCmdBld).keepAliveParams[ index ].interval,
+                                                            NULL,
+                                                            NULL);
+            if (TI_OK != status)
+            {
+                return status;
+            }
+        }
+    }
+
+    /* Set NOK for a case the following config is skipped, to indicate that no callback is expected */
+    status = TI_NOK;
+
+    if (DB_WLAN(hCmdBld).bJoin && DB_KLV(hCmdBld).keepAliveParams[ index ].enaDisFlag != 0)
+    {
+        status =  cmdBld_CmdIeConfigureKeepAliveParams (hCmdBld, 
+                                                        index,
+                                                        DB_KLV(hCmdBld).keepAliveParams[ index ].enaDisFlag,
+                                                        DB_KLV(hCmdBld).keepAliveParams[ index ].trigType,
+                                                        DB_KLV(hCmdBld).keepAliveParams[ index ].interval,
+                                                        (void *)cmdBld_ConfigSeq,
+                                                        hCmdBld);
+        if (TI_OK != status)
+        {
+            return status;
+        }
+    }
+
+    return status;
+}
+
+static TI_STATUS __cmd_power_auth (TI_HANDLE hCmdBld)
+{
+	return cmdBld_CfgIeSleepAuth (hCmdBld, 
+							  DB_WLAN(hCmdBld).minPowerLevel, 
+							  (void *)cmdBld_ConfigSeq, 
+							  hCmdBld);
+}
+
+static TI_STATUS __cmd_start_join (TI_HANDLE hCmdBld)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    if (DB_WLAN(hCmdBld).bJoin)
+    {
+        /* 
+         * Replace the Join-Complete event CB by a local function.
+         * Thus, the reconfig sequence will not continue until the Join is completed!
+         * The original CB is restored after Join-Complete.
+         */
+        eventMbox_ReplaceEvent (pCmdBld->hEventMbox, 
+                                  TWD_OWN_EVENT_JOIN_CMPLT, 
+                                  (void *)cmdBld_JoinCmpltForReconfigCb, 
+                                  hCmdBld,                                   
+                                  &pCmdBld->fJoinCmpltOriginalCbFunc, 
+                                  &pCmdBld->hJoinCmpltOriginalCbHndl);                                    
+        /*
+         * Call the hardware to start/join the bss 
+         */
+        return cmdBld_CmdStartJoin (hCmdBld, 
+                                    DB_BSS(hCmdBld).ReqBssType, 
+                                    (void *)cmdBld_DummyCb, 
+                                    hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+static TI_STATUS __cmd_sta_state (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bStaConnected)
+    {
+        return cmdBld_CmdSetStaState (hCmdBld, 
+                                    STA_STATE_CONNECTED, 
+                                    (void *)cmdBld_ConfigSeq, 
+                                    hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+static TI_STATUS __cfg_aid (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin)
+    {
+        return cmdBld_CfgAid (hCmdBld, DB_WLAN(hCmdBld).Aid, (void *)cmdBld_ConfigSeq, hCmdBld);
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cfg_slot_time_join (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin)
+    {
+        /* Slot time must be setting after doing join */
+        return cmdBld_CfgSlotTime (hCmdBld, (ESlotTime)(DB_WLAN(hCmdBld).SlotTime), (void *)cmdBld_ConfigSeq, hCmdBld);              
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cfg_preamble_join (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin)
+    {
+        /* Preamble type must be set after doing join */
+        return cmdBld_CfgPreamble (hCmdBld, DB_WLAN(hCmdBld).preamble, (void *)cmdBld_ConfigSeq, hCmdBld);              
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cfg_ht_capabilities (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin && DB_BSS(hCmdBld).bHtCap)
+    {
+        /* HT capabilities must be set after doing join */
+        return cmdBld_CfgIeSetFwHtCapabilities (hCmdBld, 
+                                                DB_BSS(hCmdBld).uHtCapabilites, 
+                                                DB_BSS(hCmdBld).tMacAddress,
+                                                DB_BSS(hCmdBld).uAmpduMaxLeng,
+                                                DB_BSS(hCmdBld).uAmpduMinSpac,
+                                                (void *)cmdBld_ConfigSeq, 
+                                                hCmdBld);              
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cfg_ht_information (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin && DB_BSS(hCmdBld).bHtInf)
+    {
+        /* HT Information must be set after doing join */
+        return cmdBld_CfgIeSetFwHtInformation (hCmdBld, 
+                                               DB_BSS(hCmdBld).uRifsMode,
+                                               DB_BSS(hCmdBld).uHtProtection,
+                                               DB_BSS(hCmdBld).uGfProtection,
+                                               DB_BSS(hCmdBld).uHtTxBurstLimit,
+                                               DB_BSS(hCmdBld).uDualCtsProtection,
+                                               (void *)cmdBld_ConfigSeq, 
+                                               hCmdBld);              
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cfg_ba_set_session (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin)
+    {
+        TI_UINT32 uTid;
+
+        for (uTid = 0; uTid < MAX_NUM_OF_802_1d_TAGS; ++uTid)
+        {
+            /* set BA initiator */
+            if (DB_BSS(hCmdBld).bBaInitiator[uTid])
+            {
+                return cmdBld_CfgIeSetBaSession (hCmdBld, 
+                                                 ACX_BA_SESSION_INITIATOR_POLICY,
+                                                 uTid,               
+                                                 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uPolicy,             
+                                                 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].aMacAddress,                
+                                                 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uWinSize,          
+                                                 DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uInactivityTimeout,
+                                                 (void *)cmdBld_ConfigSeq, 
+                                                 hCmdBld);              
+            }
+
+            /* set BA Responder */
+            if (DB_BSS(hCmdBld).bBaResponder[uTid])
+            {
+                return cmdBld_CfgIeSetBaSession (hCmdBld, 
+                                                 ACX_BA_SESSION_RESPONDER_POLICY,
+                                                 uTid,               
+                                                 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uPolicy,             
+                                                 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].aMacAddress,                
+                                                 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uWinSize,          
+                                                 DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uInactivityTimeout,
+                                                 (void *)cmdBld_ConfigSeq, 
+                                                 hCmdBld);              
+            }
+        }
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cfg_tx_power_join (TI_HANDLE hCmdBld)
+{
+    if (DB_WLAN(hCmdBld).bJoin)
+    {
+        /* Tx-power must be set after doing join */
+        return cmdBld_CfgTxPowerDbm (hCmdBld, DB_WLAN(hCmdBld).TxPowerDbm, (void *)cmdBld_ConfigSeq, hCmdBld);              
+    }
+
+    return TI_NOK;
+}
+
+
+static TI_STATUS __cfg_keys (TI_HANDLE hCmdBld)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT32  index;
+
+    if (!DB_WLAN(hCmdBld).bJoin)
+    {
+        return TI_NOK;
+    }
+
+    if (pCmdBld->tSecurity.eSecurityMode != TWD_CIPHER_NONE)
+    {
+        /* 
+         * We are doing recovery during security so increase security-sequence-number by 255 just to ensure 
+         *   the AP will see progress from last Tx before the recovery (actually needed only for TKIP and AES).
+         * Decrementing the low byte by one is handled like it wrpped around, i.e. increment total number by 255.
+         */
+        cmdBld_SetSecuritySeqNum (hCmdBld, (TI_UINT8)(pCmdBld->uSecuritySeqNumLow - 1));
+
+
+        /* set the keys to the HW*/
+        for (index = 0; 
+             index < pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS; 
+             index++)
+        {
+            if ((DB_KEYS(pCmdBld).pReconfKeys + index)->keyType != KEY_NULL)
+            {
+                if (cmdBld_CmdAddKey (hCmdBld, DB_KEYS(pCmdBld).pReconfKeys + index, TI_TRUE, NULL, NULL) != TI_OK)
+                {
+                    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "__cfg_keys: ERROR cmdBld_CmdAddKey failure index=%d\n", index);
+                    return TI_NOK;
+                }   
+            }
+        }
+    
+        if (DB_KEYS(pCmdBld).bDefaultKeyIdValid)
+        {
+            /* Set the deafult key ID to the HW*/
+            if (cmdBld_CmdSetWepDefaultKeyId (hCmdBld, DB_KEYS(pCmdBld).uReconfDefaultKeyId, NULL, NULL) != TI_OK)
+            {
+                TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "__cfg_keys: ERROR cmdBld_CmdSetWepDefaultKeyId failure\n");
+                return TI_NOK;
+            }   
+        }
+    }
+
+    /* Set the encryption/decryption control on the HW */   
+    if (cmdBld_CfgHwEncDecEnable (hCmdBld, 
+                                  DB_KEYS(pCmdBld).bReconfHwEncEnable, 
+                                  (void *)cmdBld_ConfigSeq, 
+                                  hCmdBld) != TI_OK)
+    {
+        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "__cfg_keys: ERROR cmdBld_CfgHwEncDecEnable failure \n");
+        return TI_NOK;
+    }   
+    
+    return TI_OK;
+}
+
+static TI_STATUS __cfg_sg_enable (TI_HANDLE hCmdBld)
+{    
+    /* Set the Soft Gemini state */
+    return cmdBld_CfgSgEnable (hCmdBld, 
+                               DB_WLAN(hCmdBld).SoftGeminiEnable,
+                               (void *)cmdBld_ConfigSeq, 
+                               hCmdBld);
+}
+
+
+static TI_STATUS __cfg_sg (TI_HANDLE hCmdBld)
+{    
+    /* Set the Soft Gemini params */
+
+   /* signals the FW to config all the paramters from the DB*/
+    DB_WLAN(hCmdBld).SoftGeminiParams.paramIdx = 0xFF;
+
+   return cmdBld_CfgSg (hCmdBld, 
+                         &DB_WLAN(hCmdBld).SoftGeminiParams, 
+                         (void *)cmdBld_ConfigSeq, 
+                               hCmdBld);
+}
+
+
+static TI_STATUS __cfg_fm_coex (TI_HANDLE hCmdBld)
+{    
+    /* Set the FM Coexistence params */
+    return cmdBld_CfgIeFmCoex (hCmdBld, 
+                               &DB_WLAN(hCmdBld).tFmCoexParams, 
+                               (void *)cmdBld_ConfigSeq, 
+                               hCmdBld);
+}
+
+
+static TI_STATUS __cfg_rate_management (TI_HANDLE hCmdBld)
+{
+	DB_RM(hCmdBld).rateMngParams.paramIndex = 0xFF;
+
+	return cmdBld_CfgIeRateMngDbg(hCmdBld,
+						   &DB_RM(hCmdBld).rateMngParams,
+						   (void *)cmdBld_ConfigSeq,
+						   hCmdBld);
+						   
+}
+
+
+TI_STATUS __itr_memory_map (TI_HANDLE hCmdBld)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+
+    WLAN_OS_REPORT(("Interrogate TX/RX parameters\n"));
+
+    /* Interrogate TX/RX parameters */
+    return cmdBld_ItrIeMemoryMap (hCmdBld, 
+                                  &pCmdBld->tMemMap, 
+                                  (void *)cmdBld_ConfigFwCb, 
+                                  hCmdBld);
+}
+
+
+static const TCmdCfgFunc aCmdIniSeq [] =
+{
+    __cfg_platform_params,
+    __cfg_radio_params,
+    __cmd_probe_req,
+    __cmd_null_data,
+    __cmd_disconn,
+    __cmd_ps_poll,
+    __cmd_qos_null_data,
+    __cmd_probe_resp,
+    __cmd_beacon,
+    __cmd_keep_alive_tmpl,
+    __cfg_mem,
+    __cfg_rx_msdu_life_time,
+    __cfg_rx,
+    __cfg_ac_params_0,
+    __cfg_tid_0,
+    __cfg_ac_params_1,
+    __cfg_tid_1,
+    __cfg_ac_params_2,
+    __cfg_tid_2,
+    __cfg_ac_params_3,
+    __cfg_tid_3,
+    __cfg_pd_threshold,
+    __cfg_slot_time,
+    __cfg_arp_ip_filter,
+    __cfg_group_address_table,
+    __cfg_service_period_timeout,
+    __cfg_rts_threshold,
+    __cfg_dco_itrim_params,
+    __cfg_fragment_threshold,
+    __cfg_pm_config,
+    __cfg_beacon_filter_opt,
+    __cfg_beacon_filter_table,
+    __cfg_tx_cmplt_pacing,
+    __cfg_rx_intr_pacing,
+    __cfg_sg,
+    __cfg_sg_enable,
+    __cfg_fm_coex,
+    __cfg_cca_threshold,
+    __cfg_bcn_brc_options,
+    __cmd_enable_rx,
+    __cmd_enable_tx,
+    __cfg_ps_wmm,
+    __cfg_event_scan_cmplt,
+    __cfg_event_sps_scan_cmplt,
+    __cfg_event_plt_rx_calibration_cmplt,
+    __cfg_hw_enc_dec_enable,
+    __cfg_rssi_snr_weights,
+    __cfg_rssi_snr_trigger_0,
+    __cfg_rssi_snr_trigger_1,
+    __cfg_rssi_snr_trigger_2,
+    __cfg_rssi_snr_trigger_3,
+    __cfg_rssi_snr_trigger_4,
+    __cfg_rssi_snr_trigger_5,
+    __cfg_rssi_snr_trigger_6,
+    __cfg_rssi_snr_trigger_7,
+    __cfg_max_tx_retry,
+    __cfg_split_scan_timeout,
+
+    /* Re-join sequence */ 
+    __cfg_tx_rate_policy,
+    __cmd_beacon_join,
+    __cmd_probe_resp_join,
+    __cmd_probe_req_join,
+    __cmd_null_data_join,
+    __cmd_disconn_join,
+    __cmd_ps_poll_join,
+    __cmd_keep_alive_tmpl_join,
+    __cfg_slot_time_join,
+    __cfg_preamble_join,
+    __cfg_ht_capabilities,
+    __cfg_ht_information,
+    __cmd_start_join,
+    __cfg_aid,
+    __cfg_ba_set_session,
+    __cfg_tx_power_join,
+    __cfg_keys,
+    __cmd_keep_alive_params,
+    __cfg_conn_monit_params,
+    __cfg_bet,
+    __cfg_cts_protection,
+    __cfg_ps_rx_streaming,
+    __cfg_rx_data_filter,
+    __cmd_sta_state,
+    __cmd_power_auth,
+    __cmd_burst_mode_enable,
+    //__cmd_smart_reflex_state,    
+    //__cmd_smart_reflex_debug,
+    __cfg_rate_management,
+    /* Interrogate command -> must be last!! */
+    __itr_memory_map,
+
+    NULL
+};
+
+
+/****************************************************************************
+ *                      cmdBld_ConfigSeq()
+ ****************************************************************************
+ * DESCRIPTION: Configuration sequence engine
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT: None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ConfigSeq (TI_HANDLE hCmdBld)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+
+    do 
+    {
+        if (aCmdIniSeq [pCmdBld->uIniSeq++] == NULL)
+        {
+            return TI_NOK; 
+        }
+    } 
+    while ((*aCmdIniSeq [pCmdBld->uIniSeq - 1])(hCmdBld) != TI_OK);
+
+    return TI_OK;
+}
+
+/****************************************************************************
+ *                      cmdBld_FinalizeDownload()
+ ****************************************************************************
+ * DESCRIPTION: Finalize all the remaining initialization after the download has finished 
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: void
+ ****************************************************************************/
+void cmdBld_FinalizeDownload (TI_HANDLE hCmdBld, TBootAttr *pBootAttr, FwStaticData_t *pFwInfo)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8    *pMacAddr = pFwInfo->dot11StationID;
+    TI_UINT32    i;
+    TI_UINT8     uTmp;
+
+    /* Save FW version */
+    os_memoryCopy (pCmdBld->hOs, 
+                   (void *)DB_HW(hCmdBld).fwVer, 
+                   (void *)pFwInfo->FWVersion, 
+                   sizeof(DB_HW(hCmdBld).fwVer));
+
+    /* Save MAC adress (correct the bytes order first) */
+    for (i = 0; i < 3; i++)
+    {
+        uTmp = pMacAddr[i];
+        pMacAddr[i] = pMacAddr[5 - i]; 
+        pMacAddr[5 - i] = uTmp; 
+    }
+    MAC_COPY (DB_HW(hCmdBld).macAddress, pMacAddr);
+
+    /* Save chip ID */
+    os_memoryCopy (pCmdBld->hOs, 
+                   (void *)&(DB_HW(hCmdBld).uHardWareVersion), 
+                   (void *)&(pFwInfo->HardWareVersion), 
+                   sizeof(DB_HW(hCmdBld).uHardWareVersion));
+
+    /* Save power-levels table */
+    os_memoryCopy (pCmdBld->hOs, 
+                   (void *)DB_HW(hCmdBld).txPowerTable, 
+                   (void *)pFwInfo->txPowerTable, 
+                   sizeof(DB_HW(hCmdBld).txPowerTable));
+
+    /* Call the upper layer callback */
+    (*((TFinalizeCb)pCmdBld->fFinalizeDownload)) (pCmdBld->hFinalizeDownload);
+}
+
+
+TI_STATUS cmdBld_GetParam (TI_HANDLE hCmdBld, TTwdParamInfo *pParamInfo)
+{
+    TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams   *pWlanParams = &DB_WLAN(hCmdBld);
+
+    switch (pParamInfo->paramType)
+    {
+        case TWD_RTS_THRESHOLD_PARAM_ID:
+            pParamInfo->content.halCtrlRtsThreshold = pWlanParams->RtsThreshold;
+            break;
+        
+        case TWD_FRAG_THRESHOLD_PARAM_ID:
+            pParamInfo->content.halCtrlFragThreshold = pWlanParams->FragmentThreshold;
+            break;
+
+        case TWD_COUNTERS_PARAM_ID:
+            /* Constant zero because the ACX last buffer next pointer is always pointed
+               to itself, so it's like an endless buffer*/
+            pParamInfo->content.halCtrlCounters.RecvNoBuffer = 0;
+            pParamInfo->content.halCtrlCounters.FragmentsRecv = 0; /* not supported;*/
+            pParamInfo->content.halCtrlCounters.FrameDuplicates = 0;/* not supported*/
+            pParamInfo->content.halCtrlCounters.FcsErrors = DB_CNT(hCmdBld).FcsErrCnt;
+            pParamInfo->content.halCtrlCounters.RecvError = DB_CNT(hCmdBld).FcsErrCnt;
+            break;
+        
+        case TWD_LISTEN_INTERVAL_PARAM_ID:
+            pParamInfo->content.halCtrlListenInterval = pWlanParams->ListenInterval;
+            break;
+                            
+        case TWD_RSN_DEFAULT_KEY_ID_PARAM_ID:
+            /* Not implemented */
+            return TI_NOK;
+
+        case TWD_RSN_SECURITY_MODE_PARAM_ID:
+             pParamInfo->content.rsnEncryptionStatus = pCmdBld->tSecurity.eSecurityMode;
+            break;
+
+      case TWD_ACX_STATISTICS_PARAM_ID:
+            /* Not implemented */
+         #if 0
+            {
+                acxStatisitcs_t     acxStatisitics;
+                pParamInfo->content.acxStatisitics.FWpacketReceived = acxStatisitics.FWpacketReceived;
+                /* Not supported */
+                pParamInfo->content.acxStatisitics.HALpacketReceived = 0; 
+            }
+         #endif
+            return TI_NOK;
+
+    case TWD_MEDIUM_OCCUPANCY_PARAM_ID:
+        if (cmdBld_ItrIeMediumOccupancy (hCmdBld, pParamInfo->content.interogateCmdCBParams) != TI_OK)
+            return TI_NOK;
+            break;
+
+    case TWD_TSF_DTIM_MIB_PARAM_ID:
+        if (cmdBld_ItrIeTfsDtim (hCmdBld, pParamInfo->content.interogateCmdCBParams) != TI_OK)
+            return TI_NOK;
+        break;
+
+    case TWD_AID_PARAM_ID:
+        if (cmdBld_GetCurrentAssociationId (hCmdBld, &pParamInfo->content.halCtrlAid) != TI_OK)
+            return TI_NOK;
+
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , " AID 2 %d\n", pParamInfo->content.halCtrlAid);
+        break;
+
+    case TWD_NOISE_HISTOGRAM_PARAM_ID:
+        if (cmdBld_ItrIeNoiseHistogramResults (hCmdBld, pParamInfo->content.interogateCmdCBParams) != TI_OK)
+        {
+            return TI_NOK;
+        }
+        break;
+
+    case TWD_CURRENT_CHANNEL_PARAM_ID:
+        /* Get current channel number */
+        pParamInfo->content.halCtrlCurrentChannel = DB_BSS(hCmdBld).RadioChannel;
+        break;
+
+    /* SNR and RSSI belongs to the same MIB, and the relevant CB is passed here*/
+    case TWD_RSSI_LEVEL_PARAM_ID:
+    case TWD_SNR_RATIO_PARAM_ID:
+        /* Retrive the Callback function and read buffer pointer that are in fact stored in the TIWLAN_ADAPTER and then send it to the Command Mailbox */
+        cmdBld_ItrRSSI (hCmdBld, 
+                        pParamInfo->content.interogateCmdCBParams.fCb, 
+                        pParamInfo->content.interogateCmdCBParams.hCb, 
+                        pParamInfo->content.interogateCmdCBParams.pCb);
+        break;
+
+    case TWD_BCN_BRC_OPTIONS_PARAM_ID:
+        pParamInfo->content.BcnBrcOptions.BeaconRxTimeout    = pWlanParams->BcnBrcOptions.BeaconRxTimeout;
+        pParamInfo->content.BcnBrcOptions.BroadcastRxTimeout = pWlanParams->BcnBrcOptions.BroadcastRxTimeout;
+        pParamInfo->content.BcnBrcOptions.RxBroadcastInPs    = pWlanParams->BcnBrcOptions.RxBroadcastInPs;
+        break;
+
+    case TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID:
+        pParamInfo->content.halCtrlMaxRxMsduLifetime = pWlanParams->MaxRxMsduLifetime;
+        break;
+
+    case TWD_TX_RATE_CLASS_PARAM_ID:
+        pParamInfo->content.pTxRatePlicy = &DB_BSS(hCmdBld).TxRateClassParams;
+        break;
+
+    case TWD_SG_CONFIG_PARAM_ID:
+        return cmdBld_ItrSg (hCmdBld,
+                             pParamInfo->content.interogateCmdCBParams.fCb, 
+                             pParamInfo->content.interogateCmdCBParams.hCb,
+                             (void*)pParamInfo->content.interogateCmdCBParams.pCb);
+
+    case TWD_TX_POWER_PARAM_ID:
+        pParamInfo->content.halCtrlTxPowerDbm = DB_WLAN(hCmdBld).TxPowerDbm;        
+        break;
+
+	case TWD_RADIO_TEST_PARAM_ID:
+        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Radio Test\n");
+		return cmdBld_CmdTest (hCmdBld,                                       
+							   pParamInfo->content.interogateCmdCBParams.fCb, 
+							   pParamInfo->content.interogateCmdCBParams.hCb,
+							   (TTestCmd*)pParamInfo->content.interogateCmdCBParams.pCb);
+
+    case TWD_DCO_ITRIM_PARAMS_ID:
+        pParamInfo->content.tDcoItrimParams.enable = pWlanParams->dcoItrimEnabled;
+        pParamInfo->content.tDcoItrimParams.moderationTimeoutUsec = pWlanParams->dcoItrimModerationTimeoutUsec;
+        break;
+
+	default:
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_GetParam - ERROR - Param is not supported, %d\n\n", pParamInfo->paramType);
+        return (PARAM_NOT_SUPPORTED);
+    }
+
+    return TI_OK;
+}
+
+
+static TI_STATUS cmdBld_ReadMibBeaconFilterIETable (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb)
+{
+    TCmdBld	*pCmdBld 				= (TCmdBld *)hCmdBld;
+    TMib *pMib 						= (TMib*)pCb;
+    TCmdQueueInterrogateCb RetFunc 	= (TCmdQueueInterrogateCb)fCb;
+    TI_UINT8 IETableSize 			= 0;
+
+    /*Get params*/
+    pMib->aData.BeaconFilter.iNumberOfIEs = DB_WLAN(hCmdBld).beaconFilterIETable.numberOfIEs;
+    IETableSize = DB_WLAN(hCmdBld).beaconFilterIETable.IETableSize;
+                  
+    os_memoryZero (pCmdBld->hOs, 
+                   pMib->aData.BeaconFilter.iIETable,
+                   sizeof(pMib->aData.BeaconFilter.iIETable));
+
+    os_memoryCopy (pCmdBld->hOs, 
+                   pMib->aData.BeaconFilter.iIETable,
+                   DB_WLAN(hCmdBld).beaconFilterIETable.IETable,
+                   IETableSize);
+
+    pMib->Length = IETableSize + 1;     
+
+    RetFunc(hCb, TI_OK, pCb); 
+
+    return TI_OK;
+}
+
+/**
+ * \author \n
+ * \date \n
+ * \brief Coordinates between legacy TxRatePolicy implementation and the MIB format: \n
+ *        Converts the pGwsi_txRatePolicy back to whal commands 
+ *        Activates the whal whalCtrl_set function 
+ * Function Scope \e Public.\n
+ * \param  - \n
+ * \return \n
+ */
+static TI_STATUS cmdBld_ReadMibTxRatePolicy (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb)
+{
+    TMib* pMib = (TMib*)pCb;
+    TCmdQueueInterrogateCb RetFunc = (TCmdQueueInterrogateCb)fCb;
+    TTwdParamInfo param;
+    TI_STATUS status = TI_OK;
+
+    param.paramType = TWD_TX_RATE_CLASS_PARAM_ID;
+    cmdBld_GetParam (hCmdBld, &param);
+    if (param.content.pTxRatePlicy == NULL)
+        return TI_NOK;
+
+    /*Copy the data form the param to the MIB*/
+    pMib->aData.txRatePolicy = *param.content.pTxRatePlicy;
+    pMib->Length = pMib->aData.txRatePolicy.numOfRateClasses * sizeof(pMib->aData.txRatePolicy.rateClass[0]) + 
+                   sizeof(pMib->aData.txRatePolicy.numOfRateClasses);
+    RetFunc (hCb, status, pCb);
+    return status;
+}
+
+
+TI_STATUS cmdBld_ReadMib (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb)
+{
+    TCmdBld     *pCmdBld = (TCmdBld *)hCmdBld;
+    TMib    *pMibBuf = (TMib*)pCb;
+    TCmdQueueInterrogateCb RetFunc = (TCmdQueueInterrogateCb)fCb;
+    TI_STATUS Status = TI_OK;
+    
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ReadMib :pMibBuf %p:\n",pMibBuf);
+    
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ReadMib :aMib %x:\n", pMibBuf->aMib);
+    
+    switch (pMibBuf->aMib)
+    {
+    case MIB_dot11MaxReceiveLifetime:
+        {
+            TTwdParamInfo ParamInfo; 
+            ParamInfo.paramType = TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID;
+            ParamInfo.paramLength = sizeof(ParamInfo.content.halCtrlMaxRxMsduLifetime);
+            Status = cmdBld_GetParam (hCmdBld, &ParamInfo);
+            pMibBuf->aData.MaxReceiveLifeTime = ParamInfo.content.halCtrlMaxRxMsduLifetime / 1024; /* converting from usecs to TUs*/
+            pMibBuf->Length = sizeof(pMibBuf->aData.MaxReceiveLifeTime);
+        }
+        break;
+        
+    case MIB_dot11GroupAddressesTable:
+        {
+            Status = cmdBld_GetGroupAddressTable (hCmdBld,
+                                                  &pMibBuf->aData.GroupAddressTable.bFilteringEnable,
+                                                  &pMibBuf->aData.GroupAddressTable.nNumberOfAddresses,
+                                                  pMibBuf->aData.GroupAddressTable.aGroupTable);
+            
+            pMibBuf->Length = sizeof(pMibBuf->aData.GroupAddressTable.bFilteringEnable) + 
+                              sizeof(pMibBuf->aData.GroupAddressTable.nNumberOfAddresses) +
+                              pMibBuf->aData.GroupAddressTable.nNumberOfAddresses * sizeof(TMacAddr);
+        }
+        break;
+        
+    case MIB_ctsToSelf:
+        {
+            TTwdParamInfo ParamInfo;          
+            ParamInfo.paramType = TWD_CTS_TO_SELF_PARAM_ID;
+            ParamInfo.paramLength = sizeof(ParamInfo.content.halCtrlCtsToSelf);
+            Status = cmdBld_GetParam (hCmdBld, &ParamInfo);
+            pMibBuf->aData.CTSToSelfEnable = ParamInfo.content.halCtrlCtsToSelf;
+            pMibBuf->Length = sizeof(pMibBuf->aData.CTSToSelfEnable);
+        }
+        break;
+        
+    case MIB_arpIpAddressesTable:
+        {
+            TIpAddr   IpAddress;  
+            EIpVer    IPver;
+            TI_UINT8  Enable;
+            
+            pMibBuf->Length = sizeof(TMibArpIpAddressesTable);
+            Status = cmdBld_GetArpIpAddressesTable (hCmdBld, &IpAddress, &Enable, &IPver);
+            if (Status == TI_OK)
+            {
+                pMibBuf->aData.ArpIpAddressesTable.FilteringEnable = Enable;         
+
+                if (IP_VER_4 == IPver) /* IP_VER_4 only */
+                {
+                    IP_COPY (pMibBuf->aData.ArpIpAddressesTable.addr, IpAddress);
+                }
+                else
+                {
+                    Status = TI_NOK;
+                }
+            }
+            return Status;
+        }
+        
+    case MIB_rxFilter:
+        {
+            TI_UINT32 RxConfigOption;
+            TI_UINT32 RxFilterOption;
+            
+            pMibBuf->Length = 1;
+            pMibBuf->aData.RxFilter = 0;
+
+            /* Get RX filter data */
+            Status = cmdBld_GetRxFilters (hCmdBld, &RxConfigOption, &RxFilterOption);
+            if (TI_OK == Status)
+            {
+                /*Translate to MIB bitmap*/
+                if ((RxConfigOption & RX_CFG_MAC) == RX_CFG_ENABLE_ANY_DEST_MAC)
+                    pMibBuf->aData.RxFilter |= MIB_RX_FILTER_PROMISCOUS_SET;
+                
+                if ((RxConfigOption & RX_CFG_BSSID) == RX_CFG_ENABLE_ONLY_MY_BSSID)
+                    pMibBuf->aData.RxFilter |= MIB_RX_FILTER_BSSID_SET;
+            }
+        }
+        break;
+
+    case MIB_beaconFilterIETable:
+        return cmdBld_ReadMibBeaconFilterIETable (hCmdBld, hCb, fCb, pCb);
+
+    case MIB_txRatePolicy:
+        return cmdBld_ReadMibTxRatePolicy (hCmdBld, hCb, fCb, pCb);
+
+    case MIB_countersTable:
+        return cmdBld_ItrErrorCnt (hCmdBld, fCb, hCb, pCb);
+
+    case MIB_statisticsTable:
+        return cmdBld_ItrRoamimgStatisitics (hCmdBld, fCb, hCb, pCb);
+
+    default:
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "TWD_ReadMib:MIB aMib 0x%x Not supported\n",pMibBuf->aMib);
+        return TI_NOK;
+    }
+
+    if(RetFunc)
+        RetFunc(hCb, Status, pCb);
+    
+    return TI_OK;
+}
+
+
+TI_STATUS cmdBld_GetGroupAddressTable (TI_HANDLE hCmdBld, TI_UINT8* pEnabled, TI_UINT8* pNumGroupAddrs, TMacAddr *pGroupAddr)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT32     i;
+
+    if (NULL == pEnabled || NULL == pNumGroupAddrs || NULL == pGroupAddr)
+    {
+        TRACE3(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_GetGroupAddressTable: pisEnabled=0x%p pnumGroupAddrs=0x%p  Group_addr=0x%p !!!\n", pEnabled, pNumGroupAddrs, pGroupAddr);
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    *pNumGroupAddrs = DB_WLAN(hCmdBld).numGroupAddrs;
+    *pEnabled = DB_WLAN(hCmdBld).isMacAddrFilteringnabled;
+
+    os_memoryZero (pCmdBld->hOs, pGroupAddr, sizeof(pGroupAddr));
+    for (i = 0; i < *pNumGroupAddrs; i++) 
+    {
+        os_memoryCopy (pCmdBld->hOs, 
+                       (void *)&((*pGroupAddr)[MAC_ADDR_LEN*i]), 
+                       &DB_WLAN(hCmdBld).aGroupAddr[i], 
+                       MAC_ADDR_LEN);
+    }
+
+    return TI_OK;
+}
+
+
+TI_STATUS cmdBld_GetRxFilters (TI_HANDLE hCmdBld, TI_UINT32* pRxConfigOption, TI_UINT32* pRxFilterOption)
+{
+    *pRxConfigOption = DB_WLAN(hCmdBld).RxConfigOption;
+    *pRxFilterOption = DB_WLAN(hCmdBld).RxFilterOption;
+
+    return TI_OK;
+}
+
+
+TFwInfo * cmdBld_GetFWInfo (TI_HANDLE hCmdBld)
+{
+    return &DB_HW(hCmdBld);
+}
+
+
+
+TI_STATUS cmdBld_SetRadioBand (TI_HANDLE hCmdBld, ERadioBand eRadioBand)
+{
+    DB_WLAN(hCmdBld).RadioBand = eRadioBand;       
+    
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CurrentAssociationIdGet()
+ ****************************************************************************
+ * DESCRIPTION: Get the current TX antenna 
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_GetCurrentAssociationId (TI_HANDLE hCmdBld, TI_UINT16 *pAidVal)
+{
+    *pAidVal = DB_WLAN(hCmdBld).Aid;
+
+    return TI_OK;
+}
+
+
+ /****************************************************************************
+ *                      cmdBld_GetArpIpAddressesTable()
+ ****************************************************************************
+ * DESCRIPTION: Sets the Group table according to the given configuration. 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_GetArpIpAddressesTable (TI_HANDLE hCmdBld, TIpAddr *pIp, TI_UINT8* pbEnabled, EIpVer *pIpVer)
+{
+    *pIpVer = (EIpVer)DB_WLAN(hCmdBld).arp_IP_ver;
+
+    IP_COPY (*pIp, DB_WLAN(hCmdBld).arp_IP_addr);
+
+    *pbEnabled = DB_WLAN(hCmdBld).isArpIpFilteringEnabled;
+
+    return TI_OK;
+}
+
+
+TI_STATUS cmdBld_ConvertAppRatesBitmap (TI_UINT32 uAppRatesBitmap, TI_UINT32 uAppModulation, EHwRateBitFiled *pHwRatesBitmap)
+{
+    EHwRateBitFiled uRatesBitmap = 0;
+   
+    if (uAppRatesBitmap & DRV_RATE_MASK_1_BARKER)    uRatesBitmap |= HW_BIT_RATE_1MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_2_BARKER)    uRatesBitmap |= HW_BIT_RATE_2MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_5_5_CCK)     uRatesBitmap |= HW_BIT_RATE_5_5MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_11_CCK)      uRatesBitmap |= HW_BIT_RATE_11MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_22_PBCC)     uRatesBitmap |= HW_BIT_RATE_22MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_6_OFDM)      uRatesBitmap |= HW_BIT_RATE_6MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_9_OFDM)      uRatesBitmap |= HW_BIT_RATE_9MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_12_OFDM)     uRatesBitmap |= HW_BIT_RATE_12MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_18_OFDM)     uRatesBitmap |= HW_BIT_RATE_18MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_24_OFDM)     uRatesBitmap |= HW_BIT_RATE_24MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_36_OFDM)     uRatesBitmap |= HW_BIT_RATE_36MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_48_OFDM)     uRatesBitmap |= HW_BIT_RATE_48MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_54_OFDM)     uRatesBitmap |= HW_BIT_RATE_54MBPS;
+    if (uAppRatesBitmap & DRV_RATE_MASK_MCS_0_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_0;
+    if (uAppRatesBitmap & DRV_RATE_MASK_MCS_1_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_1;
+    if (uAppRatesBitmap & DRV_RATE_MASK_MCS_2_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_2;
+    if (uAppRatesBitmap & DRV_RATE_MASK_MCS_3_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_3;
+    if (uAppRatesBitmap & DRV_RATE_MASK_MCS_4_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_4;
+    if (uAppRatesBitmap & DRV_RATE_MASK_MCS_5_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_5;
+    if (uAppRatesBitmap & DRV_RATE_MASK_MCS_6_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_6;
+    if (uAppRatesBitmap & DRV_RATE_MASK_MCS_7_OFDM)  uRatesBitmap |= HW_BIT_RATE_MCS_7;
+    
+    *pHwRatesBitmap = uRatesBitmap;
+
+    return TI_OK;
+}
+
+EHwRateBitFiled rateNumberToBitmap(TI_UINT8 uRate)
+{
+	switch(uRate)
+	{
+	case 1:   return HW_BIT_RATE_1MBPS;
+	case 2:   return HW_BIT_RATE_2MBPS;
+	case 5:   return HW_BIT_RATE_5_5MBPS;
+	case 6:   return HW_BIT_RATE_6MBPS; 
+	case 9:   return HW_BIT_RATE_9MBPS; 
+	case 11:  return HW_BIT_RATE_11MBPS;
+	case 12:  return HW_BIT_RATE_12MBPS;
+	case 18:  return HW_BIT_RATE_18MBPS;
+	case 22:  return HW_BIT_RATE_22MBPS;
+	case 24:  return HW_BIT_RATE_24MBPS;
+	case 36:  return HW_BIT_RATE_36MBPS;
+	case 48:  return HW_BIT_RATE_48MBPS;
+	case 54:  return HW_BIT_RATE_54MBPS;
+	default:
+		return 0;
+	}
+}
+
+TI_STATUS cmdBld_ConvertAppRate (ERate AppRate, TI_UINT8 *pHwRate)
+{
+    TI_UINT8     Rate = 0;
+    TI_STATUS status = TI_OK;
+
+    switch (AppRate)
+    {
+        /*
+         *  The handle for 5.5/11/22 PBCC was removed !!!
+         */
+
+        case DRV_RATE_1M:           Rate = txPolicy1;          break;
+        case DRV_RATE_2M:           Rate = txPolicy2;          break;
+        case DRV_RATE_5_5M:         Rate = txPolicy5_5;        break;
+        case DRV_RATE_11M:          Rate = txPolicy11;         break;
+        case DRV_RATE_22M:          Rate = txPolicy22;         break;
+        case DRV_RATE_6M:           Rate = txPolicy6;          break;
+        case DRV_RATE_9M:           Rate = txPolicy9;          break;
+        case DRV_RATE_12M:          Rate = txPolicy12;         break;
+        case DRV_RATE_18M:          Rate = txPolicy18;         break;
+        case DRV_RATE_24M:          Rate = txPolicy24;         break;
+        case DRV_RATE_36M:          Rate = txPolicy36;         break;
+        case DRV_RATE_48M:          Rate = txPolicy48;         break;
+        case DRV_RATE_54M:          Rate = txPolicy54;         break;
+        case DRV_RATE_MCS_0:          Rate = txPolicyMcs0;         break;
+        case DRV_RATE_MCS_1:          Rate = txPolicyMcs1;         break;
+        case DRV_RATE_MCS_2:          Rate = txPolicyMcs2;         break;
+        case DRV_RATE_MCS_3:          Rate = txPolicyMcs3;         break;
+        case DRV_RATE_MCS_4:          Rate = txPolicyMcs4;         break;
+        case DRV_RATE_MCS_5:          Rate = txPolicyMcs5;         break;
+        case DRV_RATE_MCS_6:          Rate = txPolicyMcs6;         break;
+        case DRV_RATE_MCS_7:          Rate = txPolicyMcs7;         break;
+
+        default:
+            WLAN_OS_REPORT(("%s wrong app rate = %d\n",__FUNCTION__,AppRate));
+            status = TI_NOK;
+            break;
+    }
+
+    if (status == TI_OK)
+        *pHwRate = Rate;
+    else
+        *pHwRate = txPolicy1; 
+
+    return status;
+}
+
+
+TI_STATUS cmdBld_SetRxFilter (TI_HANDLE hCmdBld, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption)
+{
+    DB_WLAN(hCmdBld).RxConfigOption = uRxConfigOption;
+    DB_WLAN(hCmdBld).RxFilterOption = uRxFilterOption;
+    DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_ENABLE_PHY_HEADER_PLCP;
+
+    if (DB_WLAN(hCmdBld).RxDisableBroadcast)
+    {
+        DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_DISABLE_BCAST;
+    }
+    
+    return TI_OK;
+}
+
+
+TI_UINT8 cmdBld_GetBssType (TI_HANDLE hCmdBld)
+{
+    return DB_BSS(hCmdBld).ReqBssType;
+}
+
+
+TI_UINT32 cmdBld_GetAckPolicy (TI_HANDLE hCmdBld, TI_UINT32 uQueueId)
+{
+    return (TI_UINT32)DB_QUEUES(hCmdBld).queues[uQueueId].ackPolicy;
+}
+
+
+TI_STATUS cmdBld_SetSecuritySeqNum (TI_HANDLE hCmdBld, TI_UINT8 securitySeqNumLsByte)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    /* If 8 lsb wrap around occurred (new < old). */
+    if ((TI_UINT16)securitySeqNumLsByte < (pCmdBld->uSecuritySeqNumLow & 0xFF))
+    {
+        /* Increment the upper byte of the 16 lsb. */       
+        pCmdBld->uSecuritySeqNumLow += 0x100;
+
+        /* If 16 bit wrap around occurred, increment the upper 32 bit. */
+        if (!(pCmdBld->uSecuritySeqNumLow & 0xFF00))
+            pCmdBld->uSecuritySeqNumHigh++;
+    }
+
+    /* Save new sequence number 8 lsb (received from the FW). */
+    pCmdBld->uSecuritySeqNumLow &= 0xFF00;
+    pCmdBld->uSecuritySeqNumLow |= (TI_UINT16)securitySeqNumLsByte;
+
+    return TI_OK;
+}
+
+/****************************************************************************
+ *                      cmdBld_JoinCmpltForReconfigCb()
+ ****************************************************************************
+ * DESCRIPTION:   The Join-Complete callback used by the reconfig sequenc (see __cmd_start_join()).
+ *                It restores the original Join-Complete CB and continues the sequence.
+ *                It is needed so the reconfig sequence won't progress before the Join
+ *                    command is completed (otherwise the FW may drop the other commands).
+ *
+ * INPUTS: hCmdBld - The module object 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK
+ ****************************************************************************/
+static TI_STATUS cmdBld_JoinCmpltForReconfigCb (TI_HANDLE hCmdBld)
+{
+    TCmdBld    *pCmdBld = (TCmdBld *)hCmdBld;
+    void       *fDummyCb;    
+    TI_HANDLE   hDummyHndl;  
+
+    /* Restored the original Join-Complete callback function */
+    eventMbox_ReplaceEvent (pCmdBld->hEventMbox, 
+                              TWD_OWN_EVENT_JOIN_CMPLT, 
+                              pCmdBld->fJoinCmpltOriginalCbFunc, 
+                              pCmdBld->hJoinCmpltOriginalCbHndl,
+                              &fDummyCb,
+                              &hDummyHndl);  
+
+    /* Call the reconfig sequence to continue the configuration after Join completion */
+    cmdBld_ConfigSeq (hCmdBld);
+
+    return TI_OK;
+}
+
+
+
+static TI_STATUS cmdBld_DummyCb (TI_HANDLE hCmdBld)
+{
+    return TI_OK;
+}
+
+
+
+
+
+#ifdef TI_DBG
+
+void cmdBld_DbgForceTemplatesRates (TI_HANDLE hCmdBld, TI_UINT32 uRateMask)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    pCmdBld->uDbgTemplatesRateMask = uRateMask; 
+}
+
+#endif /* TI_DBG */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBld.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,270 @@
+/*
+ * CmdBld.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 CMDBLD_H
+#define CMDBLD_H
+
+
+#include "TWDriver.h"
+#include "CmdBldDb.h"
+
+TI_HANDLE cmdBld_Create                 (TI_HANDLE hOs);
+TI_STATUS cmdBld_Destroy                (TI_HANDLE hCmdBld);
+TI_STATUS cmdBld_Restart               (TI_HANDLE hCmdBld);
+TI_STATUS cmdBld_Config                 (TI_HANDLE  hCmdBld, 
+                                         TI_HANDLE  hReport, 
+                                         void      *fFinalizeDownload, 
+                                         TI_HANDLE  hFinalizeDownload, 
+                                         TI_HANDLE  hEventMbox, 
+                                         TI_HANDLE  hCmdQueue,
+                                         TI_HANDLE  hTwIf);
+TI_STATUS cmdBld_ConfigFw               (TI_HANDLE hCmdBld, void *fConfigFwCb, TI_HANDLE hConfigFwCb);
+TI_STATUS cmdBld_CheckMboxCb            (TI_HANDLE hCmdBld, void *fFailureEvCb, TI_HANDLE hFailureEv);
+TI_STATUS cmdBld_GetParam               (TI_HANDLE hCmdBld, TTwdParamInfo *pParamInfo);
+TI_STATUS cmdBld_ReadMib                (TI_HANDLE hCmdBld, TI_HANDLE hCb, void* fCb, void* pCb);
+TI_STATUS cmdBld_ConvertAppRatesBitmap  (TI_UINT32 uAppRatesBitmap, TI_UINT32 uAppModulation, EHwRateBitFiled *pHwRatesBitmap);
+TI_STATUS cmdBld_ConvertAppRate (ERate AppRate, TI_UINT8 *pHwRate);
+EHwRateBitFiled rateNumberToBitmap(TI_UINT8 uRate);
+
+/* Commands */
+TI_STATUS cmdBld_CmdNoiseHistogram      (TI_HANDLE hCmdBld, TNoiseHistogram* pNoiseHistParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdMeasurement         (TI_HANDLE hCmdBld, TMeasurementParams *pMeasurementParams, void *fCommandResponseCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdMeasurementStop     (TI_HANDLE hCmdBld, void *fCommandResponseCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdApDiscovery         (TI_HANDLE hCmdBld, TApDiscoveryParams* pApDiscoveryParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdApDiscoveryStop     (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdStartScan           (TI_HANDLE hCmdBld, TScanParams *pScanVals, EScanResultTag eScanTag, TI_BOOL bHighPriority, void *fScanCommandResponseCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdStartSPSScan        (TI_HANDLE hCmdBld, TScanParams *pScanVals, EScanResultTag eScanTag, void *fScanCommandResponseCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdStopScan            (TI_HANDLE hCmdBld, EScanResultTag eScanTag, void *fScanCommandResponseCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdStopSPSScan         (TI_HANDLE hCmdBld, EScanResultTag eScanTag, void *fScanCommandResponseCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdSetSplitScanTimeOut (TI_HANDLE hCmdBld, TI_UINT32 uTimeOut);
+TI_STATUS cmdBld_StartPeriodicScan      (TI_HANDLE hCmdBld, TPeriodicScanParams *pPeriodicScanParams, EScanResultTag eScanTag, TI_UINT32 uPassiveScanDfsDwellTimeMs, void* fScanCommandResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_StopPeriodicScan       (TI_HANDLE hCmdBld, EScanResultTag eScanTag, void* fScanCommandResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdStartJoin           (TI_HANDLE hCmdBld, ScanBssType_e eBssType, void *fJoinCompleteCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdJoinBss             (TI_HANDLE hCmdBld, TJoinBss *pJoinBssParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdTemplate            (TI_HANDLE hCmdBld, TSetTemplate *pTemplateParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdSwitchChannel       (TI_HANDLE hCmdBld, TSwitchChannelParams *pSwitchChannelCmdvoid, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdSwitchChannelCancel (TI_HANDLE hCmdBld, TI_UINT8 channel, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdEnableTx            (TI_HANDLE hCmdBld, TI_UINT8 channel, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdDisableTx           (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdFwDisconnect        (TI_HANDLE hCmdBld, TI_UINT32 uConfigOptions, TI_UINT32 uFilterOptions, DisconnectType_e uDisconType, TI_UINT16 uDisconReason, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdHealthCheck         (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdSetPsMode           (TI_HANDLE hCmdBld, TPowerSaveParams* pPowerSaveParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdEnableRx            (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdAddWepDefaultKey    (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdRemoveWepDefaultKey (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdSetWepDefaultKeyId  (TI_HANDLE hCmdBld, TI_UINT8 aKeyIdVal, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdAddWpaKey           (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdRemoveWpaKey        (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdAddTkipMicMappingKey(TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdRemoveTkipMicMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdAddAesMappingKey    (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdRemoveAesMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+#ifdef GEM_SUPPORT
+    TI_STATUS cmdBld_CmdAddGemMappingKey    (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+    TI_STATUS cmdBld_CmdRemoveGemMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+#endif
+TI_STATUS cmdBld_CmdAddKey              (TI_HANDLE hCmdBld, TSecurityKeys* pKey, TI_BOOL bReconfFlag, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdRemoveKey           (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdConfigureTemplates  (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdSetStaState         (TI_HANDLE hCmdBld, TI_UINT8 staState, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdTest                (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TTestCmd* pTestCmd);
+
+
+/* Config */
+TI_STATUS cmdBld_CfgEventMask           (TI_HANDLE hCmdBld, TI_UINT32 uEventMask, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgConnMonitParams     (TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgMaxTxRetry          (TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgAid                 (TI_HANDLE hCmdBld, TI_UINT16 aid, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgSlotTime            (TI_HANDLE hCmdBld, ESlotTime eSlotTimeVal, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgArpIpAddrTable      (TI_HANDLE hCmdBld, TIpAddr tIpAddr, TI_BOOL bEnabled, EIpVer eIpVer, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgArpIpFilter         (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgRx                  (TI_HANDLE hCmdBld, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgPreamble            (TI_HANDLE hCmdBld, Preamble_e ePreamble, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgPacketDetectionThreshold (TI_HANDLE hCmdBld, TI_UINT32 threshold, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgBeaconFilterOpt     (TI_HANDLE hCmdBld, TI_UINT8 uBeaconFilteringStatus, TI_UINT8 uNumOfBeaconsToBuffer, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgBeaconFilterTable   (TI_HANDLE hCmdBld, TI_UINT8 uNumberOfIEs, TI_UINT8 *pIETable, TI_UINT8 uIeTableSize, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgWakeUpCondition     (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgBcnBrcOptions       (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgGroupAddressTable   (TI_HANDLE hCmdBld, TI_UINT8 numGroupAddrs, TMacAddr *pGroupAddr, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgSleepAuth           (TI_HANDLE hCmdBld, EPowerPolicy eMinPowerLevel, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgSgEnable            (TI_HANDLE hCmdBld, ESoftGeminiEnableModes eSgEnable, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgSg                  (TI_HANDLE hCmdBld, TSoftGeminiParams *pSgParam, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgTxRatePolicy        (TI_HANDLE hCmdBld, TTxRatePolicy *pTxRatePolicy, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgTid                 (TI_HANDLE hCmdBld, TQueueTrafficParams *pQtrafficParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgAcParams            (TI_HANDLE hCmdBld, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgPsRxStreaming       (TI_HANDLE hCmdBld, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgClkRun              (TI_HANDLE hCmdBld, TI_BOOL bClkRunEnable, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgHwEncEnable         (TI_HANDLE hCmdBld, TI_BOOL aHwEncEnable, TI_BOOL bHwDecEnable, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgHwEncDecEnable      (TI_HANDLE hCmdBld, TI_BOOL bHwEncEnable, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgRxMsduFormat        (TI_HANDLE hCmdBld, TI_BOOL bRxMsduForamtEnable, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgRtsThreshold        (TI_HANDLE hCmdBld, TI_UINT16 threshold, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgDcoItrimParams      (TI_HANDLE hCmdBld, TI_BOOL enable, TI_UINT32 moderationTimeoutUsec, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgFragmentThreshold   (TI_HANDLE hCmdBld, TI_UINT16 uFragmentThreshold, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgSecureMode          (TI_HANDLE hCmdBld, ECipherSuite eSecurMode, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgMacClock            (TI_HANDLE hCmdBld, TI_UINT32 uMacClock, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgArmClock            (TI_HANDLE hCmdBld, TI_UINT32 uArmClock, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgEnableRxDataFilter  (TI_HANDLE hCmdBld, TI_BOOL bEnabled, filter_e eDefaultAction, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgRxDataFilter        (TI_HANDLE hCmdBld, TI_UINT8 index, TI_UINT8 command, filter_e eAction, TI_UINT8 uNumFieldPatterns, TI_UINT8 uLenFieldPatterns, TI_UINT8 *pFieldPatterns, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgCtsProtection       (TI_HANDLE hCmdBld, TI_UINT8 uCtsProtection, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgServicePeriodTimeout(TI_HANDLE hCmdBld, TRxTimeOut *pRxTimeOut, void *fCb, TI_HANDLE hCb);                            
+TI_STATUS cmdBld_CfgRxMsduLifeTime      (TI_HANDLE hCmdBld, TI_UINT32 uRxMsduLifeTime, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgStatisitics         (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgTxPowerDbm          (TI_HANDLE hCmdBld, TI_UINT8 uTxPowerDbm, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgRssiSnrTrigger      (TI_HANDLE hCmdBld, RssiSnrTriggerCfg_t *pTriggerParam, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgRssiSnrWeights      (TI_HANDLE hCmdBld, RssiSnrAverageWeights_t *pWeightsParam, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgBet                 (TI_HANDLE hCmdBld, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgKeepAlive           (TI_HANDLE hCmdBld, TKeepAliveParams *pKeepAliveParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgKeepAliveEnaDis     (TI_HANDLE hCmdBld, TI_UINT8 enaDisFlag, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgSetBaSession        (TI_HANDLE hCmdBld, InfoElement_e eBaType, TI_UINT8 uTid, TI_UINT8 uState, TMacAddr tRa, TI_UINT16 uWinSize, TI_UINT16 uInactivityTimeout, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgSetFwHtCapabilities (TI_HANDLE hCmdBld, TI_UINT32 uHtCapabilites, TMacAddr tMacAddress, TI_UINT8 uAmpduMaxLeng, TI_UINT8 uAmpduMinSpac, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgSetFwHtInformation  (TI_HANDLE hCmdBld, TI_UINT8 uRifsMode,TI_UINT8 uHtProtection, TI_UINT8 uGfProtection, TI_UINT8 uHtTxBurstLimit, TI_UINT8 uDualCtsProtection, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgCoexActivity        (TI_HANDLE hCmdBld, TCoexActivity *pCoexActivity, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgBurstMode 			(TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgFmCoex              (TI_HANDLE hCmdBld, TFmCoexParams *pFmCoexParams, void *fCb, TI_HANDLE hCb);
+
+/* Interrogate */
+TI_STATUS cmdBld_ItrRSSI                    (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb);
+TI_STATUS cmdBld_ItrErrorCnt                (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb);
+TI_STATUS cmdBld_ItrRoamimgStatisitics      (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb);
+TI_STATUS cmdBld_ItrSg                      (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb);
+TI_STATUS cmdBld_ItrMemoryMap               (TI_HANDLE hCmdBld, MemoryMap_t *pMap, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_ItrStatistics              (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb);
+TI_STATUS cmdBld_ItrDataFilterStatistics    (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb);
+TI_STATUS cmdBld_ItrPowerConsumptionstat    (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void* pCb);
+TI_STATUS cmdBld_ItrRateParams              (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb);
+
+
+/* Get */
+TI_STATUS cmdBld_GetGroupAddressTable       (TI_HANDLE hCmdBld, TI_UINT8* pEnabled, TI_UINT8* pNumGroupAddrs, TMacAddr *pGroupAddr);
+TI_UINT8  cmdBld_GetDtimCount               (TI_HANDLE hCmdBld);
+TI_UINT16 cmdBld_GetBeaconInterval          (TI_HANDLE hCmdBld);
+TFwInfo * cmdBld_GetFWInfo                  (TI_HANDLE hCmdBld);
+TI_STATUS cmdBld_GetRxFilters               (TI_HANDLE hCmdBld, TI_UINT32 *pRxConfigOption, TI_UINT32 *pRxFilterOption);
+TI_UINT8  cmdBld_GetBssType                 (TI_HANDLE hCmdBld); 
+TI_UINT32 cmdBld_GetAckPolicy               (TI_HANDLE hCmdBld, TI_UINT32 uQueueId); 
+TI_STATUS cmdBld_GetPltRxCalibrationStatus  ( TI_HANDLE hCmdBld, TI_STATUS *pLastStatus );
+
+/* Set */
+TI_STATUS cmdBld_SetRadioBand           (TI_HANDLE hCmdBld, ERadioBand eRadioBand);
+TI_STATUS cmdBld_SetRxFilter            (TI_HANDLE hCmdBld, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption);
+TI_STATUS cmdBld_SetSecuritySeqNum      (TI_HANDLE hCmdBld, TI_UINT8 securitySeqNumLsByte);
+TI_STATUS cmdBld_CfgRateMngDbg 			(TI_HANDLE hCmdBld, RateMangeParams_t *pRateMngParams ,void *fCb, TI_HANDLE  hCb);
+#ifdef TI_DBG
+void cmdBld_DbgForceTemplatesRates (TI_HANDLE hCmdBld, TI_UINT32 uRateMask);
+#endif
+
+
+typedef struct
+{
+    TI_UINT32                  uNumOfStations;
+    ECipherSuite               eSecurityMode;
+    EKeyType                   eCurTxKeyType;  /* Key type of current configured unicast key */ 
+
+} TSecurity;
+
+
+typedef struct 
+{
+    TI_HANDLE                  hOs;
+    TI_HANDLE                  hReport;
+    TI_HANDLE                  hCmdQueue;
+    TI_HANDLE                  hEventMbox;
+    TI_HANDLE                  hTwIf;
+
+    TCmdBldDb                  tDb;
+    TSecurity                  tSecurity;
+    MemoryMap_t                tMemMap;
+    TI_UINT16                  uSecuritySeqNumLow;
+    TI_UINT32                  uSecuritySeqNumHigh;
+
+    void                       *fFinalizeDownload;
+    TI_HANDLE                  hFinalizeDownload;
+
+    void                       *fConfigFwCb;
+    TI_HANDLE                  hConfigFwCb;
+
+    void                       *fJoinCmpltOriginalCbFunc;
+    TI_HANDLE                  hJoinCmpltOriginalCbHndl;
+
+    TI_UINT32                  uIniSeq;         /* Init sequence counter */
+
+    TI_UINT32                  uLastElpCtrlMode;/* Init sleep mode */
+
+#ifdef TI_DBG
+    TI_UINT32                  uDbgTemplatesRateMask;
+#endif
+
+} TCmdBld;
+
+
+/* 
+ * Define the number of keys allocated on reconfigure 
+ * data structure for each station
+ */
+#define NO_OF_RECONF_SECUR_KEYS_PER_STATION     1 
+#define NO_OF_EXTRA_RECONF_SECUR_KEYS           3 
+
+
+#define DB_QUEUES(HCMDBLD) (((TCmdBld *)HCMDBLD)->tDb.queues)
+#define DB_AC(HCMDBLD)     (((TCmdBld *)HCMDBLD)->tDb.ac)
+#define DB_PS_STREAM(HCMDBLD) (((TCmdBld *)HCMDBLD)->tDb.psStream)
+#define DB_WLAN(HCMDBLD)   (((TCmdBld *)HCMDBLD)->tDb.wlan)
+#define DB_DMA(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.dma)
+#define DB_BSS(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.bss)
+#define DB_HW(HCMDBLD)     (((TCmdBld *)HCMDBLD)->tDb.hw)
+#define DB_CNT(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.counters)
+#define DB_TEMP(HCMDBLD)   (((TCmdBld *)HCMDBLD)->tDb.templateList)
+#define DB_KLV(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.klvList)
+#define DB_KEYS(HCMDBLD)            (((TCmdBld *)HCMDBLD)->tDb.keys)
+#define DB_RX_DATA_FLTR(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.rxDataFilters)
+#define DB_RADIO(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.tRadioIniParams)
+#define DB_GEN(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.tPlatformGenParams)
+#define DB_SR(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.tSmartReflex)
+#define DB_RM(HCMDBLD)    (((TCmdBld *)HCMDBLD)->tDb.tRateMngParams)
+
+
+
+#define DB_DEFAULT_CHANNEL(HCMDBLD)                     \
+    (RADIO_BAND_5_0_GHZ == DB_WLAN(HCMDBLD).RadioBand)  \
+        ? DB_WLAN(HCMDBLD).calibrationChannel5_0        \
+        : DB_WLAN(HCMDBLD).calibrationChannel2_4
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldCfg.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1362 @@
+/*
+ * CmdBldCfg.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdBldCfg.c 
+ *  \brief Command builder. Configuration commands
+ *
+ *  \see   CmdBld.h 
+ */
+#define __FILE_ID__  FILE_ID_91
+#include "osApi.h"
+#include "tidef.h"
+#include "report.h"
+#include "CmdBld.h"
+#include "CmdBldCfgIE.h"
+#include "TWDriverInternal.h"
+
+
+/****************************************************************************
+ *                      cmdBld_CfgRx()
+ ****************************************************************************
+ * DESCRIPTION: Sets the filters according to the given configuration. 
+ * 
+ * INPUTS:  RxConfigOption  - The given Rx filters configuration
+ *          RxFilterOption  - The given Rx filters options
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgRx (TI_HANDLE hCmdBld, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption, void *fCb, TI_HANDLE hCb)
+{
+    DB_WLAN(hCmdBld).RxConfigOption = uRxConfigOption;
+    DB_WLAN(hCmdBld).RxFilterOption = uRxFilterOption;
+    DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_ENABLE_PHY_HEADER_PLCP;
+  #if defined (TNETW_MASTER_MODE) || defined (TNETW_USB_MODE)
+    DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_COPY_RX_STATUS;
+  #endif    
+
+    if (DB_WLAN(hCmdBld).RxDisableBroadcast)
+    {
+        DB_WLAN(hCmdBld).RxConfigOption |= RX_CFG_DISABLE_BCAST;
+    }
+
+    return cmdBld_CfgIeRx (hCmdBld,
+                           DB_WLAN(hCmdBld).RxConfigOption,
+                           DB_WLAN(hCmdBld).RxFilterOption,
+                           fCb,
+                           hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgArpIpAddrTable()
+ ****************************************************************************
+ * DESCRIPTION: Sets the ARP IP table according to the given configuration. 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgArpIpAddrTable (TI_HANDLE hCmdBld, TIpAddr tIpAddr, TI_BOOL bEnabled, EIpVer eIpVer, void *fCb, TI_HANDLE hCb)
+{
+    DB_WLAN(hCmdBld).arp_IP_ver = eIpVer;
+
+    /* no support for IPV6 */
+    if (eIpVer == IP_VER_4) 
+    {
+        IP_COPY (DB_WLAN(hCmdBld).arp_IP_addr, tIpAddr);
+    }
+
+    DB_WLAN(hCmdBld).isArpIpFilteringEnabled = bEnabled;
+
+    /* Set the new ip with the current state (e/d) */
+    return cmdBld_CfgIeArpIpFilter (hCmdBld, tIpAddr, bEnabled, fCb, hCb);
+}
+
+ /****************************************************************************
+ *                      cmdBld_CfgArpIpFilter()
+ ****************************************************************************
+ * DESCRIPTION: Enable\Disable the ARP filter 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgArpIpFilter (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb) 
+{
+    /* Set the current ip address with the new state (e/d) */
+    DB_WLAN(hCmdBld).isArpIpFilteringEnabled = bEnabled;
+
+    return cmdBld_CfgIeArpIpFilter (hCmdBld, 
+                                    DB_WLAN(hCmdBld).arp_IP_addr, 
+                                    bEnabled, 
+                                    fCb, 
+                                    hCb);
+}
+/****************************************************************************
+ *                      cmdBld_CfgGroupAddressTable()
+ ****************************************************************************
+ * DESCRIPTION: Sets the Group table according to the given configuration. 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgGroupAddressTable (TI_HANDLE        hCmdBld,
+                                       TI_UINT8         uNumGroupAddr, 
+                                       TMacAddr         *pGroupAddr,
+                                       TI_BOOL          bEnabled, 
+                                       void             *fCb, 
+                                       TI_HANDLE        hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT32    i;
+
+    if (uNumGroupAddr > MAX_MULTICAST_GROUP_ADDRS) 
+    {
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgGroupAddressTable: numGroupAddrs=%d\n", uNumGroupAddr);
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    if (NULL == pGroupAddr)
+    {
+        TRACE2(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgGroupAddressTable: numGroupAddrs=%d Group_addr=0x%x  !!!\n", uNumGroupAddr, pGroupAddr);
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    /* Keeps the parameters in the db */
+    DB_WLAN(hCmdBld).numGroupAddrs = uNumGroupAddr;
+    DB_WLAN(hCmdBld).isMacAddrFilteringnabled = bEnabled;
+
+    for (i = 0; i < uNumGroupAddr; i++) 
+    {
+        MAC_COPY (DB_WLAN(hCmdBld).aGroupAddr[i], *(pGroupAddr + i));
+    }
+
+    return cmdBld_CfgIeGroupAdressTable (hCmdBld, uNumGroupAddr, pGroupAddr, bEnabled, fCb, hCb);  
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgRtsThreshold()
+ ****************************************************************************
+ * DESCRIPTION: Sets the Rts Threshold. 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK  pWlanParams->RtsThreshold
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgRtsThreshold (TI_HANDLE hCmdBld, TI_UINT16 threshold, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgIeRtsThreshold (hCmdBld, threshold, fCb, hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgDcoItrimParams()
+ ****************************************************************************
+ * DESCRIPTION: Sets the DCO Itrim parameters. 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK 
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgDcoItrimParams (TI_HANDLE hCmdBld, TI_BOOL enable, TI_UINT32 moderationTimeoutUsec, void *fCb, TI_HANDLE hCb)
+{
+    /* Keeps the parameters in the db */
+    DB_WLAN(hCmdBld).dcoItrimEnabled = enable;
+    DB_WLAN(hCmdBld).dcoItrimModerationTimeoutUsec = moderationTimeoutUsec;
+
+    return cmdBld_CfgIeDcoItrimParams (hCmdBld, enable, moderationTimeoutUsec, fCb, hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgFragmentThreshold()
+ ****************************************************************************
+ * DESCRIPTION: Sets the tx fragmentation Threshold. 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK 
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgFragmentThreshold (TI_HANDLE hCmdBld, TI_UINT16 uFragmentThreshold, void *fCb, TI_HANDLE hCb)
+{
+    DB_WLAN(hCmdBld).FragmentThreshold = uFragmentThreshold;  
+
+    return cmdBld_CfgIeFragmentThreshold (hCmdBld, uFragmentThreshold, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgPreamble()
+ ****************************************************************************
+ * DESCRIPTION: Set the preamble in ?????? hardware register
+ *
+ * INPUTS:  
+ *      preambleVal     
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: None
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgPreamble (TI_HANDLE hCmdBld, Preamble_e ePreamble, void *fCb, TI_HANDLE hCb)
+{
+    DB_WLAN(hCmdBld).preamble = ePreamble;      
+
+    return cmdBld_CfgIePreamble (hCmdBld, (TI_UINT8)ePreamble, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgBcnBrcOptions()
+ ****************************************************************************
+ * DESCRIPTION: Configure the wlan hardware
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgBcnBrcOptions (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgIeBcnBrcOptions (hCmdBld, pPMConfig, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgWakeUpCondition()
+ ****************************************************************************
+ * DESCRIPTION: Configure the wlan hardware
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgWakeUpCondition (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgIeWakeUpCondition (hCmdBld, pPMConfig, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgSleepAuth ()
+ ****************************************************************************
+ * DESCRIPTION: Set the min power level
+ * 
+ * INPUTS: 
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgSleepAuth (TI_HANDLE hCmdBld, EPowerPolicy eMinPowerLevel, void *fCb, TI_HANDLE hCb)
+{
+    /* Save th parameter in database */
+    DB_WLAN(hCmdBld).minPowerLevel = eMinPowerLevel;
+
+    return cmdBld_CfgIeSleepAuth (hCmdBld, eMinPowerLevel, fCb, hCb);
+}
+
+
+typedef enum { HW_CLOCK_40_MHZ = 40, HW_CLOCK_80_MHZ = 80 } EHwClock;
+
+
+/****************************************************************************
+ *                      cmdBld_CfgArmClock()
+ ****************************************************************************
+ * DESCRIPTION: Configure the arm clock
+ *  !!! Note that the firmware will set the slot time according to the new clock
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgArmClock (TI_HANDLE hCmdBld, TI_UINT32 uArmClock, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
+
+    pWlanParams->ArmClock = uArmClock;
+
+    /* Illegal combination Mac=80, Arm=40 ==> force setting 40/40*/
+    if (pWlanParams->MacClock == HW_CLOCK_80_MHZ && pWlanParams->ArmClock == HW_CLOCK_40_MHZ)
+    {
+        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_ArmClockSet: Illegal combination Mac=80, Arm=40 ==> force setting 40/40\n");
+        pWlanParams->MacClock = HW_CLOCK_40_MHZ;
+    }
+
+    return cmdBld_CfgIeFeatureConfig (hCmdBld, 
+                                      pWlanParams->FeatureOptions, 
+                                      pWlanParams->FeatureDataFlowOptions,
+                                      fCb, 
+                                      hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgMacClock()
+ ****************************************************************************
+ * DESCRIPTION: Configure the mac clock
+ *  !!! Note that the firmware will set the slot time according to the new clock
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgMacClock (TI_HANDLE hCmdBld, TI_UINT32 uMacClock, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
+
+    pWlanParams->MacClock = uMacClock;
+
+    /* Force same clock - for printing */
+    pWlanParams->ArmClock = uMacClock;
+
+    /* Illegal combination Mac=80, Arm=40 ==> force setting 40/40*/
+    if (pWlanParams->MacClock == HW_CLOCK_80_MHZ && pWlanParams->ArmClock == HW_CLOCK_40_MHZ)
+    {
+        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_MacClockSet: Illegal combination Mac=80, Arm=40 ==> force setting 40/40\n");
+        pWlanParams->MacClock = HW_CLOCK_40_MHZ;
+    }
+
+    return cmdBld_CfgIeFeatureConfig (hCmdBld, 
+                                      pWlanParams->FeatureOptions, 
+                                      pWlanParams->FeatureDataFlowOptions, 
+                                      fCb, 
+                                      hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgAid()
+ ****************************************************************************
+ * DESCRIPTION: Set the AID
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgAid (TI_HANDLE hCmdBld, TI_UINT16 uAidVal, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgIeAid (hCmdBld, uAidVal, fCb, hCb);
+}
+
+TI_STATUS cmdBld_CfgClkRun (TI_HANDLE hCmdBld, TI_BOOL aClkRunEnable, void *fCb, TI_HANDLE hCb)
+{
+    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
+
+    if (aClkRunEnable)
+    {
+        pWlanParams->FeatureDataFlowOptions |= FEAT_PCI_CLK_RUN_ENABLE;
+    }
+    else
+    {
+        pWlanParams->FeatureDataFlowOptions &= ~FEAT_PCI_CLK_RUN_ENABLE;
+    }
+
+    return cmdBld_CfgIeFeatureConfig (hCmdBld, 
+                                      pWlanParams->FeatureOptions, 
+                                      pWlanParams->FeatureDataFlowOptions, 
+                                      fCb, 
+                                      hCb);
+}
+
+
+TI_STATUS cmdBld_CfgRxMsduFormat (TI_HANDLE hCmdBld, TI_BOOL bRxMsduForamtEnable, void *fCb, TI_HANDLE hCb)
+{
+#if 1
+    /* WARNING:  Have to check how to control the Rx Frame format select (which bit)
+                 and then access the HW*/
+    return TI_OK;
+#else
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
+
+    if (aRxMsduForamtEnable)
+    {
+        pWlanParams->FeatureDataFlowOptions |= DATA_FLOW_RX_MSDU_FRAME;
+    }
+    else
+    {
+        pWlanParams->FeatureDataFlowOptions &= ~DATA_FLOW_RX_MSDU_FRAME;
+    }
+
+    return cmdBld_CfgIeFeatureConfig (hCmdBld, 
+                                      pWlanParams->FeatureOptions, 
+                                      pWlanParams->FeatureDataFlowOptions, 
+                                      fCb, 
+                                      hCb);
+#endif
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgTid()
+ ****************************************************************************
+ * DESCRIPTION: configure Queue traffic params
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgTid (TI_HANDLE hCmdBld, TQueueTrafficParams *pQtrafficParams, void *fCb, TI_HANDLE hCb)
+{
+    DB_QUEUES(hCmdBld).isQueueConfigured[pQtrafficParams->queueID] = TI_TRUE;
+    DB_QUEUES(hCmdBld).queues[pQtrafficParams->queueID] = *pQtrafficParams;
+
+    return cmdBld_CfgIeTid (hCmdBld, pQtrafficParams, fCb, hCb);  
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgAcParams()
+ ****************************************************************************
+ * DESCRIPTION: configure AC params
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgAcParams (TI_HANDLE hCmdBld, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb)
+{
+    DB_AC(hCmdBld).isAcConfigured[pAcQosParams->ac] = TI_TRUE;
+    DB_AC(hCmdBld).ac[pAcQosParams->ac] = *pAcQosParams;
+
+    return cmdBld_CfgIeAcParams (hCmdBld, pAcQosParams, fCb, hCb);  
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgPsRxStreaming()
+ ****************************************************************************
+ * DESCRIPTION: configure PS-Rx-Streaming params
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgPsRxStreaming (TI_HANDLE hCmdBld, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb)
+{
+    DB_PS_STREAM(hCmdBld).tid[pPsRxStreaming->uTid] = *pPsRxStreaming;
+
+    return cmdBld_CfgIePsRxStreaming (hCmdBld, pPsRxStreaming, fCb, hCb);  
+}
+
+
+/****************************************************************************
+ *                     cmdBld_CfgPacketDetectionThreshold
+ ****************************************************************************
+ * DESCRIPTION: Sets Packet Detection Threshold 
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgPacketDetectionThreshold (TI_HANDLE hCmdBld, TI_UINT32 threshold, void *fCb, TI_HANDLE hCb)
+{
+    DB_WLAN(hCmdBld).PacketDetectionThreshold = threshold;
+
+    return cmdBld_CfgIePacketDetectionThreshold (hCmdBld, threshold, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                     cmdBld_CfgBeaconFilterOpt
+ ****************************************************************************
+ * DESCRIPTION: Sets Beacon filtering state 
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgBeaconFilterOpt (TI_HANDLE  hCmdBld, 
+                                     TI_UINT8   uBeaconFilteringStatus, 
+                                     TI_UINT8   uNumOfBeaconsToBuffer, 
+                                     void       *fCb, 
+                                     TI_HANDLE  hCb)
+{
+    DB_WLAN(hCmdBld).beaconFilterParams.desiredState = uBeaconFilteringStatus;
+    DB_WLAN(hCmdBld).beaconFilterParams.numOfElements = uNumOfBeaconsToBuffer;
+
+    return cmdBld_CfgIeBeaconFilterOpt (hCmdBld, 
+                                        uBeaconFilteringStatus, 
+                                        uNumOfBeaconsToBuffer, 
+                                        fCb, 
+                                        hCb);
+}
+
+/****************************************************************************
+ *                     cmdBld_CfgRateMngDbg
+ ****************************************************************************
+ * DESCRIPTION: Sets rate managment params  
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+
+TI_STATUS cmdBld_CfgRateMngDbg (TI_HANDLE  hCmdBld, 
+                                RateMangeParams_t *pRateMngParams , 
+                                void       *fCb, 
+                                TI_HANDLE  hCb)
+{
+
+	TRateMngParams      *pRateMngParamsDB = &DB_RM(hCmdBld);
+	int uIndex;
+
+	pRateMngParamsDB->rateMngParams.paramIndex = pRateMngParams->paramIndex;
+    
+	 switch (pRateMngParams->paramIndex)
+		{   
+		case RATE_MGMT_RETRY_SCORE_PARAM:
+			pRateMngParamsDB->rateMngParams.RateRetryScore = pRateMngParams->RateRetryScore;
+			break;
+		case RATE_MGMT_PER_ADD_PARAM:
+			pRateMngParamsDB->rateMngParams.PerAdd = pRateMngParams->PerAdd;
+			break;
+		case RATE_MGMT_PER_TH1_PARAM:
+			pRateMngParamsDB->rateMngParams.PerTh1 = pRateMngParams->PerTh1;
+			break;
+		case RATE_MGMT_PER_TH2_PARAM:
+			pRateMngParamsDB->rateMngParams.PerTh2 = pRateMngParams->PerTh2;
+			break;
+		case RATE_MGMT_MAX_PER_PARAM:
+			pRateMngParamsDB->rateMngParams.MaxPer = pRateMngParams->MaxPer;
+			break;
+		case RATE_MGMT_INVERSE_CURIOSITY_FACTOR_PARAM:
+			pRateMngParamsDB->rateMngParams.InverseCuriosityFactor[0] = pRateMngParams->InverseCuriosityFactor[0];
+            pRateMngParamsDB->rateMngParams.InverseCuriosityFactor[1] = pRateMngParams->InverseCuriosityFactor[1];
+			break;
+		case RATE_MGMT_TX_FAIL_LOW_TH_PARAM:
+			pRateMngParamsDB->rateMngParams.TxFailLowTh = pRateMngParams->TxFailLowTh;
+			break;
+		case RATE_MGMT_TX_FAIL_HIGH_TH_PARAM:
+			pRateMngParamsDB->rateMngParams.TxFailHighTh = pRateMngParams->TxFailHighTh;
+			break;
+		case RATE_MGMT_PER_ALPHA_SHIFT_PARAM:
+			pRateMngParamsDB->rateMngParams.PerAlphaShift = pRateMngParams->PerAlphaShift;
+			break;
+		case RATE_MGMT_PER_ADD_SHIFT_PARAM:
+			pRateMngParamsDB->rateMngParams.PerAddShift = pRateMngParams->PerAddShift;
+			break;
+		case RATE_MGMT_PER_BETA1_SHIFT_PARAM:
+			pRateMngParamsDB->rateMngParams.PerBeta1Shift = pRateMngParams->PerBeta1Shift;
+			break;
+		case RATE_MGMT_PER_BETA2_SHIFT_PARAM:
+			pRateMngParamsDB->rateMngParams.PerBeta2Shift = pRateMngParams->PerBeta2Shift;
+			break;
+		case RATE_MGMT_RATE_CHECK_UP_PARAM:
+			pRateMngParamsDB->rateMngParams.RateCheckUp = pRateMngParams->RateCheckUp;
+			break;
+		case RATE_MGMT_RATE_CHECK_DOWN_PARAM:
+			pRateMngParamsDB->rateMngParams.RateCheckDown = pRateMngParams->RateCheckDown;
+			break;
+	    case RATE_MGMT_RATE_RETRY_POLICY_PARAM:
+			for (uIndex = 0; uIndex < 13; uIndex++)
+				{
+					pRateMngParamsDB->rateMngParams.RateRetryPolicy[uIndex] = pRateMngParams->RateRetryPolicy[uIndex];
+				}
+			break;
+        case RATE_MGMT_PER_WEIGHT_SHIFT_PARAM:
+             pRateMngParamsDB->rateMngParams.PerWeightShift[0] = pRateMngParams->PerWeightShift[0];             
+             pRateMngParamsDB->rateMngParams.PerWeightShift[1] = pRateMngParams->PerWeightShift[1];             
+             break;
+        case RATE_MGMT_TP_WEIGHT_SHIFT_PARAM:			
+            pRateMngParamsDB->rateMngParams.TpWeightShift[0] = pRateMngParams->TpWeightShift[0];
+            pRateMngParamsDB->rateMngParams.TpWeightShift[1] = pRateMngParams->TpWeightShift[1];
+			break;
+        case RATE_MGMT_ALL_PARAMS:			
+             pRateMngParamsDB->rateMngParams.RateRetryScore = pRateMngParams->RateRetryScore;        
+             pRateMngParamsDB->rateMngParams.PerAdd = pRateMngParams->PerAdd;
+             pRateMngParamsDB->rateMngParams.PerTh1 = pRateMngParams->PerTh1;
+             pRateMngParamsDB->rateMngParams.PerTh2 = pRateMngParams->PerTh2;
+             pRateMngParamsDB->rateMngParams.MaxPer = pRateMngParams->MaxPer;
+             pRateMngParamsDB->rateMngParams.InverseCuriosityFactor[0] = pRateMngParams->InverseCuriosityFactor[0];
+             pRateMngParamsDB->rateMngParams.InverseCuriosityFactor[1] = pRateMngParams->InverseCuriosityFactor[1];
+             pRateMngParamsDB->rateMngParams.TxFailLowTh = pRateMngParams->TxFailLowTh;
+             pRateMngParamsDB->rateMngParams.TxFailHighTh = pRateMngParams->TxFailHighTh;
+             pRateMngParamsDB->rateMngParams.PerAlphaShift = pRateMngParams->PerAlphaShift;
+             pRateMngParamsDB->rateMngParams.PerAddShift = pRateMngParams->PerAddShift;
+             pRateMngParamsDB->rateMngParams.PerBeta1Shift = pRateMngParams->PerBeta1Shift;
+             pRateMngParamsDB->rateMngParams.PerBeta2Shift = pRateMngParams->PerBeta2Shift;
+             pRateMngParamsDB->rateMngParams.RateCheckUp = pRateMngParams->RateCheckUp;
+             pRateMngParamsDB->rateMngParams.RateCheckDown = pRateMngParams->RateCheckDown;
+             for (uIndex = 0; uIndex < 13; uIndex++)
+             {
+                 pRateMngParamsDB->rateMngParams.RateRetryPolicy[uIndex] = pRateMngParams->RateRetryPolicy[uIndex];
+             }             
+             pRateMngParamsDB->rateMngParams.PerWeightShift[0] = pRateMngParams->PerWeightShift[0];             
+             pRateMngParamsDB->rateMngParams.PerWeightShift[1] = pRateMngParams->PerWeightShift[1];
+             pRateMngParamsDB->rateMngParams.TpWeightShift[0] = pRateMngParams->TpWeightShift[0];
+             pRateMngParamsDB->rateMngParams.TpWeightShift[1] = pRateMngParams->TpWeightShift[1];
+             break;
+	 }
+
+    return cmdBld_CfgIeRateMngDbg (hCmdBld, 
+                                   pRateMngParams, 
+                                   fCb, 
+                                   hCb);
+}
+
+
+/****************************************************************************
+ *                     cmdBld_CfgBeaconFilterTable
+ ****************************************************************************
+ * DESCRIPTION: Sets Beacon filtering state 
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgBeaconFilterTable (TI_HANDLE    hCmdBld, 
+                                       TI_UINT8     uNumberOfIEs, 
+                                       TI_UINT8     *pIETable, 
+                                       TI_UINT8     uIETableSize, 
+                                       void         *fCb, 
+                                       TI_HANDLE    hCb)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+
+    if (uIETableSize > BEACON_FILTER_TABLE_MAX_SIZE)
+    {
+        TRACE2(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgBeaconFilterTable: Table size is too big %d (>%d)\n", uIETableSize, BEACON_FILTER_TABLE_MAX_SIZE);
+
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    os_memoryZero (pCmdBld->hOs, 
+                   (void *)DB_WLAN(hCmdBld).beaconFilterIETable.IETable, 
+                   BEACON_FILTER_TABLE_MAX_SIZE);
+    os_memoryCopy (pCmdBld->hOs, 
+                   (void *)DB_WLAN(hCmdBld).beaconFilterIETable.IETable, 
+                   (void *)pIETable, 
+                   uIETableSize);
+    DB_WLAN(hCmdBld).beaconFilterIETable.numberOfIEs = uNumberOfIEs;
+    DB_WLAN(hCmdBld).beaconFilterIETable.IETableSize = uIETableSize;
+
+    return cmdBld_CfgIeBeaconFilterTable (hCmdBld, uNumberOfIEs, pIETable, uIETableSize, fCb, hCb);
+}
+
+ 
+/*----------------------------------------*/
+/* Roaming Trigger Configuration Commands */
+/*----------------------------------------*/
+
+/****************************************************************************
+ *                      cmdBld_CfgRssiSnrTrigger()
+ ****************************************************************************
+ * DESCRIPTION: Set the RSSI/SNR Trigger parameters.
+ *
+ * INPUTS:  
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: None
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgRssiSnrTrigger (TI_HANDLE hCmdBld, RssiSnrTriggerCfg_t *pTriggerParam, void *fCb, TI_HANDLE hCb) 
+{
+    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].index     = pTriggerParam->index;
+    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].threshold = pTriggerParam->threshold;
+    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].pacing    = pTriggerParam->pacing;
+    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].metric    = pTriggerParam->metric;
+    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].type      = pTriggerParam->type;
+    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].direction = pTriggerParam->direction;
+    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].hystersis = pTriggerParam->hystersis;
+    DB_WLAN(hCmdBld).tRssiSnrTrigger[pTriggerParam->index].enable    = pTriggerParam->enable;
+
+    return cmdBld_CfgIeRssiSnrTrigger (hCmdBld, pTriggerParam, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgRssiSnrWeights()
+ ****************************************************************************
+ * DESCRIPTION: Set RSSI/SNR Weights for Average calculations.
+ *
+ * INPUTS:  
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: None
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgRssiSnrWeights (TI_HANDLE hCmdBld, RssiSnrAverageWeights_t *pWeightsParam, void *fCb, TI_HANDLE hCb) 
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "\n cmdBld_CfgRssiSnrWeights :\n                             uRssiBeaconAverageWeight = %d\n                             uRssiPacketAverageWeight = %d\n                             uSnrBeaconAverageWeight  = %d\n                             uSnrPacketAverageWeight = %d \n ", pWeightsParam->rssiBeaconAverageWeight, pWeightsParam->rssiPacketAverageWeight, pWeightsParam->snrBeaconAverageWeight , pWeightsParam->snrPacketAverageWeight  );
+
+    DB_WLAN(hCmdBld).tRssiSnrWeights.rssiBeaconAverageWeight = pWeightsParam->rssiBeaconAverageWeight;
+    DB_WLAN(hCmdBld).tRssiSnrWeights.rssiPacketAverageWeight = pWeightsParam->rssiPacketAverageWeight;
+    DB_WLAN(hCmdBld).tRssiSnrWeights.snrBeaconAverageWeight  = pWeightsParam->snrBeaconAverageWeight ;
+    DB_WLAN(hCmdBld).tRssiSnrWeights.snrPacketAverageWeight  = pWeightsParam->snrPacketAverageWeight ;
+
+    return cmdBld_CfgIeRssiSnrWeights (hCmdBld, pWeightsParam, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgMaxTxRetry()
+ ****************************************************************************
+ * DESCRIPTION: Set Max Tx retry parmaters.
+ *
+ * INPUTS:  
+ *      maxTxRetry             max Tx Retry
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: None
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgMaxTxRetry (TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb)
+{
+    DB_WLAN(hCmdBld).roamTriggers.maxTxRetry = pRoamingTriggerCmd->maxTxRetry;
+
+    return cmdBld_CfgIeMaxTxRetry (hCmdBld, pRoamingTriggerCmd, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgSgEnable()
+ ****************************************************************************
+ * DESCRIPTION: Save Soft Gemini enable parameter
+ *
+ * INPUTS:
+ *
+ * OUTPUT:
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgSgEnable (TI_HANDLE hCmdBld, ESoftGeminiEnableModes eSgEnable, void *fCb, TI_HANDLE hCb)
+{
+    DB_WLAN(hCmdBld).SoftGeminiEnable = eSgEnable;
+                    
+    return cmdBld_CfgIeSgEnable (hCmdBld, eSgEnable, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgSg()
+ ****************************************************************************
+ * DESCRIPTION: Save Soft Gemini config parameter
+ *
+ * INPUTS:
+ *
+ * OUTPUT:
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgSg (TI_HANDLE hCmdBld, TSoftGeminiParams *pSgParam, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    /* Copy params for recovery */
+    os_memoryCopy (pCmdBld->hOs,
+                   (void*)&DB_WLAN(hCmdBld).SoftGeminiParams,
+                   (void*)pSgParam,
+                   sizeof(TSoftGeminiParams));
+                  
+    return cmdBld_CfgIeSg (hCmdBld, pSgParam, fCb, hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgCoexActivity()
+ ****************************************************************************
+ * DESCRIPTION: Sets the CoexActivity table. 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK  pWlanParams->RtsThreshold
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgCoexActivity (TI_HANDLE hCmdBld, TCoexActivity *pCoexActivity, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
+    TCoexActivity *pSaveCoex = &pWlanParams->tWlanParamsCoexActivityTable.entry[0];
+    int numOfElements = pWlanParams->tWlanParamsCoexActivityTable.numOfElements;
+    int i;
+    
+    /* Check if to overwrite existing entry or put on last index */
+    for (i=0; i<numOfElements; i++)
+    {
+        if ((pSaveCoex[i].activityId == pCoexActivity->activityId) && (pSaveCoex->coexIp == pCoexActivity->coexIp))
+        {
+            break;
+        }
+    }
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgCoexActivity: save Param %d in index %d, %d %d\n", 0, i, pCoexActivity->coexIp, pCoexActivity->activityId);
+    /* save in WlanParams for recovery */
+    pSaveCoex[i].coexIp          = pCoexActivity->coexIp;
+    pSaveCoex[i].activityId      = pCoexActivity->activityId;
+    pSaveCoex[i].defaultPriority = pCoexActivity->defaultPriority;
+    pSaveCoex[i].raisedPriority  = pCoexActivity->raisedPriority;
+    pSaveCoex[i].minService      = pCoexActivity->minService;
+    pSaveCoex[i].maxService      = pCoexActivity->maxService;
+
+    if (i == numOfElements)
+    {
+        /* no existing entry overwrite, increment number of elements */
+        pWlanParams->tWlanParamsCoexActivityTable.numOfElements++;
+    }
+
+    return cmdBld_CfgIeCoexActivity (hCmdBld, pCoexActivity, fCb, hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgFmCoex()
+ ****************************************************************************
+ * DESCRIPTION: Save and configure FM coexistence parameters
+ *
+ * INPUTS:      
+ *
+ * OUTPUT:
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgFmCoex (TI_HANDLE hCmdBld, TFmCoexParams *pFmCoexParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    /* Copy params for recovery */
+    os_memoryCopy (pCmdBld->hOs,
+                   (void*)&(DB_WLAN(hCmdBld).tFmCoexParams),
+                   (void*)pFmCoexParams,
+                   sizeof(TFmCoexParams));
+                  
+    return cmdBld_CfgIeFmCoex (hCmdBld, pFmCoexParams, fCb, hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgTxRatePolicy()
+ ****************************************************************************
+ * DESCRIPTION: configure TxRatePolicy params
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgTxRatePolicy (TI_HANDLE hCmdBld, TTxRatePolicy *pTxRatePolicy, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
+    TTxRateClass   *pTxRateClass = pTxRatePolicy->rateClass;
+    TI_UINT8       index;
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "_1, Num of classes = 0x%x\n", pTxRatePolicy->numOfRateClasses);
+
+    DB_BSS(hCmdBld).TxRateClassParams.numOfRateClasses = pTxRatePolicy->numOfRateClasses;
+
+    for (index = 0; index < pTxRatePolicy->numOfRateClasses; index++, pTxRateClass++)
+    {
+        TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "_2loop, Index = %d, Short R = 0x%x, Long R = 0x%x, Rates = 0x%x\n", index, pTxRateClass->shortRetryLimit, pTxRateClass->longRetryLimit, pTxRateClass->txEnabledRates);
+
+        DB_BSS(hCmdBld).TxRateClassParams.rateClass[index] = *pTxRateClass;
+    }
+
+    return cmdBld_CfgIeTxRatePolicy (hCmdBld, pTxRatePolicy, fCb, hCb);  
+}
+
+
+TI_STATUS cmdBld_CfgSlotTime (TI_HANDLE hCmdBld, ESlotTime eSlotTime, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    DB_WLAN(hCmdBld).SlotTime = eSlotTime;      
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgSlotTime: Slot time = %d\n", eSlotTime);
+
+    /* Configure the new Slot-Time value to the FW. */
+    return cmdBld_CfgIeSlotTime (hCmdBld, (TI_UINT8)eSlotTime, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CfgEventMask (TI_HANDLE hCmdBld, TI_UINT32 uEventMask, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgIeEventMask (hCmdBld, uEventMask, fCb, hCb);
+}
+
+
+/*
+ * ----------------------------------------------------------------------------
+ * Function : cmdBld_CfgHwEncEnable
+ *
+ * Input    : 
+ * Output   :
+ * Process  :
+ * Note(s)  :
+ * -----------------------------------------------------------------------------
+ */
+TI_STATUS cmdBld_CfgHwEncEnable (TI_HANDLE hCmdBld, TI_BOOL bHwEncEnable, TI_BOOL bHwDecEnable, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld     *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
+    
+    /* Store the HW encryption Enable flag for reconfigure time (FW reload)*/
+    DB_KEYS(pCmdBld).bReconfHwEncEnable = bHwEncEnable;
+    DB_KEYS(pCmdBld).bHwEncDecrEnableValid = TI_TRUE;
+
+    if (bHwEncEnable)
+    {
+        pWlanParams->FeatureDataFlowOptions &= ~DF_ENCRYPTION_DISABLE;
+    }
+    else
+    {
+        pWlanParams->FeatureDataFlowOptions |= DF_ENCRYPTION_DISABLE;
+    }
+
+    /* Set bit DF_SNIFF_MODE_ENABLE to enable or prevent decryption in fw */
+    /* WARNING: Have to check how to control the decryption (which bit) and then set/reset
+                the  appropriate bit*/ 
+    if (bHwDecEnable)
+    {
+        pWlanParams->FeatureDataFlowOptions &= ~DF_SNIFF_MODE_ENABLE;
+    }
+    else
+    {
+        pWlanParams->FeatureDataFlowOptions |= DF_SNIFF_MODE_ENABLE;
+    }
+
+    return cmdBld_CfgIeFeatureConfig (hCmdBld, 
+                                      pWlanParams->FeatureOptions, 
+                                      pWlanParams->FeatureDataFlowOptions, 
+                                      fCb, 
+                                      hCb);
+}
+
+
+TI_STATUS cmdBld_CfgHwEncDecEnable (TI_HANDLE hCmdBld, TI_BOOL bHwEncEnable, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgHwEncEnable (hCmdBld, bHwEncEnable, bHwEncEnable, fCb, hCb);
+}
+
+
+/*
+ * ----------------------------------------------------------------------------
+ * Function : cmdBld_CfgSecureMode
+ *
+ * Input    : 
+ * Output   :
+ * Process  :
+ * Note(s)  :
+ * -----------------------------------------------------------------------------
+ */
+TI_STATUS cmdBld_CfgSecureMode (TI_HANDLE hCmdBld, ECipherSuite eSecurMode, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT32     index;
+
+    if (eSecurMode < TWD_CIPHER_MAX)
+    {
+        TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgSecureMode: change tSecurity mode from %d --> %d\n", pCmdBld->tSecurity.eSecurityMode, eSecurMode);
+        /* check if tSecurity mode is equal to previous one*/
+        if (pCmdBld->tSecurity.eSecurityMode == eSecurMode)
+        {
+            return TI_OK;
+        }
+
+        /* Reset all reconfig valid fields*/
+        DB_KEYS(pCmdBld).bHwEncDecrEnableValid = TI_FALSE;
+        DB_KEYS(pCmdBld).bDefaultKeyIdValid = TI_FALSE;  
+        for (index = 0; 
+             index < pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS; 
+             index++)
+        {
+            (DB_KEYS(pCmdBld).pReconfKeys + index)->keyType = KEY_NULL;
+        }
+        
+        /* set the new tSecurity mode*/
+        pCmdBld->tSecurity.eSecurityMode = eSecurMode;
+
+        /* disable defrag, duplicate detection on TNETW+XCC on chip level*/
+        /* YV- to add fragmentation control (if there is- artur ?)*/
+        return cmdBld_CfgRxMsduFormat (hCmdBld, 
+                                       pCmdBld->tSecurity.eSecurityMode != TWD_CIPHER_CKIP,
+                                       fCb,
+                                       hCb);
+    }
+    else
+    {
+        return TI_NOK;
+    }
+}
+
+
+TI_STATUS cmdBld_CfgConnMonitParams (TI_HANDLE  hCmdBld, 
+                                     TRroamingTriggerParams *pRoamingTriggerCmd, 
+                                     void       *fCb, 
+                                     TI_HANDLE  hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "SetBssLossTsfThresholdParamsCmd :\n                             BssLossTimeout = %d\n                             TsfMissThreshold = %d \n ", pRoamingTriggerCmd->BssLossTimeout, pRoamingTriggerCmd->TsfMissThreshold);
+
+    DB_WLAN(hCmdBld).roamTriggers.BssLossTimeout = pRoamingTriggerCmd->BssLossTimeout;
+    DB_WLAN(hCmdBld).roamTriggers.TsfMissThreshold = pRoamingTriggerCmd->TsfMissThreshold;
+
+    return cmdBld_CfgIeConnMonitParams (hCmdBld, pRoamingTriggerCmd, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                 cmdBld_CfgEnableRxDataFilter()
+ ****************************************************************************
+ * DESCRIPTION: Enables or disables Rx data filtering.
+ * 
+ * INPUTS:  enabled             - 0 to disable data filtering, any other value to enable.
+ *          defaultAction       - The default action to take on non-matching packets.
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgEnableRxDataFilter (TI_HANDLE   hCmdBld, 
+                                        TI_BOOL     bEnabled, 
+                                        filter_e    eDefaultAction, 
+                                        void        *fCb, 
+                                        TI_HANDLE   hCb)
+{
+    /* Save parameters for reconfig phase */
+    DB_RX_DATA_FLTR(hCmdBld).bEnabled       = bEnabled;
+    DB_RX_DATA_FLTR(hCmdBld).eDefaultAction = eDefaultAction;
+
+    return cmdBld_CfgIeEnableRxDataFilter (hCmdBld, bEnabled, eDefaultAction, fCb, hCb);
+}
+
+
+/****************************************************************************
+*                      cmdBld_CfgRxDataFilter()
+*****************************************************************************
+* DESCRIPTION: Add/remove Rx Data filter information element.
+*
+* INPUTS:  index               - Index of the Rx Data filter
+*          command             - Add or remove the filter
+*          action              - Action to take on packets matching the pattern
+*          numFieldPatterns    - Number of field patterns in the filter
+*          lenFieldPatterns    - Length of the field pattern series
+*          fieldPatterns       - Series of field patterns
+*
+* OUTPUT:  None
+*
+* RETURNS: TI_OK or TI_NOK
+****************************************************************************/
+TI_STATUS cmdBld_CfgRxDataFilter (TI_HANDLE hCmdBld, 
+                                  TI_UINT8     index, 
+                                  TI_UINT8     command, 
+                                  filter_e  eAction, 
+                                  TI_UINT8     uNumFieldPatterns, 
+                                  TI_UINT8     uLenFieldPatterns, 
+                                  TI_UINT8  *pFieldPatterns, 
+                                  void      *fCb, 
+                                  TI_HANDLE hCb)
+{
+    TCmdBld         *pCmdBld  = (TCmdBld *)hCmdBld;
+    TRxDataFilter   *pFilters = &(DB_RX_DATA_FLTR(hCmdBld).aRxDataFilter[index]);
+
+    /* Save parameters for reconfig phase */
+    pFilters->uIndex            = index;
+    pFilters->uCommand          = command;
+    pFilters->eAction           = eAction;
+    pFilters->uNumFieldPatterns = uNumFieldPatterns;
+    pFilters->uLenFieldPatterns = uLenFieldPatterns;
+    os_memoryCopy(pCmdBld->hOs, pFilters->aFieldPattern, pFieldPatterns, uLenFieldPatterns);
+
+    return cmdBld_CfgIeRxDataFilter (hCmdBld, 
+                                     index, 
+                                     command, 
+                                     eAction, 
+                                     uNumFieldPatterns, 
+                                     uLenFieldPatterns, 
+                                     pFieldPatterns, 
+                                     fCb, 
+                                     hCb);
+}
+
+
+TI_STATUS cmdBld_CfgCtsProtection (TI_HANDLE hCmdBld, TI_UINT8 uCtsProtection, void *fCb, TI_HANDLE hCb)
+    {
+        DB_WLAN(hCmdBld).CtsToSelf = uCtsProtection;
+
+    return cmdBld_CfgIeCtsProtection (hCmdBld, uCtsProtection, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CfgServicePeriodTimeout (TI_HANDLE hCmdBld, TRxTimeOut *pRxTimeOut, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgIeServicePeriodTimeout (hCmdBld, pRxTimeOut, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CfgRxMsduLifeTime (TI_HANDLE hCmdBld, TI_UINT32 uRxMsduLifeTime, void *fCb, TI_HANDLE hCb)
+    {
+        DB_WLAN(hCmdBld).MaxRxMsduLifetime = uRxMsduLifeTime;
+
+    return cmdBld_CfgIeRxMsduLifeTime (hCmdBld, uRxMsduLifeTime, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CfgStatisitics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgIeStatisitics (hCmdBld, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CfgTxPowerDbm (TI_HANDLE hCmdBld, TI_UINT8 uTxPowerDbm, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CfgIeTxPowerDbm (hCmdBld, uTxPowerDbm, fCb, hCb);
+}
+
+ /*
+ * ----------------------------------------------------------------------------
+ * Function : cmdBld_CfgBet
+ *
+ * Input    :   enabled               - 0 to disable BET, 0 to disable BET
+ *              MaximumConsecutiveET  - Max number of consecutive beacons
+ *                                      that may be early terminated.
+ * Output   : TI_STATUS
+ * Process  :  Configures Beacon Early Termination information element.
+ * Note(s)  :  None
+ * -----------------------------------------------------------------------------
+ */
+TI_STATUS cmdBld_CfgBet (TI_HANDLE hCmdBld, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET, void *fCb, TI_HANDLE hCb)
+{
+    DB_WLAN(hCmdBld).BetEnable              = Enable;
+    DB_WLAN(hCmdBld).MaximumConsecutiveET   = MaximumConsecutiveET;
+
+    return cmdBld_CfgIeBet (hCmdBld, Enable, MaximumConsecutiveET, fCb, hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgKeepAlive()
+ ****************************************************************************
+ * DESCRIPTION: Set keep-alive paramters for a single index
+ * 
+ * INPUTS: Paramters and CB
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgKeepAlive (TI_HANDLE hCmdBld, TKeepAliveParams *pKeepAliveParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "CmdBld: Seeting keep-alive params, index=%d, interval=%d msec, trigType=%d, enaFlag=%d\n", pKeepAliveParams->index, pKeepAliveParams->interval, pKeepAliveParams->trigType, pKeepAliveParams->enaDisFlag);
+
+    os_memoryCopy (pCmdBld->hOs, 
+                   (void *)&DB_KLV(hCmdBld).keepAliveParams[ pKeepAliveParams->index ], 
+                   (void *)pKeepAliveParams, 
+                   sizeof (TKeepAliveParams));
+
+    return cmdBld_CmdIeConfigureKeepAliveParams (hCmdBld, 
+                                                 pKeepAliveParams->index,
+                                                 pKeepAliveParams->enaDisFlag,
+                                                 (TI_UINT8)pKeepAliveParams->trigType,
+                                                 pKeepAliveParams->interval,
+                                                 fCb,
+                                                 hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgKeepAliveEnaDis()
+ ****************************************************************************
+ * DESCRIPTION: Set global keep-alive enable / disable flag
+ * 
+ * INPUTS: Paramters and CB
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgKeepAliveEnaDis(TI_HANDLE hCmdBld, TI_UINT8 enaDisFlag, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "CmdBld: Seeting keep-alive Global ena / dis flag to %d\n", (TI_UINT32)enaDisFlag);
+
+    DB_KLV(hCmdBld).enaDisFlag = enaDisFlag;
+
+    return cmdBld_CmdIeConfigureKeepAliveEnaDis (hCmdBld, enaDisFlag, fCb, hCb);
+}
+
+/** 
+ * \fn     cmdBld_CfgSetFwHtCapabilities 
+ * \brief  set the current AP HT Capabilities to the FW. 
+ *
+ * \note    
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa 
+ */ 
+TI_STATUS cmdBld_CfgSetFwHtCapabilities (TI_HANDLE hCmdBld,
+                                         TI_UINT32 uHtCapabilites,
+                                         TMacAddr  tMacAddress,
+                                         TI_UINT8  uAmpduMaxLeng,
+                                         TI_UINT8  uAmpduMinSpac,
+                                         void      *fCb, 
+                                         TI_HANDLE hCb)
+{
+
+    DB_BSS(hCmdBld).bHtCap = TI_TRUE;
+    DB_BSS(hCmdBld).uHtCapabilites = uHtCapabilites;
+    MAC_COPY ((DB_BSS(hCmdBld).tMacAddress), tMacAddress);
+    DB_BSS(hCmdBld).uAmpduMaxLeng = uAmpduMaxLeng;
+    DB_BSS(hCmdBld).uAmpduMinSpac = uAmpduMinSpac;
+
+    return cmdBld_CfgIeSetFwHtCapabilities (hCmdBld,
+                                            uHtCapabilites,
+                                            tMacAddress,
+                                            uAmpduMaxLeng,
+                                            uAmpduMinSpac,
+                                            fCb, 
+                                            hCb);
+}
+
+/** 
+ * \fn     cmdBld_CfgSetFwHtInformation 
+ * \brief  set the current AP HT Information to the FW. 
+ *
+ * \note    
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa 
+ */ 
+TI_STATUS cmdBld_CfgSetFwHtInformation (TI_HANDLE hCmdBld,
+                                        TI_UINT8  uRifsMode,         
+                                        TI_UINT8  uHtProtection,     
+                                        TI_UINT8  uGfProtection,     
+                                        TI_UINT8  uHtTxBurstLimit,   
+                                        TI_UINT8  uDualCtsProtection,
+                                        void      *fCb, 
+                                        TI_HANDLE hCb)
+{
+
+    DB_BSS(hCmdBld).bHtInf = TI_TRUE;
+    DB_BSS(hCmdBld).uRifsMode = uRifsMode;
+    DB_BSS(hCmdBld).uHtProtection = uHtProtection;
+    DB_BSS(hCmdBld).uGfProtection = uGfProtection;
+    DB_BSS(hCmdBld).uHtTxBurstLimit = uHtTxBurstLimit;
+    DB_BSS(hCmdBld).uDualCtsProtection = uDualCtsProtection;
+
+    return cmdBld_CfgIeSetFwHtInformation (hCmdBld,
+                                           uRifsMode,          
+                                           uHtProtection,      
+                                           uGfProtection,      
+                                           uHtTxBurstLimit,    
+                                           uDualCtsProtection, 
+                                           fCb, 
+                                           hCb);
+}
+
+/** 
+ * \fn     cmdBld_CfgSetBaInitiator 
+ * \brief  configure BA session initiator\receiver parameters setting in the FW. 
+ *
+ * \note    
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa 
+ */ 
+TI_STATUS cmdBld_CfgSetBaSession (TI_HANDLE hCmdBld, 
+                                  InfoElement_e eBaType,   
+                                  TI_UINT8 uTid,               
+                                  TI_UINT8 uState,             
+                                  TMacAddr tRa,                
+                                  TI_UINT16 uWinSize,          
+                                  TI_UINT16 uInactivityTimeout,
+                                  void *fCb, 
+                                  TI_HANDLE hCb)
+{
+    if (ACX_BA_SESSION_INITIATOR_POLICY == eBaType)
+    {
+        DB_BSS(hCmdBld).bBaInitiator[uTid] = TI_TRUE;
+        DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uTid = uTid;
+        DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uPolicy = uState;
+        MAC_COPY ((DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].aMacAddress),tRa);
+        DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uWinSize = uWinSize;
+        DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uTid].uInactivityTimeout = uInactivityTimeout;
+    }
+    else
+    {
+        DB_BSS(hCmdBld).bBaResponder[uTid] = TI_TRUE;
+        DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uTid = uTid;
+        DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uPolicy = uState;
+        MAC_COPY ((DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].aMacAddress),tRa);
+        DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uWinSize = uWinSize;
+        DB_BSS(hCmdBld).tBaSessionResponderPolicy[uTid].uInactivityTimeout = uInactivityTimeout;
+    }
+
+    return cmdBld_CfgIeSetBaSession (hCmdBld, 
+                                     eBaType,
+                                     uTid,               
+                                     uState,             
+                                     tRa,                
+                                     uWinSize,          
+                                     uInactivityTimeout,
+                                     fCb,
+                                     hCb);
+}
+
+
+TI_STATUS cmdBld_CfgBurstMode (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb)
+{
+	DB_AC(hCmdBld).isBurstModeEnabled = bEnabled;
+	return cmdBld_CfgIeBurstMode (hCmdBld, bEnabled, fCb, hCb); 
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldCfgIE.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,2043 @@
+/*
+ * CmdBldCfgIE.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdBldCfgIE.c 
+ *  \brief Command builder. Configuration commands information elements
+ *
+ *  \see   CmdBld.h 
+ */
+#define __FILE_ID__  FILE_ID_92
+#include "osApi.h"
+#include "report.h"
+#include "CmdBld.h"
+#include "CmdQueue_api.h"
+#include "rate.h"
+#include "TwIf.h"
+
+/****************************************************************************
+ *                      cmdBld_CfgIeConfigMemory()
+ ****************************************************************************
+ * DESCRIPTION: Configure wlan hardware memory
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeConfigMemory (TI_HANDLE hCmdBld, TDmaParams *pDmaParams, void *fCb, TI_HANDLE hCb)
+{   
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXConfigMemory_t AcxElm_ConfigMemory;
+    ACXConfigMemory_t *pCfg = &AcxElm_ConfigMemory;
+    
+    os_memoryZero(pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
+
+    /*
+     * Set information element header
+     */
+    pCfg->EleHdr.id = ACX_MEM_CFG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /*
+     * Set configuration fields
+     */
+    pCfg->numStations             = pDmaParams->NumStations;
+    pCfg->rxMemblockNumber        = TWD_RX_MEM_BLKS_NUM;
+    pCfg->txMinimumMemblockNumber = TWD_TX_MIN_MEM_BLKS_NUM;
+    pCfg->numSsidProfiles         = 1;
+    pCfg->totalTxDescriptors      = ENDIAN_HANDLE_LONG(NUM_TX_DESCRIPTORS);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/* WoneIndex value when running as station */
+#define STATION_WONE_INDEX                  0
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeSlotTime()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the Slot Time
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeSlotTime (TI_HANDLE hCmdBld, TI_UINT8 apSlotTime, void *fCb, TI_HANDLE hCb)                                
+{
+    TCmdBld    *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXSlot_t   AcxElm_SlotTime;
+    ACXSlot_t   *pCfg = &AcxElm_SlotTime;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_SLOT;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* Set configuration fields */
+    /* woneIndex is not relevant to station implementation */
+    pCfg->woneIndex = STATION_WONE_INDEX;
+    pCfg->slotTime = apSlotTime;
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, Slot Time = %d\n", (TI_UINT8)pCfg->slotTime);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIePreamble()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the Preamble
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIePreamble (TI_HANDLE hCmdBld, TI_UINT8 preamble, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXPreamble_t   AcxElm_Preamble;
+    ACXPreamble_t   *pCfg = &AcxElm_Preamble;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_PREAMBLE_TYPE;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* Set configuration fields */
+    /* woneIndex is not relevant to station implementation */
+    pCfg->preamble = preamble;
+
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: preamble=%u\n", pCfg->EleHdr.id, preamble);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeRx()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate RxConfig information element
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeRx (TI_HANDLE hCmdBld, TI_UINT32 apRxConfigOption, TI_UINT32 apRxFilterOption, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXRxConfig_t   AcxElm_RxConfig;
+    ACXRxConfig_t  *pCfg = &AcxElm_RxConfig;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_RX_CFG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* Set configuration fields */
+    pCfg->ConfigOptions = ENDIAN_HANDLE_LONG(apRxConfigOption);
+    pCfg->FilterOptions = ENDIAN_HANDLE_LONG(apRxFilterOption);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+*                 cmdBld_CfgIeEnableRxDataFilter()
+*****************************************************************************
+* DESCRIPTION: Enables or disables Rx data filtering.
+*
+* INPUTS:  enabled             - 0 to disable data filtering, any other value to enable 
+*          defaultAction       - The default action to take on non-matching packets.
+*
+* OUTPUT:  None
+*
+* RETURNS: TI_OK or TI_NOK
+****************************************************************************/
+TI_STATUS cmdBld_CfgIeEnableRxDataFilter (TI_HANDLE hCmdBld, TI_BOOL enabled, filter_e defaultAction, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
+    DataFilterDefault_t dataFilterDefault;
+    DataFilterDefault_t * pCfg = &dataFilterDefault;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_ENABLE_RX_DATA_FILTER;
+    pCfg->EleHdr.len = 0;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Rx Data Filter configuration:\n");
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": enabled = %d, defaultAction = %d\n", enabled, defaultAction);
+
+    /* Set information element configuration fields */
+    pCfg->enable = enabled;
+    pCfg->action = defaultAction;
+    pCfg->EleHdr.len += sizeof(pCfg->enable) + sizeof(pCfg->action);
+
+    TRACE_INFO_HEX(pCmdBld->hReport, (TI_UINT8 *) pCfg, sizeof(dataFilterDefault));
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+*                      cmdBld_CfgIeRxDataFilter()
+*****************************************************************************
+* DESCRIPTION: Add/remove Rx Data filter information element.
+*
+* INPUTS:  index               - Index of the Rx Data filter
+*          command             - Add or remove the filter
+*          action              - Action to take on packets matching the pattern
+*          numFieldPatterns    - Number of field patterns in the filter
+*          lenFieldPatterns    - Length of the field pattern series
+*          fieldPatterns       - Series of field patterns
+*
+* OUTPUT:  None
+*
+* RETURNS: TI_OK or TI_NOK
+****************************************************************************/
+TI_STATUS cmdBld_CfgIeRxDataFilter (TI_HANDLE hCmdBld, 
+                                    TI_UINT8 index, 
+                                    TI_UINT8 command, 
+                                    filter_e action, 
+                                    TI_UINT8 numFieldPatterns, 
+                                    TI_UINT8 lenFieldPatterns, 
+                                    TI_UINT8 *pFieldPatterns, 
+                                    void *fCb, 
+                                    TI_HANDLE hCb)
+{
+    TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8 dataFilterConfig[sizeof(DataFilterConfig_t) + MAX_DATA_FILTER_SIZE];
+    DataFilterConfig_t * pCfg = (DataFilterConfig_t *) &dataFilterConfig;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_SET_RX_DATA_FILTER;
+    pCfg->EleHdr.len = 0;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Rx Data Filter configuration:\n");
+    TRACE5(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": command = %d, index = %d, action = %d, numFieldPatterns = %d, lenFieldPatterns = %d\n", command, index, action, numFieldPatterns, lenFieldPatterns);
+
+    /* Set information element configuration fields */
+    pCfg->command = command;
+    pCfg->index = index;
+    pCfg->EleHdr.len += sizeof(pCfg->command) + sizeof(pCfg->index);
+
+    /* When removing a filter only the index and command are to be sent */
+    if (command == ADD_FILTER)
+    {
+        pCfg->action = action;
+        pCfg->numOfFields = numFieldPatterns;
+        pCfg->EleHdr.len += sizeof(pCfg->action) + sizeof(pCfg->numOfFields);
+
+        if (pFieldPatterns == NULL)
+        {
+            TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, ": Null pattern table argument received!\n");
+
+            return PARAM_VALUE_NOT_VALID;
+        }
+
+        os_memoryCopy(pCmdBld->hOs, &pCfg->FPTable, pFieldPatterns, lenFieldPatterns);
+        pCfg->EleHdr.len += lenFieldPatterns;
+    }
+
+    TRACE_INFO_HEX(pCmdBld->hReport, (TI_UINT8 *) pCfg, sizeof(dataFilterConfig));
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(dataFilterConfig), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgIeArpIpFilter()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate ARP addr table information element for
+ *              ipV4 only
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeArpIpFilter (TI_HANDLE hCmdBld, 
+                                   TIpAddr   tIpAddr,
+                                   TI_BOOL   bFilteringEnabled, 
+                                   void      *fCb, 
+                                   TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXConfigureIP_t AcxElm_CmdConfigureIP;
+    ACXConfigureIP_t *pCfg = &AcxElm_CmdConfigureIP;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_ARP_IP_FILTER;
+    pCfg->EleHdr.len = sizeof(ACXConfigureIP_t) - sizeof(EleHdrStruct);
+
+    pCfg->arpFilterEnable = (TI_UINT32)bFilteringEnabled;
+        
+    /* IP address */
+    /* Note that in the case of IPv4 it is assumed that the extra two bytes are zero */
+    IP_COPY (pCfg->address, tIpAddr);
+
+    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: ip=%x, enable=%u\n", pCfg->EleHdr.id, *((TI_UINT32*)pCfg->address), bFilteringEnabled);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXConfigureIP_t), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeGroupAdressTable()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate Group addr table information element
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeGroupAdressTable (TI_HANDLE       hCmdBld, 
+                                        TI_UINT8        numGroupAddrs, 
+                                        TMacAddr        *pGroupAddr, 
+                                        TI_BOOL         bEnabled, 
+                                        void            *fCb, 
+                                        TI_HANDLE       hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT32   i = 0;
+    TI_UINT8   *tmpLoc = NULL;
+    dot11MulticastGroupAddrStart_t  AcxElm_CmdConfigureMulticastIp;
+    dot11MulticastGroupAddrStart_t* pCfg = &AcxElm_CmdConfigureMulticastIp;
+      
+    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(dot11MulticastGroupAddrStart_t));
+
+    /* Set information element header */
+    pCfg->EleHdr.id = DOT11_GROUP_ADDRESS_TBL;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+     
+    pCfg->numOfGroups = numGroupAddrs;
+    pCfg->fltrState = bEnabled;
+    tmpLoc = pCfg->dataLocation;
+        
+    if (NULL != pGroupAddr)
+    {
+        for (i = 0; i < numGroupAddrs; i++) 
+        {
+            MAC_COPY (&tmpLoc[MAC_ADDR_LEN * i], *(pGroupAddr + i));
+
+            TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeGroupAdressTable: MAC %x: %x:%x:%x:%x:%x:%x\n", i, tmpLoc[MAC_ADDR_LEN*i+0] , tmpLoc[MAC_ADDR_LEN*i+1] , tmpLoc[MAC_ADDR_LEN*i+2] , tmpLoc[MAC_ADDR_LEN*i+3] , tmpLoc[MAC_ADDR_LEN*i+4] , tmpLoc[MAC_ADDR_LEN*i+5]);
+        }
+    }
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(dot11MulticastGroupAddrStart_t), fCb, hCb, NULL);
+    
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeSgEnable()
+ ****************************************************************************
+ * DESCRIPTION: Enable/Disable the BTH-WLAN  
+ *
+ * INPUTS:  Enable flag
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeSgEnable (TI_HANDLE hCmdBld, ESoftGeminiEnableModes SoftGeminiEnableModes, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXBluetoothWlanCoEnableStruct  AcxElm_BluetoothWlanEnable;
+    ACXBluetoothWlanCoEnableStruct* pCfg = &AcxElm_BluetoothWlanEnable;
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSgEnable: Enable flag = %d\n", SoftGeminiEnableModes);
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_SG_ENABLE;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* Set enable field */
+    pCfg->coexOperationMode = (TI_UINT8)SoftGeminiEnableModes;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeSg()
+ ****************************************************************************
+ * DESCRIPTION: Configure the BTH-WLAN co-exsistance   
+ *
+ * INPUTS:  Configuration structure pointer 
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeSg (TI_HANDLE hCmdBld, TSoftGeminiParams *pSoftGeminiParam, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXBluetoothWlanCoParamsStruct  AcxElm_BluetoothWlanEnable;
+    ACXBluetoothWlanCoParamsStruct *pCfg = &AcxElm_BluetoothWlanEnable;
+	int i=0;
+    
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSg. \n");
+
+    /* Set information element header */
+    pCfg->EleHdr.id      		= ACX_SG_CFG;
+    pCfg->EleHdr.len     		= sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+	pCfg->softGeminiParams.paramIdx = pSoftGeminiParam->paramIdx;
+
+
+	for (i=0; i< SOFT_GEMINI_PARAMS_MAX ; i++)
+	{
+		pCfg->softGeminiParams.coexParams[i] = pSoftGeminiParam->coexParams[i];
+	}
+	
+    /* Rate conversion is done in the HAL */
+    pCfg->softGeminiParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH] = rateNumberToBitmap((TI_UINT8)pSoftGeminiParam->coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH]);
+
+	if (pCfg->softGeminiParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH] == 0)
+    {
+        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "coexAPRateAdapationThr is 0, convert to 1MBPS. \n");
+        pCfg->softGeminiParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH] = HW_BIT_RATE_1MBPS;
+    }
+
+     /* Send the configuration command */
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeFmCoex()
+ ****************************************************************************
+ * DESCRIPTION: Configure the FM-WLAN co-exsistance parameters  
+ *
+ * INPUTS:  Configuration structure pointer 
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeFmCoex (TI_HANDLE hCmdBld, TFmCoexParams *pFmCoexParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXWlanFmCoexStruct  tFmWlanCoex;
+    ACXWlanFmCoexStruct *pCfg = &tFmWlanCoex;
+    
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeFmCoex\n");
+
+    /* Set information element header */
+    pCfg->EleHdr.id  = ACX_FM_COEX_CFG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* Set parameters with endianess handling */
+    pCfg->enable                   = pFmCoexParams->uEnable;                   
+    pCfg->swallowPeriod            = pFmCoexParams->uSwallowPeriod;            
+    pCfg->nDividerFrefSet1         = pFmCoexParams->uNDividerFrefSet1;         
+    pCfg->nDividerFrefSet2         = pFmCoexParams->uNDividerFrefSet2;         
+    pCfg->mDividerFrefSet1         = ENDIAN_HANDLE_WORD(pFmCoexParams->uMDividerFrefSet1);         
+    pCfg->mDividerFrefSet2         = ENDIAN_HANDLE_WORD(pFmCoexParams->uMDividerFrefSet2);         
+    pCfg->coexPllStabilizationTime = ENDIAN_HANDLE_LONG(pFmCoexParams->uCoexPllStabilizationTime); 
+    pCfg->ldoStabilizationTime     = ENDIAN_HANDLE_WORD(pFmCoexParams->uLdoStabilizationTime);     
+    pCfg->fmDisturbedBandMargin    = pFmCoexParams->uFmDisturbedBandMargin;    
+    pCfg->swallowClkDif            = pFmCoexParams->uSwallowClkDif;    
+
+	/* Send the configuration command */
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeMemoryMap ()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate MemoryMap information element
+ *
+ * INPUTS:
+ *      AcxElm_MemoryMap_T *apMap   pointer to the memory map structure
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeMemoryMap (TI_HANDLE hCmdBld, MemoryMap_t *apMap, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    MemoryMap_t SwapMap;
+    TI_UINT32 *pSwap, *pOrig, i, uMemMapNumFields;
+
+    /* Set information element header */
+    SwapMap.EleHdr.id  = ACX_MEM_MAP;
+    SwapMap.EleHdr.len = sizeof(MemoryMap_t) - sizeof(EleHdrStruct);
+
+    /* Solve endian problem (all fields are 32 bit) */
+    pOrig = (TI_UINT32* )&apMap->codeStart;
+    pSwap = (TI_UINT32* )&SwapMap.codeStart;
+    uMemMapNumFields = (sizeof(MemoryMap_t) - sizeof(EleHdrStruct)) % 4;
+    for (i = 0; i < uMemMapNumFields; i++)
+        pSwap[i] = ENDIAN_HANDLE_LONG(pOrig[i]);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, &SwapMap, sizeof(SwapMap), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeAid()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the AID info element
+ *
+ * INPUTS:
+ *      TI_UINT16* apAidVal     The AID value
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeAid (TI_HANDLE hCmdBld, TI_UINT16 apAidVal, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXAid_t    WlanElm_AID;
+    ACXAid_t    *pCfg = &WlanElm_AID;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_AID;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->Aid = ENDIAN_HANDLE_WORD(apAidVal);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeWakeUpCondition()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the power management option
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeWakeUpCondition (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    WakeUpCondition_t WakeUpCondition;
+    WakeUpCondition_t *pCfg = &WakeUpCondition;
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "WakeUpCondition :\n                             listenInterval = 0x%X\n", pPMConfig->listenInterval);
+
+    switch (pPMConfig->tnetWakeupOn)
+    {
+        case TNET_WAKE_ON_BEACON:
+            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_BEACON_BITMAP;
+            break;
+        case TNET_WAKE_ON_DTIM:
+            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_DTIM_BITMAP;
+            break;
+        case TNET_WAKE_ON_N_BEACON:
+            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_N_BEACONS_BITMAP;
+            break;
+        case TNET_WAKE_ON_N_DTIM:
+            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_N_DTIM_BITMAP;
+            break;
+        default:
+            pCfg->wakeUpConditionBitmap = WAKE_UP_EVENT_BEACON_BITMAP;
+            break;
+    }
+
+    pCfg->listenInterval = pPMConfig->listenInterval;
+
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " cmdBld_wakeUpCondition  tnetWakeupOn=0x%x listenInterval=%d\n",pCfg->wakeUpConditionBitmap,pCfg->listenInterval);
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_WAKE_UP_CONDITIONS;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeSleepAuth()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the power management option
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeSleepAuth (TI_HANDLE hCmdBld, EPowerPolicy eMinPowerLevel, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXSleepAuth_t ACXSleepAuth;
+    ACXSleepAuth_t *pCfg = &ACXSleepAuth;
+    EElpCtrlMode eElpCtrlMode;
+    TI_STATUS status;
+    TI_BOOL bSendSleep = TI_FALSE;
+
+    /* Set the ELP control according to the new power policy */
+    switch (eMinPowerLevel) 
+    {
+    case POWERAUTHO_POLICY_AWAKE:   eElpCtrlMode = ELPCTRL_MODE_KEEP_AWAKE;  break;
+    case POWERAUTHO_POLICY_PD:      eElpCtrlMode = ELPCTRL_MODE_KEEP_AWAKE;  break;
+    case POWERAUTHO_POLICY_ELP:     eElpCtrlMode = ELPCTRL_MODE_NORMAL;      break;
+    default:
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, " - Param value is not supported, %d\n", eMinPowerLevel);
+        return TI_NOK;
+
+    }
+
+    /* Set the ELP mode only if there is a change */
+    if (pCmdBld->uLastElpCtrlMode != eElpCtrlMode)
+    {
+        pCmdBld->uLastElpCtrlMode = eElpCtrlMode;
+		if (eElpCtrlMode == ELPCTRL_MODE_KEEP_AWAKE)
+		{
+			twIf_Awake(pCmdBld->hTwIf);
+		}
+		else
+		{
+            /* Remeber to change HW to sleep mode */
+            bSendSleep = TI_TRUE;
+		}
+    }
+
+    /* In the info element the enums are in reverse */
+    switch (eMinPowerLevel)
+    {
+        case POWERAUTHO_POLICY_ELP:
+            pCfg->sleepAuth = 2;
+            break;
+        case POWERAUTHO_POLICY_AWAKE:
+            pCfg->sleepAuth = 0;
+            break;
+        default:
+            pCfg->sleepAuth = eMinPowerLevel;
+    }
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " cmdBld_MinPowerLevelSet  sleepAuth=%d\n", eMinPowerLevel);
+
+    /* Set information element header*/
+    pCfg->EleHdr.id = ACX_SLEEP_AUTH;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    status = cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+
+    if (bSendSleep) {
+        twIf_Sleep(pCmdBld->hTwIf);
+    }
+
+    return status;
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeBcnBrcOptions()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the power management option
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeBcnBrcOptions (TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXBeaconAndBroadcastOptions_t ACXBeaconAndBroadcastOptions;
+    ACXBeaconAndBroadcastOptions_t *pCfg = &ACXBeaconAndBroadcastOptions;
+
+    pCfg->beaconRxTimeOut = pPMConfig->BcnBrcOptions.BeaconRxTimeout;
+    pCfg->broadcastTimeOut = pPMConfig->BcnBrcOptions.BroadcastRxTimeout;
+    pCfg->rxBroadcastInPS = pPMConfig->BcnBrcOptions.RxBroadcastInPs;
+	pCfg->consecutivePsPollDeliveryFailureThr = pPMConfig->ConsecutivePsPollDeliveryFailureThreshold;
+
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " cmdBld_BcnBrcOptions  BeaconRxTimeout=%d BroadcastRxTimeout=%d RxBroadcastInPs=0x%x, consecutivePsPollDeliveryFailureThr=%d\n",							 pCfg->beaconRxTimeOut,pCfg->broadcastTimeOut,							 pCfg->rxBroadcastInPS, pCfg->consecutivePsPollDeliveryFailureThr);
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_BCN_DTIM_OPTIONS;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeFeatureConfig()
+                                    ACXBeaconAndBroadcastOptions_t* pWlanElm_BcnBrcOptions,
+ ****************************************************************************
+ * DESCRIPTION: Configure the feature config info element
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeFeatureConfig (TI_HANDLE hCmdBld, TI_UINT32 options, TI_UINT32 uDataFlowOptions, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXFeatureConfig_t  WlanElm_FeatureConfig;
+    ACXFeatureConfig_t  *pCfg = &WlanElm_FeatureConfig;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_FEATURE_CFG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* Set fields */
+    pCfg->Options = ENDIAN_HANDLE_LONG(options);
+    pCfg->dataflowOptions = ENDIAN_HANDLE_LONG(uDataFlowOptions);
+
+    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: option=0x%x, def.option=0x%x\n", pCfg->EleHdr.id, options, uDataFlowOptions);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeTxPowerDbm ()
+ ****************************************************************************
+ * DESCRIPTION: Set the Tx power in Dbm units.
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeTxPowerDbm (TI_HANDLE hCmdBld, TI_UINT8 uTxPowerDbm , void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    dot11CurrentTxPowerStruct dot11CurrentTxPower;
+    dot11CurrentTxPowerStruct *pCfg = &dot11CurrentTxPower;
+
+   TRACE1( pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " uTxPowerDbm = %d\n", uTxPowerDbm);
+
+
+    /* Set information element header*/
+    pCfg->EleHdr.id = DOT11_CUR_TX_PWR;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->dot11CurrentTxPower = uTxPowerDbm;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeStatisitics ()
+ ****************************************************************************
+ * DESCRIPTION: Set the ACX statistics counters to zero.
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeStatisitics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXStatistics_t  acx;
+    ACXStatistics_t  *pCfg = &acx;
+
+    /* Set information element header */
+    pCfg->EleHdr.id  = ACX_STATISTICS;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeTid()
+ ****************************************************************************
+ * DESCRIPTION: Write the Queue configuration (For Quality Of Service)
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeTid (TI_HANDLE hCmdBld, TQueueTrafficParams* pQtrafficParams, void *fCb, TI_HANDLE hCb)
+                                          
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXTIDConfig_t    TrafficCategoryCfg;
+    ACXTIDConfig_t   *pCfg = &TrafficCategoryCfg;
+
+    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
+
+    /*
+     * Set information element header
+     * ==============================
+     */
+    pCfg->EleHdr.id = ACX_TID_CFG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /*
+     * Set information element Data
+     * ==============================
+     */
+    pCfg->queueID       = pQtrafficParams->queueID;
+    pCfg->channelType   = pQtrafficParams->channelType;
+    pCfg->tsid          = pQtrafficParams->tsid;
+    pCfg->psScheme      = pQtrafficParams->psScheme; 
+    pCfg->APSDConf[0]   = pQtrafficParams->APSDConf[0];
+    pCfg->APSDConf[1]   = pQtrafficParams->APSDConf[1];
+
+    TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: queue-id=%u, chan-type=%u, tsid=%u, ps-scheme=%u, apsd-1=0x%x, apsd-2=0x%x\n", pCfg->EleHdr.id, pCfg->queueID, pCfg->channelType, pCfg->tsid, pCfg->psScheme, pCfg->APSDConf[0], pCfg->APSDConf[1]);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeAcParams()
+ ****************************************************************************
+ * DESCRIPTION: Write the AC configuration (For Quality Of Service)
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeAcParams (TI_HANDLE hCmdBld, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXAcCfg_t     AcCfg;
+    ACXAcCfg_t    *pCfg  = &AcCfg;
+
+    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
+
+    /*
+     * Set information element header
+     * ==============================
+     */
+    pCfg->EleHdr.id = ACX_AC_CFG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /*
+     * Set information element Data
+     * ==============================
+     */
+
+    pCfg->ac        = pAcQosParams->ac;
+    pCfg->aifsn     = pAcQosParams->aifsn;
+    pCfg->cwMax     = ENDIAN_HANDLE_WORD(pAcQosParams->cwMax);
+    pCfg->cwMin     = pAcQosParams->cwMin;
+    pCfg->txopLimit = ENDIAN_HANDLE_WORD(pAcQosParams->txopLimit);
+
+    TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: ac= %u, aifsn=%u, cw-max=%u, cw-min=%u, txop=%u\n", pCfg->EleHdr.id, pAcQosParams->ac, pAcQosParams->aifsn, pAcQosParams->cwMax, pAcQosParams->cwMin, pAcQosParams->txopLimit);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIePsRxStreaming()
+ ****************************************************************************
+ * DESCRIPTION: Write the AC PS-Rx-Streaming
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIePsRxStreaming (TI_HANDLE hCmdBld, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXPsRxStreaming_t  tStreamingCfg;
+    ACXPsRxStreaming_t *pCfg  = &tStreamingCfg;
+
+    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
+
+    /*
+     * Set information element header
+     * ==============================
+     */
+    pCfg->EleHdr.id = ACX_PS_RX_STREAMING;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /*
+     * Set information element Data
+     * ============================
+     */
+    pCfg->TID          = (TI_UINT8)pPsRxStreaming->uTid;
+    pCfg->rxPSDEnabled = (TI_UINT8)pPsRxStreaming->bEnabled;
+    pCfg->streamPeriod = (TI_UINT8)pPsRxStreaming->uStreamPeriod;
+    pCfg->txTimeout    = (TI_UINT8)pPsRxStreaming->uTxTimeout;
+
+    TRACE5(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "ID=%u: tid= %u, enable=%u, streamPeriod=%u, txTimeout=%u\n", pCfg->EleHdr.id, pCfg->TID, pCfg->rxPSDEnabled, pCfg->streamPeriod, pCfg->txTimeout);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIePacketDetectionThreshold()
+ ****************************************************************************
+ * DESCRIPTION:  Set the PacketDetection threshold
+ *
+ * INPUTS:  
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIePacketDetectionThreshold (TI_HANDLE hCmdBld, TI_UINT32 pdThreshold, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXPacketDetection_t  PacketDetectionThresholdCfg;
+    ACXPacketDetection_t *pCfg = &PacketDetectionThresholdCfg;
+
+    /*
+     * Set information element header
+     * ==============================
+     */
+    pCfg->EleHdr.id = ACX_PD_THRESHOLD;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /*
+     * Set information element Data
+     * ==============================
+     */
+    pCfg->pdThreshold = ENDIAN_HANDLE_LONG(pdThreshold);
+
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": pdThreshold = 0x%x , len = 0x%x \n",pCfg->pdThreshold,pCfg->EleHdr.len);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeBeaconFilterOpt()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the beacon filtering option
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeBeaconFilterOpt (TI_HANDLE hCmdBld, TI_UINT8 beaconFilteringStatus, TI_UINT8 numOfBeaconsToBuffer, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXBeaconFilterOptions_t  ACXBeaconFilterOptions;
+    ACXBeaconFilterOptions_t *pCfg = &ACXBeaconFilterOptions;
+    
+    pCfg->enable = beaconFilteringStatus;
+    pCfg->maxNumOfBeaconsStored = numOfBeaconsToBuffer;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_BEACON_FILTER_OPT;
+    pCfg->EleHdr.len = sizeof(ACXBeaconFilterOptions_t) - sizeof(EleHdrStruct);
+
+    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: enable=%u, num-stored=%u\n", pCfg->EleHdr.id, beaconFilteringStatus, numOfBeaconsToBuffer);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXBeaconFilterOptions_t), fCb, hCb, NULL);
+}
+/****************************************************************************
+ *                      cmdBld_CfgIeRateMngDbg()
+ ****************************************************************************
+ * DESCRIPTION: Configure the rate managment params
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+
+TI_STATUS cmdBld_CfgIeRateMngDbg (TI_HANDLE hCmdBld, RateMangeParams_t *pRateMngParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    AcxRateAdaptParams  RateMng;    
+    AcxRateAdaptParams *pCfg = &RateMng;
+	int i;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_SET_RATE_MAMAGEMENT_PARAMS;
+    pCfg->EleHdr.len = sizeof(AcxRateMangeParams) - sizeof(EleHdrStruct);
+
+    
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u, index=%d \n",pCfg->EleHdr.id,pRateMngParams->paramIndex);
+
+	pCfg->paramIndex = pRateMngParams->paramIndex;
+
+	pCfg->InverseCuriosityFactor[0] = pRateMngParams->InverseCuriosityFactor[0];
+    pCfg->InverseCuriosityFactor[1] = pRateMngParams->InverseCuriosityFactor[1];
+    pCfg->MaxPer = pRateMngParams->MaxPer;
+	pCfg->PerAdd = pRateMngParams->PerAdd;
+	pCfg->PerAddShift = pRateMngParams->PerAddShift;
+	pCfg->PerAlphaShift = pRateMngParams->PerAlphaShift;
+	pCfg->PerBeta1Shift = pRateMngParams->PerBeta1Shift;
+	pCfg->PerBeta2Shift = pRateMngParams->PerBeta2Shift;
+	pCfg->PerTh1 = pRateMngParams->PerTh1;
+	pCfg->PerTh2 = pRateMngParams->PerTh2;
+	pCfg->RateCheckDown = pRateMngParams->RateCheckDown;
+	pCfg->RateCheckUp = pRateMngParams->RateCheckUp;
+	pCfg->RateRetryScore = pRateMngParams->RateRetryScore;
+	pCfg->TxFailHighTh = pRateMngParams->TxFailHighTh;
+	pCfg->TxFailLowTh = pRateMngParams->TxFailLowTh;
+    pCfg->PerWeightShift[0] = pRateMngParams->PerWeightShift[0];
+    pCfg->PerWeightShift[1] = pRateMngParams->PerWeightShift[1];
+    pCfg->TpWeightShift[0] = pRateMngParams->TpWeightShift[0];
+    pCfg->TpWeightShift[1] = pRateMngParams->TpWeightShift[1];
+    
+	for (i=0 ; i< 13 ; i++)
+	{
+		pCfg->RateRetryPolicy[i] = pRateMngParams->RateRetryPolicy[i];
+	}
+   
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(AcxRateMangeParams), fCb, hCb, NULL);
+}
+
+
+
+/****************************************************************************
+ *                     cmdBld_CfgIeBeaconFilterTable
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the beacon filter IE table
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeBeaconFilterTable (TI_HANDLE hCmdBld,
+                                         TI_UINT8   uNumberOfIEs, 
+                                         TI_UINT8  *pIETable,
+                                         TI_UINT8   uIETableSize, 
+                                         void      *fCb, 
+                                         TI_HANDLE  hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXBeaconFilterIETable_t beaconFilterIETableStruct;
+    ACXBeaconFilterIETable_t *pCfg = &beaconFilterIETableStruct;
+    TI_UINT32 counter;
+    
+    if (NULL == pIETable) 
+    {
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    pCfg->EleHdr.id = ACX_BEACON_FILTER_TABLE;
+    pCfg->EleHdr.len = uIETableSize + 1; 
+    pCfg->NumberOfIEs = uNumberOfIEs;
+        
+    os_memoryZero (pCmdBld->hOs, (void *)pCfg->IETable, BEACON_FILTER_TABLE_MAX_SIZE);
+    os_memoryCopy (pCmdBld->hOs, (void *)pCfg->IETable, (void *)pIETable, uIETableSize);
+        
+    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: num-ie=%u, table-size=%u\n", pCfg->EleHdr.id, uNumberOfIEs, uIETableSize);
+
+TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Beacon IE Table:\n");
+    for (counter = 0; counter < uIETableSize; counter++)
+    {
+TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "%2x ", pIETable[counter]);
+	}
+TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "\n");
+        
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXBeaconFilterIETable_t), fCb, hCb, NULL);
+}
+ 
+/****************************************************************************
+ *                     cmdBld_CfgCoexActivity
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the Coex activity IE 
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeCoexActivity (TI_HANDLE hCmdBld,
+                                         TCoexActivity  *pCoexActivity,
+                                         void      *fCb, 
+                                         TI_HANDLE  hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXCoexActivityIE_t coexActivityIEStruct;
+    ACXCoexActivityIE_t *pCfg = &coexActivityIEStruct;
+    
+    if (NULL == pCoexActivity) 
+    {
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    pCfg->EleHdr.id = ACX_COEX_ACTIVITY;
+    pCfg->EleHdr.len = sizeof(ACXCoexActivityIE_t) - sizeof(EleHdrStruct);
+        
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "CoexActivity: ID=0x%x\n", pCfg->EleHdr.id);
+
+    pCfg->coexIp          = pCoexActivity->coexIp;
+    pCfg->activityId      = pCoexActivity->activityId;
+    pCfg->defaultPriority = pCoexActivity->defaultPriority;
+    pCfg->raisedPriority  = pCoexActivity->raisedPriority;
+    pCfg->minService      = ENDIAN_HANDLE_WORD(pCoexActivity->minService);
+    pCfg->maxService      = ENDIAN_HANDLE_WORD(pCoexActivity->maxService);
+
+    TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "CoexActivity: 0x%02x 0x%02x - 0x%02x 0x%02x 0x%04x 0x%04x\n", 
+            pCfg->coexIp,
+            pCfg->activityId,
+            pCfg->defaultPriority,
+            pCfg->raisedPriority,
+            pCfg->minService,
+            pCfg->maxService);
+ 
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgIeCcaThreshold()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the Slot Time
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeCcaThreshold (TI_HANDLE hCmdBld, TI_UINT16 ccaThreshold, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXEnergyDetection_t AcxElm_CcaThreshold;
+    ACXEnergyDetection_t *pCfg = &AcxElm_CcaThreshold;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_CCA_THRESHOLD;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+    
+    pCfg->rxCCAThreshold = ENDIAN_HANDLE_WORD(ccaThreshold);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeEventMask()
+ ****************************************************************************
+ * DESCRIPTION: Change the Event Vector Mask in the FW
+ * 
+ * INPUTS: MaskVector   The Updated Vector Mask
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeEventMask (TI_HANDLE hCmdBld, TI_UINT32 mask, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    ACXEventMboxMask_t EventMboxData;
+    ACXEventMboxMask_t *pCfg = &EventMboxData;
+
+    /* Set information element header*/
+    pCfg->EleHdr.id = ACX_EVENT_MBOX_MASK; 
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+    pCfg->lowEventMask = ENDIAN_HANDLE_LONG(mask);
+    pCfg->highEventMask = ENDIAN_HANDLE_LONG(0xffffffff); /* Not in Use */
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgIeEventMask:\n");
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeMaxTxRetry()
+ ****************************************************************************
+ * DESCRIPTION: Configure the Max Tx Retry parameters
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeMaxTxRetry (TI_HANDLE hCmdBld,
+                                  TRroamingTriggerParams *pRoamingTriggerCmd,
+                                  void      *fCb, 
+                                  TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXConsTxFailureTriggerParameters_t AcxElm_SetMaxTxRetry;
+    ACXConsTxFailureTriggerParameters_t* pCfg = &AcxElm_SetMaxTxRetry;
+
+    pCfg->maxTxRetry = pRoamingTriggerCmd->maxTxRetry;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_CONS_TX_FAILURE;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+    
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeConnMonitParams()
+ ****************************************************************************
+ * DESCRIPTION: Configure the Bss Lost Timeout & TSF miss threshold
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeConnMonitParams (TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb)                                           
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    AcxConnectionMonitorOptions  AcxElm_SetBssLossTsfThreshold;
+    AcxConnectionMonitorOptions* pCfg = &AcxElm_SetBssLossTsfThreshold;
+
+    pCfg->BSSLossTimeout     = ENDIAN_HANDLE_LONG(pRoamingTriggerCmd->BssLossTimeout);
+    pCfg->TSFMissedThreshold = ENDIAN_HANDLE_LONG(pRoamingTriggerCmd->TsfMissThreshold);
+
+    /* Set information element header */
+    pCfg->EleHdr.id  = ACX_CONN_MONIT_PARAMS;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+    
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeTxRatePolicy()
+ ****************************************************************************
+ * DESCRIPTION: Write the TxRateClass configuration 
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeTxRatePolicy (TI_HANDLE hCmdBld, TTxRatePolicy *pTxRatePolicy, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXTxAttrClasses_t  TxClassCfg;
+    ACXTxAttrClasses_t *pCfg  = &TxClassCfg;
+    TI_UINT8 PolicyId;
+    
+    os_memoryZero (pCmdBld->hOs, (void *)pCfg, sizeof(*pCfg));
+
+    /*
+     * Set information element header
+     * ==============================
+     */
+    pCfg->EleHdr.id = ACX_RATE_POLICY;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+    pCfg->numOfClasses = pTxRatePolicy->numOfRateClasses;
+
+    for (PolicyId = 0; PolicyId < pTxRatePolicy->numOfRateClasses; PolicyId++)
+    {
+        os_memoryCopy (pCmdBld->hOs,
+                       (void *)&(pCfg->rateClasses[PolicyId]),
+                       (void *)&(pTxRatePolicy->rateClass[PolicyId]),
+                       sizeof(TTxRateClass));
+    }
+    
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeRtsThreshold()
+ ****************************************************************************
+ * DESCRIPTION: Configure the RTS threshold
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeRtsThreshold (TI_HANDLE hCmdBld, TI_UINT16 uRtsThreshold, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    dot11RTSThreshold_t AcxElm_RtsThreshold;
+    dot11RTSThreshold_t *pCfg = &AcxElm_RtsThreshold;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = DOT11_RTS_THRESHOLD;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->RTSThreshold = ENDIAN_HANDLE_WORD(uRtsThreshold);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeRtsThreshold()
+ ****************************************************************************
+ * DESCRIPTION: Configure the tx fragmentation threshold
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeFragmentThreshold (TI_HANDLE hCmdBld, TI_UINT16 uFragmentThreshold, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXFRAGThreshold_t AcxElm_FragmentThreshold;
+    ACXFRAGThreshold_t *pCfg = &AcxElm_FragmentThreshold;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_FRAG_CFG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->fragThreshold = ENDIAN_HANDLE_WORD(uFragmentThreshold);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIePmConfig()
+ ****************************************************************************
+ * DESCRIPTION: Configure PM parameters
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIePmConfig (TI_HANDLE   hCmdBld, 
+                                TI_UINT32   uHostClkSettlingTime,
+                                TI_UINT8    uHostFastWakeupSupport, 
+                                void *      fCb, 
+                                TI_HANDLE   hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXPMConfig_t tPmConfig;
+    ACXPMConfig_t *pCfg = &tPmConfig;
+
+    /* Set information element header*/
+    pCfg->EleHdr.id  = ACX_PM_CONFIG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->hostClkSettlingTime   = uHostClkSettlingTime;
+    pCfg->hostFastWakeupSupport = uHostFastWakeupSupport;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeTxCmpltPacing()
+ ****************************************************************************
+ * DESCRIPTION: Configure Tx-Complete interrupt pacing to FW
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeTxCmpltPacing (TI_HANDLE  hCmdBld,
+                                     TI_UINT16  uTxCompletePacingThreshold,
+                                     TI_UINT16  uTxCompletePacingTimeout,
+                                     void *     fCb, 
+                                     TI_HANDLE  hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXTxConfigOptions_t  tTxCmpltPacing;
+    ACXTxConfigOptions_t  *pCfg = &tTxCmpltPacing;
+
+    /* Set information element header */
+    pCfg->EleHdr.id  = ACX_TX_CONFIG_OPT;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->txCompleteThreshold = ENDIAN_HANDLE_WORD(uTxCompletePacingThreshold);
+    pCfg->txCompleteTimeout   = ENDIAN_HANDLE_WORD(uTxCompletePacingTimeout);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeRxIntrPacing()
+ ****************************************************************************
+ * DESCRIPTION: Configure Rx-Complete interrupt pacing to FW
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeRxIntrPacing (TI_HANDLE  hCmdBld,
+                                    TI_UINT16  uRxIntrPacingThreshold,
+                                    TI_UINT16  uRxIntrPacingTimeout,
+                                    void *     fCb, 
+                                    TI_HANDLE  hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXRxBufferingConfig_t  tRxIntrPacing;
+    ACXRxBufferingConfig_t  *pCfg = &tRxIntrPacing;
+
+    /* Set information element header */
+    pCfg->EleHdr.id  = ACX_RX_CONFIG_OPT;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->rxPktThreshold    = ENDIAN_HANDLE_WORD(uRxIntrPacingThreshold);
+    pCfg->rxCompleteTimeout = ENDIAN_HANDLE_WORD(uRxIntrPacingTimeout);
+    pCfg->rxMblkThreshold   = ENDIAN_HANDLE_WORD(0xFFFF);    /* Set to maximum so it has no effect (only the PktThreshold is used) */
+    pCfg->rxQueueType       = RX_QUEUE_TYPE_RX_LOW_PRIORITY; /* Only low priority data packets are buffered */
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+*                      cmdBld_CfgIeCtsProtection()
+ ****************************************************************************
+ * DESCRIPTION: Configure The Cts to self feature
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeCtsProtection (TI_HANDLE hCmdBld, TI_UINT8 ctsProtection, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXCtsProtection_t AcxElm_CtsToSelf;
+    ACXCtsProtection_t *pCfg = &AcxElm_CtsToSelf;
+
+    /* Set information element header*/
+    pCfg->EleHdr.id = ACX_CTS_PROTECTION;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->ctsProtectMode = ctsProtection;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeRxMsduLifeTime()
+ ****************************************************************************
+ * DESCRIPTION: Configure The Cts to self feature
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeRxMsduLifeTime (TI_HANDLE hCmdBld, TI_UINT32 RxMsduLifeTime, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    dot11RxMsduLifeTime_t   AcxElm_RxMsduLifeTime;
+    dot11RxMsduLifeTime_t *pCfg = &AcxElm_RxMsduLifeTime;
+
+    /* Set information element header*/
+    pCfg->EleHdr.id = DOT11_RX_MSDU_LIFE_TIME;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+    pCfg->RxMsduLifeTime = RxMsduLifeTime;
+
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": RxMsduLifeTime = 0x%x, len = 0x%x\n",pCfg->RxMsduLifeTime,pCfg->EleHdr.len);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeServicePeriodTimeout()
+ ****************************************************************************
+ * DESCRIPTION: Configure The Rx Time Out
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeServicePeriodTimeout (TI_HANDLE hCmdBld, TRxTimeOut* pRxTimeOut, void *fCb, TI_HANDLE hCb)                            
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXRxTimeout_t AcxElm_rxTimeOut;
+    ACXRxTimeout_t *pCfg = &AcxElm_rxTimeOut;
+
+    /* Set information element header*/
+    pCfg->EleHdr.id = ACX_SERVICE_PERIOD_TIMEOUT;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->PsPollTimeout = pRxTimeOut->psPoll;
+    pCfg->UpsdTimeout   = pRxTimeOut->UPSD;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIePsWmm()
+ ****************************************************************************
+ * DESCRIPTION: Configure The PS for WMM
+ *
+ * INPUTS:   TI_TRUE  - Configure PS to work on WMM mode - do not send the NULL/PS_POLL 
+ *                   packets even if TIM is set.
+ *           TI_FALSE - Configure PS to work on Non-WMM mode - work according to the 
+ *                   standard
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIePsWmm (TI_HANDLE hCmdBld, TI_BOOL enableWA, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXConfigPsWmm_t  ConfigPsWmm;
+    ACXConfigPsWmm_t *pCfg = &ConfigPsWmm;
+
+    /*
+     * Set information element header
+     */
+    pCfg->EleHdr.id = ACX_CONFIG_PS_WMM;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    pCfg->ConfigPsOnWmmMode = enableWA;
+
+    /* Report the meesage only if we are using the WiFi patch */
+    if (enableWA)
+    {
+        TRACE0(pCmdBld->hReport, REPORT_SEVERITY_CONSOLE, "cmdBld_CfgIePsWmm: PS is on WMM mode\n");
+        WLAN_OS_REPORT(("%s PS is on WMM mode\n",__FUNCTION__));
+    }
+    
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgIeRssiSnrTrigger()
+ ****************************************************************************
+ * DESCRIPTION: Configure the RSSI/SNR Trigger parameters
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: OK or NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeRssiSnrTrigger (TI_HANDLE hCmdBld, RssiSnrTriggerCfg_t *pTriggerParam, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXRssiSnrTriggerCfg_t  tAcxTriggerParameters;
+    ACXRssiSnrTriggerCfg_t *pCfg = &tAcxTriggerParameters;
+
+    pCfg->param.index       = pTriggerParam->index    ;        
+    pCfg->param.threshold   = pTriggerParam->threshold;        
+    pCfg->param.pacing      = pTriggerParam->pacing   ;        
+    pCfg->param.metric      = pTriggerParam->metric   ;        
+    pCfg->param.type        = pTriggerParam->type     ;        
+    pCfg->param.direction   = pTriggerParam->direction;        
+    pCfg->param.hystersis   = pTriggerParam->hystersis;        
+    pCfg->param.enable      = pTriggerParam->enable   ;        
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_RSSI_SNR_TRIGGER;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    TRACE8(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: threshold=%u, pacing=%u, metric=%u, type=%u, dir=%u, hyst=%u, enable=%u\n", pTriggerParam->index, pTriggerParam->threshold, pTriggerParam->pacing, pTriggerParam->metric, pTriggerParam->type, pTriggerParam->direction, pTriggerParam->hystersis, pTriggerParam->enable);
+                                             
+    /* Send the configuration command */
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgIeRssiSnrWeights()
+ ****************************************************************************
+ * DESCRIPTION: Configure the RSSI/SNR Trigger parameters
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: OK or NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeRssiSnrWeights (TI_HANDLE hCmdBld, RssiSnrAverageWeights_t *pWeightsParam, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXRssiSnrAverageWeights_t  tAcxAverageWeights;
+    ACXRssiSnrAverageWeights_t *pCfg = &tAcxAverageWeights;
+
+    pCfg->param.rssiBeaconAverageWeight = pWeightsParam->rssiBeaconAverageWeight;        
+    pCfg->param.rssiPacketAverageWeight = pWeightsParam->rssiPacketAverageWeight;        
+    pCfg->param.snrBeaconAverageWeight  = pWeightsParam->snrBeaconAverageWeight ;        
+    pCfg->param.snrPacketAverageWeight  = pWeightsParam->snrPacketAverageWeight ;        
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_RSSI_SNR_WEIGHTS;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "rssi-beacon-avg-weight=%u, rssi-packet-avg-weight=%u, snr-beacon-avg-weight=%u, snr-packet-avg-weight=%u", pWeightsParam->rssiBeaconAverageWeight, pWeightsParam->rssiPacketAverageWeight, pWeightsParam->snrBeaconAverageWeight, pWeightsParam->snrPacketAverageWeight);
+
+    /* Send the configuration command */
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+
+ /*
+ * ----------------------------------------------------------------------------
+ * Function : cmdBld_CfgIeBet
+ *
+ * Input    :   enabled               - 0 to disable BET, 0 to disable BET
+ *              MaximumConsecutiveET  - Max number of consecutive beacons
+ *                                      that may be early terminated.
+ * Output   : TI_STATUS
+ * Process  :  Configures Beacon Early Termination information element.
+ * Note(s)  :  None
+ * -----------------------------------------------------------------------------
+ */
+TI_STATUS cmdBld_CfgIeBet (TI_HANDLE hCmdBld, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    ACXBet_Enable_t ACXBet_Enable;
+    ACXBet_Enable_t* pCfg = &ACXBet_Enable;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_BET_ENABLE;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* Set configuration fields */
+    pCfg->Enable = Enable;
+    pCfg->MaximumConsecutiveET = MaximumConsecutiveET;
+
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, Enable=%d, MaximumConsecutiveET=%d\n", (TI_UINT32)pCfg->Enable, (TI_UINT32)pCfg->MaximumConsecutiveET);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CmdIeConfigureKeepAliveParams()
+ ****************************************************************************
+ * DESCRIPTION: Configure keep-alive parameters for a single template
+ *
+ * INPUTS:  hCmdBld     - handle to command builder object
+ *          uIndex      - keep-alive index
+ *          uEnaDisFlag - whether keep-alive is enabled or disables
+ *          trigType    - send keep alive when TX is idle or always
+ *          interval    - keep-alive interval
+ *          fCB         - callback function for command complete
+ *          hCb         - handle to be apssed to callback function    
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: OK or NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeConfigureKeepAliveParams (TI_HANDLE hCmdBld, TI_UINT8 uIndex,
+                                                TI_UINT8 uEnaDisFlag, TI_UINT8 trigType,
+                                                TI_UINT32 interval, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    AcxSetKeepAliveConfig_t ACXKeepAlive;
+
+    /* set IE header */
+    ACXKeepAlive.EleHdr.id = ACX_SET_KEEP_ALIVE_CONFIG;
+    ACXKeepAlive.EleHdr.len = sizeof (AcxSetKeepAliveConfig_t) - sizeof (EleHdrStruct);
+
+    /* set Keep-Alive values */
+    ACXKeepAlive.index = uIndex;
+    ACXKeepAlive.period = interval;
+    ACXKeepAlive.trigger = trigType;
+    ACXKeepAlive.valid = uEnaDisFlag;
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, index=%d, enaDis=%d, trigType=%d, interval=%d\n", (TI_UINT32)ACXKeepAlive.index, (TI_UINT32)ACXKeepAlive.valid, (TI_UINT32)ACXKeepAlive.trigger, (TI_UINT32)ACXKeepAlive.period);
+
+    /* send the command to the FW */
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, &ACXKeepAlive, sizeof(AcxSetKeepAliveConfig_t), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CmdIeConfigureKeepAliveParams()
+ ****************************************************************************
+ * DESCRIPTION: Configure keep-alive global enable / disable flag
+ *
+ * INPUTS:  enable / disable flag
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: OK or NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeConfigureKeepAliveEnaDis (TI_HANDLE hCmdBld, TI_UINT8 enaDisFlag, 
+                                                void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    AcxKeepAliveMode ACXKeepAliveMode;
+
+    /* set IE header */
+    ACXKeepAliveMode.EleHdr.id = ACX_KEEP_ALIVE_MODE;
+    ACXKeepAliveMode.EleHdr.len = sizeof (AcxKeepAliveMode) - sizeof (EleHdrStruct);
+
+    /* set Keep-Alive mode */
+    ACXKeepAliveMode.modeEnabled = enaDisFlag;
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, ": Sending info elem to firmware, enaDis=%d\n", (TI_UINT32)ACXKeepAliveMode.modeEnabled);
+
+    /* send the command to the FW */
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, &ACXKeepAliveMode, sizeof(AcxKeepAliveMode), fCb, hCb, NULL);
+}
+
+/** 
+ * \fn     cmdBld_CfgIeSetFwHtCapabilities 
+ * \brief  set the current AP HT Capabilities to the FW. 
+ *
+ * \note    
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa 
+ */ 
+TI_STATUS cmdBld_CfgIeSetFwHtCapabilities (TI_HANDLE hCmdBld,
+                                           TI_UINT32 uHtCapabilites,
+                                           TMacAddr  tMacAddress,
+                                           TI_UINT8  uAmpduMaxLeng,
+                                           TI_UINT8  uAmpduMinSpac,
+                                           void      *fCb, 
+                                           TI_HANDLE hCb)
+{
+    TCmdBld                         *pCmdBld = (TCmdBld *)hCmdBld;
+    TAxcHtCapabilitiesIeFwInterface tAcxFwHtCap;
+    TAxcHtCapabilitiesIeFwInterface *pCfg    = &tAcxFwHtCap;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_PEER_HT_CAP;
+    pCfg->EleHdr.len = sizeof(tAcxFwHtCap) - sizeof(EleHdrStruct);
+
+    MAC_COPY (pCfg->aMacAddress, tMacAddress);
+    pCfg->uHtCapabilites = uHtCapabilites;
+    pCfg->uAmpduMaxLength = uAmpduMaxLeng;
+    pCfg->uAmpduMinSpacing = uAmpduMinSpac;
+ 
+    TRACE9(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSetFwHtCapabilities: HtCapabilites=0x%x, AmpduMaxLength=%d, AmpduMinSpac=%d, MAC: %x:%x:%x:%x:%x:%x\n", uHtCapabilites, uAmpduMaxLeng, uAmpduMinSpac, pCfg->aMacAddress[0], pCfg->aMacAddress[1], pCfg->aMacAddress[2], pCfg->aMacAddress[3], pCfg->aMacAddress[4], pCfg->aMacAddress[5]);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcHtCapabilitiesIeFwInterface), fCb, hCb, NULL);
+    
+}
+
+/** 
+ * \fn     cmdBld_CfgIeSetFwHtInformation 
+ * \brief  set the current AP HT Information to the FW. 
+ *
+ * \note    
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa 
+ */ 
+TI_STATUS cmdBld_CfgIeSetFwHtInformation (TI_HANDLE hCmdBld,
+                                          TI_UINT8  uRifsMode,           
+                                          TI_UINT8  uHtProtection,       
+                                          TI_UINT8  uGfProtection,       
+                                          TI_UINT8  uHtTxBurstLimit,     
+                                          TI_UINT8  uDualCtsProtection,  
+                                          void      *fCb, 
+                                          TI_HANDLE hCb)
+{
+    TCmdBld                        *pCmdBld = (TCmdBld *)hCmdBld;
+    TAxcHtInformationIeFwInterface tAcxFwHtInf;
+    TAxcHtInformationIeFwInterface *pCfg = &tAcxFwHtInf;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_HT_BSS_OPERATION;
+    pCfg->EleHdr.len = sizeof(tAcxFwHtInf) - sizeof(EleHdrStruct);
+
+    pCfg->uRifsMode = uRifsMode;
+    pCfg->uHtProtection = uHtProtection;
+    pCfg->uGfProtection = uGfProtection;
+    pCfg->uHtTxBurstLimit = uHtTxBurstLimit;
+    pCfg->uDualCtsProtection = uDualCtsProtection;
+ 
+    TRACE5(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSetFwHtInformation: RifsMode=0x%x, HtProtection=0x%x, GfProtection=0x%x, HtTxBurstLimit=0x%x, DualCtsProtection=0x%x\n", uRifsMode, uHtProtection, uGfProtection, uHtTxBurstLimit, uDualCtsProtection);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcHtInformationIeFwInterface), fCb, hCb, NULL);
+}
+
+/** 
+ * \fn     cmdBld_CfgIeSetBaSession 
+ * \brief  configure BA session initiator\receiver parameters setting in the FW. 
+ *
+ * \note    
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa 
+ */ 
+TI_STATUS cmdBld_CfgIeSetBaSession (TI_HANDLE hCmdBld, 
+                                    InfoElement_e eBaType,
+                                    TI_UINT8 uTid,               
+                                    TI_UINT8 uState,             
+                                    TMacAddr tRa,                
+                                    TI_UINT16 uWinSize,          
+                                    TI_UINT16 uInactivityTimeout,
+                                    void *fCb, 
+                                    TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TAxcBaSessionInitiatorResponderPolicy tAcxBaSessionPrm;
+    TAxcBaSessionInitiatorResponderPolicy *pCfg = &tAcxBaSessionPrm;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = eBaType;
+    pCfg->EleHdr.len = sizeof(tAcxBaSessionPrm) - sizeof(EleHdrStruct);
+
+    MAC_COPY (pCfg->aMacAddress, tRa);
+    pCfg->uTid = uTid;
+    pCfg->uPolicy = uState;
+    pCfg->uWinSize = uWinSize;
+
+    if (eBaType == ACX_BA_SESSION_INITIATOR_POLICY)
+    {
+        pCfg->uInactivityTimeout = uInactivityTimeout;
+    }
+    else
+    {
+        if (eBaType == ACX_BA_SESSION_RESPONDER_POLICY)
+        {
+            pCfg->uInactivityTimeout = 0;
+        }
+        else
+        {
+            TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CfgIeSetBaSession: error ID=%u\n", pCfg->EleHdr.id);
+            return TI_NOK;
+        }
+    }
+
+    TRACE10(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CfgIeSetBaSession: ID=, TID=%u, Policy=%u, MAC: %x:%x:%x:%x:%x:%x, uWinSize=%u, Timeout=%u\n", pCfg->uTid, pCfg->uPolicy, pCfg->aMacAddress[0], pCfg->aMacAddress[1], pCfg->aMacAddress[2], pCfg->aMacAddress[3], pCfg->aMacAddress[4], pCfg->aMacAddress[5], pCfg->uWinSize, pCfg->uInactivityTimeout);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(TAxcBaSessionInitiatorResponderPolicy), fCb, hCb, NULL);
+}
+
+/** 
+ * \fn     cmdBld_CfgIeRadioParams 
+ * \brief  configure radio parameters setting in the FW. 
+ *
+ * \note    
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa 
+ */ 
+TI_STATUS cmdBld_CfgIeRadioParams (TI_HANDLE hCmdBld, IniFileRadioParam *pIniFileRadioParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TTestCmd TestCmd;
+    TTestCmd *pTestCmd = &TestCmd;
+
+    pTestCmd->testCmdId = TEST_CMD_INI_FILE_RADIO_PARAM;
+    
+    os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileRadioParams, pIniFileRadioParams, sizeof(IniFileRadioParam));
+
+   
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_TEST, 
+                             (void *)pTestCmd, 
+                             sizeof(IniFileRadioParam) + 4,
+                             fCb, 
+                             hCb, 
+                             (void*)pTestCmd);    
+}
+
+
+TI_STATUS cmdBld_CfgPlatformGenParams (TI_HANDLE hCmdBld, IniFileGeneralParam *pGenParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TTestCmd TestCmd;
+    TTestCmd *pTestCmd = &TestCmd;
+
+    pTestCmd->testCmdId = TEST_CMD_INI_FILE_GENERAL_PARAM;
+    
+    os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileGeneralParams, pGenParams, sizeof(IniFileGeneralParam));
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_TEST, 
+                             (void *)pTestCmd, 
+                             sizeof(IniFileGeneralParam) + 4,
+                             fCb, 
+                             hCb, 
+                             (void*)pTestCmd);    
+
+}
+
+
+
+
+/****************************************************************************
+ *                      cmdBld_CfgIeBurstMode()
+ ****************************************************************************
+ * DESCRIPTION: Configure burst mode
+ *
+ * INPUTS:  hCmdBld     - handle to command builder object
+ *          bEnabled    - is enabled flag
+ *          fCB         - callback function for command complete
+ *          hCb         - handle to be apssed to callback function    
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: OK or NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeBurstMode (TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb)
+{
+	TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+	AcxBurstMode tAcxBurstMode;
+	AcxBurstMode *pCfg = &tAcxBurstMode;
+
+	/* set IE header */
+    pCfg->EleHdr.id = ACX_BURST_MODE;
+	pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+	/* set burst mode value */
+	pCfg->enable = (uint8)bEnabled;
+
+    /* send the command to the FW */
+	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgIeSRstate()
+ ****************************************************************************
+ * DESCRIPTION: Configure sart reflex state
+ *
+ * INPUTS:  hCmdBld     - handle to command builder object
+ *          bEnabled    - is enabled flag
+ *          fCB         - callback function for command complete
+ *          hCb         - handle to be apssed to callback function    
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: OK or NOK
+ ****************************************************************************/
+
+TI_STATUS cmdBld_CfgIeSRState (TI_HANDLE hCmdBld, uint8 SRstate, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXSmartReflexState_t tSmartReflexState;
+    ACXSmartReflexState_t *pCfg = &tSmartReflexState;
+           
+    /* set IE header */
+    pCfg->EleHdr.id = ACX_SET_SMART_REFLEX_STATE;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* set smart refelx state */
+    pCfg->enable = SRstate;
+
+    /* send the command to the FW */
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+       
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgIeSRDebug()
+ ****************************************************************************
+ * DESCRIPTION: Send debug param just if it's configured in ini file
+ * INPUTS:  hCmdBld     - handle to command builder object
+ *          bEnabled    - is enabled flag
+ *          fCB         - callback function for command complete
+ *          hCb         - handle to be apssed to callback function    
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: OK or NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeSRDebug (TI_HANDLE hCmdBld, ACXSmartReflexDebugParams_t *pSRDebug, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXSmartReflexDebugParams_t tSmartReflexDebug;
+    ACXSmartReflexDebugParams_t *pCfg = &tSmartReflexDebug;
+    
+   /* send this command to FW just in case it's initialize in ini file */
+    if (pSRDebug->senNRN == 0) {
+        return TI_NOK;
+    }
+
+    /* copy smart reflex debug params*/
+    os_memoryCopy(pCmdBld->hOs, pCfg, pSRDebug, sizeof(ACXSmartReflexDebugParams_t));
+
+   /* set IE header */
+    pCfg->EleHdr.id = ACX_SET_SMART_REFLEX_DEBUG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    /* send the command to the FW */
+    return  cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL);
+
+}
+
+/****************************************************************************
+ *                      cmdBld_CfgIeDcoItrimParams()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate the DCO Itrim parameters
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CfgIeDcoItrimParams (TI_HANDLE hCmdBld, TI_BOOL enable, TI_UINT32 moderationTimeoutUsec, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXDCOItrimParams_t ACXBeaconFilterOptions;
+    ACXDCOItrimParams_t *pCfg = &ACXBeaconFilterOptions;
+   
+    pCfg->enable = enable;
+    pCfg->moderation_timeout_usec = moderationTimeoutUsec;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_SET_DCO_ITRIM_PARAMS;
+    pCfg->EleHdr.len = sizeof(ACXDCOItrimParams_t) - sizeof(EleHdrStruct);
+
+    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "ID=%u: enable=%u, moderation_timeout_usec=%u\n", pCfg->EleHdr.id, enable, moderationTimeoutUsec);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(ACXDCOItrimParams_t), fCb, hCb, NULL);
+}
+   
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldCfgIE.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,116 @@
+/*
+ * CmdBldCfgIE.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  CmdBldCfgIE.h
+ *   PURPOSE: wlan hardware configuration information elements
+ * 
+ ****************************************************************************/
+
+#ifndef CMDBLDCFGIE_H
+#define CMDBLDCFGIE_H
+
+
+#include "TWDriverInternal.h"
+#include "public_infoele.h"
+
+
+TI_STATUS cmdBld_CfgIeMemoryMap                	(TI_HANDLE hCmdBld, MemoryMap_t *apMap, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeRx                       	(TI_HANDLE hCmdBld, TI_UINT32 apRxConfigOption, TI_UINT32 apRxFilterOption, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeStationId                	(TI_HANDLE hCmdBld, TI_UINT8* apStationId, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSleepAuth                	(TI_HANDLE hCmdBld, EPowerPolicy minPowerLevel, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeWakeUpCondition          	(TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeFeatureConfig            	(TI_HANDLE hCmdBld, TI_UINT32 uOptions, TI_UINT32 uDataFlowOptions, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeBeaconFilterOpt          	(TI_HANDLE hCmdBld, TI_UINT8 beaconFilteringStatus, TI_UINT8 numOfBeaconsToBuffer, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeBeaconFilterTable        	(TI_HANDLE hCmdBld, TI_UINT8 numberOfIEs, TI_UINT8* pIETable, TI_UINT8 IETableSize, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeArpIpFilter              	(TI_HANDLE hCmdBld, TIpAddr tIpAddr, TI_BOOL bFilteringEnabled, void *fCb, TI_HANDLE hCb); 
+TI_STATUS cmdBld_CfgIeGroupAdressTable         	(TI_HANDLE hCmdBld, TI_UINT8 numGroupAddrs, TMacAddr *pGroupAddr, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeAid                      	(TI_HANDLE hCmdBld, TI_UINT16 apAidVal, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeTxPowerDbm 				(TI_HANDLE hCmdBld, TI_UINT8 uTxPowerDbm , void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSgEnable                 	(TI_HANDLE hCmdBld, ESoftGeminiEnableModes eSoftGeminiEnableModes, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSg                       	(TI_HANDLE hCmdBld, TSoftGeminiParams *pSoftGeminiParam, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeFmCoex                    (TI_HANDLE hCmdBld, TFmCoexParams *pFmCoexParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeConnMonitParams          	(TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeConfigMemory             	(TI_HANDLE hCmdBld, TDmaParams *pDmaParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSlotTime                 	(TI_HANDLE hCmdBld, TI_UINT8 apSlotTime, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIePreamble                 	(TI_HANDLE hCmdBld, TI_UINT8 apPreamble, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeStatisitics              	(TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeEventMask                	(TI_HANDLE hCmdBld, TI_UINT32 mask, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIePacketDetectionThreshold 	(TI_HANDLE hCmdBld, TI_UINT32 pdThreshold, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeCcaThreshold              (TI_HANDLE hCmdBld, TI_UINT16 ccaThreshold, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeTxRatePolicy             	(TI_HANDLE hCmdBld, TTxRatePolicy *pTxRatePolicy, void *fCb, TI_HANDLE hCb);                                        
+TI_STATUS cmdBld_CfgIeRtsThreshold             	(TI_HANDLE hCmdBld, TI_UINT16 uRtsThreshold, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeDcoItrimParams            (TI_HANDLE hCmdBld, TI_BOOL enable, TI_UINT32 moderationTimeoutUsec, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeFragmentThreshold         (TI_HANDLE hCmdBld, TI_UINT16 uFragmentThreshold, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIePmConfig                  (TI_HANDLE hCmdBld, TI_UINT32 uHostClkSettlingTime, TI_UINT8 uHostFastWakeupSupport, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeTxCmpltPacing             (TI_HANDLE hCmdBld, TI_UINT16 uTxCompletePacingThreshold, TI_UINT16 uTxCompletePacingTimeout, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeRxIntrPacing              (TI_HANDLE hCmdBld, TI_UINT16 uRxIntrPacingThreshold, TI_UINT16 uRxIntrPacingTimeout, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeCtsProtection            	(TI_HANDLE hCmdBld, TI_UINT8 uCtsToSelf, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeBcnBrcOptions            	(TI_HANDLE hCmdBld, TPowerMgmtConfig *pPMConfig, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIePsWmm                    	(TI_HANDLE hCmdBld, TI_BOOL bEnableWA, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeRssiSnrTrigger           	(TI_HANDLE hCmdBld, RssiSnrTriggerCfg_t *pTriggerParam, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeRssiSnrWeights           	(TI_HANDLE hCmdBld, RssiSnrAverageWeights_t *pWeightsParam, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeTid                      	(TI_HANDLE hCmdBld, TQueueTrafficParams *pQtrafficParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeAcParams                 	(TI_HANDLE hCmdBld, TAcQosParams *pConfigureCommand, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIePsRxStreaming             (TI_HANDLE hCmdBld, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeMaxTxRetry               	(TI_HANDLE hCmdBld, TRroamingTriggerParams *pRoamingTriggerCmd, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeServicePeriodTimeout     	(TI_HANDLE hCmdBld, TRxTimeOut* pRxTimeOut, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeRxMsduLifeTime           	(TI_HANDLE hCmdBld, TI_UINT32 uRxMsduLifeTime, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeEnableRxDataFilter       	(TI_HANDLE hCmdBld, TI_BOOL enabled, filter_e eDefaultAction, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeRxDataFilter             	(TI_HANDLE hCmdBld, TI_UINT8 index, TI_UINT8 command, filter_e action, TI_UINT8 numFieldPatterns, TI_UINT8 lenFieldPatterns, TI_UINT8 *pFieldPatterns, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeBet                      	(TI_HANDLE hCmdBld, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeConfigureKeepAliveParams  (TI_HANDLE hCmdBld, TI_UINT8 uIndex, TI_UINT8 uEnaDisFlag, TI_UINT8 trigType, TI_UINT32 interval, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeConfigureKeepAliveEnaDis  (TI_HANDLE hCmdBld, TI_UINT8 enaDisFlag, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSetBaSession              (TI_HANDLE hCmdBld, InfoElement_e eBaType, TI_UINT8 uTid, TI_UINT8 uState, TMacAddr tRa, TI_UINT16 uWinSize, TI_UINT16 uInactivityTimeout, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSetFwHtCapabilities       (TI_HANDLE hCmdBld, TI_UINT32 uHtCapabilites, TMacAddr tMacAddress, TI_UINT8 uAmpduMaxLeng, TI_UINT8 uAmpduMinSpac, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSetFwHtInformation        (TI_HANDLE hCmdBld, TI_UINT8 uRifsMode, TI_UINT8 uHtProtection, TI_UINT8 uGfProtection, TI_UINT8 uHtTxBurstLimit, TI_UINT8 uDualCtsProtection, void *fCb,TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeRadioParams               (TI_HANDLE hCmdBld, IniFileRadioParam *pIniFileRadioParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgPlatformGenParams           (TI_HANDLE hCmdBld, IniFileGeneralParam *pGenParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeCoexActivity              (TI_HANDLE hCmdBld, TCoexActivity *pCoexActivity, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeBurstMode 				(TI_HANDLE hCmdBld, TI_BOOL bEnabled, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSRDebug                   (TI_HANDLE hCmdBld, ACXSmartReflexDebugParams_t *pSRDebug, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeSRState                   (TI_HANDLE hCmdBld, uint8 SRstate, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CfgIeRateMngDbg 				(TI_HANDLE hCmdBld, RateMangeParams_t *pRateMngParams, void *fCb, TI_HANDLE hCb);
+
+
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldCmd.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1729 @@
+/*
+ * CmdBldCmd.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdBldCmd.c 
+ *  \brief Command builder. Commands
+ *
+ *  \see   CmdBld.h 
+ */
+
+#define __FILE_ID__  FILE_ID_93
+#include "tidef.h"
+#include "report.h"
+#include "TWDriverInternal.h"
+#include "CmdBld.h"
+#include "CmdBldCmdIE.h"
+#include "CmdBldCfgIE.h"
+#include "CmdQueue_api.h"
+#include "eventMbox_api.h"
+
+
+/* 
+    Rx filter field is mostly hard-coded.
+   This filter value basically pass only valid beacons / probe responses. For exact bit description,
+   consult either the DPG or the FPG (or both, and Yoel...)
+*/
+#define RX_FILTER_CFG_ (CFG_RX_PRSP_EN | CFG_RX_MGMT_EN | CFG_RX_BCN_EN | CFG_RX_RCTS_ACK | CFG_RX_CTL_EN)
+
+
+TI_STATUS cmdBld_CmdAddWepKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdRemoveWepKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdAddWepMappingKey 	(TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdRemoveWepMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb);
+TI_UINT32 cmdBld_BuildPeriodicScanChannles  (TPeriodicScanParams *pPeriodicScanParams, ConnScanChannelInfo_t *pChannelList, EScanType eScanType, ERadioBand eRadioBand, TI_UINT32 uPassiveScanDfsDwellTime);
+
+
+/** 
+ * \fn     cmdBld_CmdStartScan
+ * \brief  Build a start scan command and send it to the FW
+ * 
+ * Build a start scan command and send it to the FW
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  pScanVals - scan parameters
+ * \param  eScanTag - scan tag used for scan complete and result tracking
+ * \param  fScanCommandResponseCB - command complete CB
+ * \param  hCb - command complete CB
+ * \return command status (OK / NOK)
+ * \sa     cmdBld_CmdStopScan
+ */ 
+TI_STATUS cmdBld_CmdStartScan (TI_HANDLE hCmdBld, TScanParams *pScanVals, EScanResultTag eScanTag, 
+                               TI_BOOL bHighPriority, void* ScanCommandResponseCB, TI_HANDLE hCb)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+    BasicScanChannelParameters_t* chanPtr;
+    ScanParameters_t    tnetScanParams;
+    TI_UINT8*              pBSSID;
+    TI_INT32 i;
+
+    /* Convert general scan data to tnet structure */
+    tnetScanParams.basicScanParameters.tidTrigger = pScanVals->Tid;
+    tnetScanParams.basicScanParameters.numOfProbRqst = pScanVals->probeReqNumber;
+    tnetScanParams.basicScanParameters.ssidLength = pScanVals->desiredSsid.len;
+    os_memoryCopy (pCmdBld->hOs, 
+                   (void *)tnetScanParams.basicScanParameters.ssidStr, 
+                   (void *)pScanVals->desiredSsid.str, 
+                   tnetScanParams.basicScanParameters.ssidLength);
+    
+    /* 
+        scan options field is composed of scan type and band selection. 
+        First, use the lookup table to convert the scan type 
+    */                  
+
+    tnetScanParams.basicScanParameters.scanOptions = 0;
+
+    switch ( pScanVals->scanType )
+    {
+    case SCAN_TYPE_NORMAL_ACTIVE : 
+        tnetScanParams.basicScanParameters.scanOptions = SCAN_ACTIVE;
+        break;
+    
+    case SCAN_TYPE_NORMAL_PASSIVE : 
+        tnetScanParams.basicScanParameters.scanOptions = SCAN_PASSIVE;
+        break;
+    
+    case SCAN_TYPE_TRIGGERED_ACTIVE :
+        tnetScanParams.basicScanParameters.scanOptions = SCAN_ACTIVE | TRIGGERED_SCAN;
+        break;
+    
+    case SCAN_TYPE_TRIGGERED_PASSIVE :
+        tnetScanParams.basicScanParameters.scanOptions = SCAN_PASSIVE | TRIGGERED_SCAN;
+        break;
+
+    default:
+        TRACE1( pCmdBld->hReport, REPORT_SEVERITY_ERROR, "Invalid scan type:%d\n", pScanVals->scanType);
+        return TI_NOK;
+    }
+
+    /* Add the band selection */
+    if ( RADIO_BAND_5_0_GHZ == pScanVals->band )
+    {
+        tnetScanParams.basicScanParameters.band = RADIO_BAND_5GHZ;
+    }
+    else
+    {
+        tnetScanParams.basicScanParameters.band = RADIO_BAND_2_4_GHZ;
+    }
+
+    /* Add high priority bit */
+    if ( bHighPriority )
+    {
+        tnetScanParams.basicScanParameters.scanOptions |= SCAN_PRIORITY_HIGH;
+    }
+
+    tnetScanParams.basicScanParameters.scanOptions = ENDIAN_HANDLE_WORD( tnetScanParams.basicScanParameters.scanOptions );
+
+    /* important note: BSSID filter (0x0010) is DISABLED, because the FW sets it according
+       to BSSID value (broadcast does not filter, any other value will */
+    tnetScanParams.basicScanParameters.rxCfg.ConfigOptions = 0x12802 ;
+    tnetScanParams.basicScanParameters.rxCfg.FilterOptions = ENDIAN_HANDLE_LONG( RX_FILTER_CFG_ );
+
+    /* If the SSID is not broadcast SSID, also filter according to SSID */
+    if (pScanVals->desiredSsid.len != 0)
+    {
+        tnetScanParams.basicScanParameters.rxCfg.ConfigOptions |= BIT_4 | BIT_10;
+    }
+    tnetScanParams.basicScanParameters.rxCfg.ConfigOptions = ENDIAN_HANDLE_LONG( tnetScanParams.basicScanParameters.rxCfg.ConfigOptions );
+
+    /* Rate conversion is done in the HAL */
+    cmdBld_ConvertAppRatesBitmap (pScanVals->probeRequestRate, 
+                                     0, 
+                                     &tnetScanParams.basicScanParameters.txdRateSet);
+
+    tnetScanParams.basicScanParameters.txdRateSet = ENDIAN_HANDLE_LONG( tnetScanParams.basicScanParameters.txdRateSet );
+    tnetScanParams.basicScanParameters.numChannels = ENDIAN_HANDLE_WORD( pScanVals->numOfChannels );
+
+    /* scan result tag */
+    tnetScanParams.basicScanParameters.scanTag = eScanTag;
+
+    /* copy channel specific scan data to HAL structure */
+    for ( i = 0; i < pScanVals->numOfChannels; i++ )
+    {
+        TI_INT32 j;
+        TI_UINT8*  macAddr;
+
+        macAddr = (TI_UINT8*)&tnetScanParams.basicScanChannelParameters[ i ].bssIdL;
+
+        /* copy the MAC address, upside down (CHIP structure) */
+        for ( j = 0; j < MAC_ADDR_LEN; j++ )
+        {
+            macAddr[ j ] = pScanVals->channelEntry[ i ].normalChannelEntry.bssId[ MAC_ADDR_LEN - 1 - j ];
+        }
+        tnetScanParams.basicScanChannelParameters[ i ].scanMinDuration = 
+            ENDIAN_HANDLE_LONG( pScanVals->channelEntry[ i ].normalChannelEntry.minChannelDwellTime );
+        tnetScanParams.basicScanChannelParameters[ i ].scanMaxDuration = 
+            ENDIAN_HANDLE_LONG( pScanVals->channelEntry[ i ].normalChannelEntry.maxChannelDwellTime );
+        tnetScanParams.basicScanChannelParameters[ i ].ETCondCount = 
+            pScanVals->channelEntry[ i ].normalChannelEntry.ETMaxNumOfAPframes |
+            pScanVals->channelEntry[ i ].normalChannelEntry.earlyTerminationEvent;
+        tnetScanParams.basicScanChannelParameters[ i ].txPowerAttenuation = 
+            pScanVals->channelEntry[ i ].normalChannelEntry.txPowerDbm;
+        tnetScanParams.basicScanChannelParameters[ i ].channel = 
+            pScanVals->channelEntry[ i ].normalChannelEntry.channel;
+    }
+
+    TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "RxCfg = 0x%x\n                             RxFilterCfg = 0x%x\n                             scanOptions = 0x%x\n                             numChannels = %d\n                             probeNumber = %d\n                             probeRateModulation = 0x%x\n                             tidTrigger = %d\n" ,                               tnetScanParams.basicScanParameters.rxCfg.ConfigOptions,                               tnetScanParams.basicScanParameters.rxCfg.FilterOptions,                              tnetScanParams.basicScanParameters.scanOptions,                               tnetScanParams.basicScanParameters.numChannels,                               tnetScanParams.basicScanParameters.numOfProbRqst,                              tnetScanParams.basicScanParameters.txdRateSet,                               tnetScanParams.basicScanParameters.tidTrigger);
+    
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Channel      BSSID           MinTime     MaxTime     ET     TxPower   probChan\n");
+   
+    for( i=0; i < pScanVals->numOfChannels; i++)
+    {
+        chanPtr = &tnetScanParams.basicScanChannelParameters[i];
+        pBSSID = (TI_UINT8*)&chanPtr->bssIdL;
+
+ 		TRACE12(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "%06d   %02x:%02x:%02x:%02x:%02x:%02x    %05d %05d %02d %05d %05d\n",i, pBSSID[5],pBSSID[4],pBSSID[3],pBSSID[2],pBSSID[1],pBSSID[0], chanPtr->scanMinDuration, chanPtr->scanMaxDuration, chanPtr->ETCondCount, chanPtr->txPowerAttenuation, chanPtr->channel);
+    }
+
+    return cmdBld_CmdIeStartScan (hCmdBld, &tnetScanParams, ScanCommandResponseCB, hCb);
+}
+
+/** 
+ * \fn     cmdBld_CmdStartSPSScan
+ * \brief  Build a start SPS scan command and send it to the FW
+ * 
+ * Build a start SPS scan command and send it to the FW
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  pScanVals - scan parameters
+ * \param  eScanTag - scan tag used for scan complete and result tracking
+ * \param  fScanCommandResponseCB - command complete CB
+ * \param  hCb - command complete CB
+ * \return command status (OK / NOK)
+ * \sa     cmdBld_CmdStopSPSScan
+ */ 
+TI_STATUS cmdBld_CmdStartSPSScan (TI_HANDLE hCmdBld, TScanParams *pScanVals, EScanResultTag eScanTag, 
+                                  void* fScanCommandResponseCB, TI_HANDLE hCb)
+{
+    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
+    ScheduledScanParameters_t   tnetSPSScanParams;
+    TI_INT32 i;
+
+    /* Convert general scan data to TNET structure */
+    tnetSPSScanParams.scheduledGeneralParameters.scanOptions = SCAN_PASSIVE;
+    /* Add the band selection */
+    if ( RADIO_BAND_5_0_GHZ == pScanVals->band )
+    {
+        tnetSPSScanParams.scheduledGeneralParameters.band = RADIO_BAND_5GHZ;
+    }
+    else
+    {
+        tnetSPSScanParams.scheduledGeneralParameters.band = RADIO_BAND_2_4_GHZ;
+    }
+
+
+    tnetSPSScanParams.scheduledGeneralParameters.scanOptions = ENDIAN_HANDLE_WORD( tnetSPSScanParams.scheduledGeneralParameters.scanOptions );
+
+    /* important note: BSSID filter (0x0010) is DISABLED, because the FW sets it according
+       to BSSID value (broadcast does not filter, any other value will */
+    /* If the SSID is not broadcast SSID, also filter according to SSID */
+    tnetSPSScanParams.scheduledGeneralParameters.rxCfg.ConfigOptions = 0x12812;
+    tnetSPSScanParams.scheduledGeneralParameters.rxCfg.FilterOptions = ENDIAN_HANDLE_LONG( RX_FILTER_CFG_ );
+    tnetSPSScanParams.scheduledGeneralParameters.rxCfg.ConfigOptions = ENDIAN_HANDLE_LONG( tnetSPSScanParams.scheduledGeneralParameters.rxCfg.ConfigOptions );
+
+    /* latest TSF value - used to discover TSF error (AP recovery) */
+    tnetSPSScanParams.scheduledGeneralParameters.scanCmdTime_h = ENDIAN_HANDLE_LONG( INT64_HIGHER(pScanVals->latestTSFValue) );
+    tnetSPSScanParams.scheduledGeneralParameters.scanCmdTime_l = ENDIAN_HANDLE_LONG( INT64_LOWER(pScanVals->latestTSFValue) );
+
+    /* add scan tag */
+    tnetSPSScanParams.scheduledGeneralParameters.scanTag = eScanTag;
+
+    tnetSPSScanParams.scheduledGeneralParameters.numChannels = pScanVals->numOfChannels;
+
+    /* copy channel specific scan data to HAL structure */
+    for ( i = 0; i < pScanVals->numOfChannels; i++ )
+    {
+        TI_INT32 j;
+        TI_UINT8*  macAddr;
+
+        macAddr = (TI_UINT8*)&tnetSPSScanParams.scheduledChannelParameters[ i ].bssIdL;
+
+        /* copy the MAC address, upside down (CHIP structure) */
+        for ( j = 0; j < MAC_ADDR_LEN; j++ )
+        {
+            macAddr[ j ] = pScanVals->channelEntry[ i ].normalChannelEntry.bssId[ MAC_ADDR_LEN - 1 - j ];
+        }
+        tnetSPSScanParams.scheduledChannelParameters[ i ].scanMaxDuration = 
+            ENDIAN_HANDLE_LONG( pScanVals->channelEntry[ i ].SPSChannelEntry.scanDuration );
+        tnetSPSScanParams.scheduledChannelParameters[ i ].scanStartTime = 
+            ENDIAN_HANDLE_LONG( pScanVals->channelEntry[ i ].SPSChannelEntry.scanStartTime );
+        tnetSPSScanParams.scheduledChannelParameters[ i ].ETCondCount =
+            pScanVals->channelEntry[ i ].SPSChannelEntry.ETMaxNumOfAPframes | 
+            pScanVals->channelEntry[ i ].SPSChannelEntry.earlyTerminationEvent;
+        tnetSPSScanParams.scheduledChannelParameters[ i ].channel = 
+            pScanVals->channelEntry[ i ].SPSChannelEntry.channel;
+    }
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "RxCfg = 0x%x\n                             RxFilterCfg = 0x%x\n                             scanOptions = 0x%x\n                             numChannels = %d\n", tnetSPSScanParams.scheduledGeneralParameters.rxCfg.ConfigOptions, tnetSPSScanParams.scheduledGeneralParameters.rxCfg.FilterOptions, tnetSPSScanParams.scheduledGeneralParameters.scanOptions, tnetSPSScanParams.scheduledGeneralParameters.numChannels);
+    
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Channel      BSSID           StartTime     Duration     ET     probChan\n");
+   
+#ifdef TI_DBG
+    for( i=0; i < tnetSPSScanParams.scheduledGeneralParameters.numChannels; i++)
+    {
+        ScheduledChannelParameters_t* chanPtr = &tnetSPSScanParams.scheduledChannelParameters[ i ];
+        TI_UINT8* pBSSID = (TI_UINT8*)&chanPtr->bssIdL;
+
+        TRACE11(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "%6d   %02x:%02x:%02x:%02x:%02x:%02x    %5d %5d %2d %5d\n",i, pBSSID[5],pBSSID[4],pBSSID[3],pBSSID[2],pBSSID[1],pBSSID[0], chanPtr->scanStartTime, chanPtr->scanMaxDuration, chanPtr->ETCondCount, chanPtr->channel);
+    }
+#endif /* TI_DBG */
+
+    return cmdBld_CmdIeStartSPSScan (hCmdBld, &tnetSPSScanParams, fScanCommandResponseCB, hCb);
+}
+
+/** 
+ * \fn     cmdBld_CmdStopScan
+ * \brief  Build a stop scan command and send it to FW
+ * 
+ * Build a stop scan command and send it to FW
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  eScanTag - scan tag, used for scan complete and result tracking
+ * \return command status (OK / NOK)
+ * \sa     cmdBld_CmdStartSPSScan
+ */ 
+TI_STATUS cmdBld_CmdStopScan (TI_HANDLE hCmdBld, EScanResultTag eScanTag, 
+                              void *fScanCommandResponseCB, TI_HANDLE hCb)
+{
+    return cmdBld_CmdIeStopScan (hCmdBld, fScanCommandResponseCB, hCb);
+}
+
+
+/** 
+ * \fn     cmdBld_CmdStopSPSScan
+ * \brief  Build a stop SPS scan command and send it to FW
+ * 
+ * Build a stop SPS scan command and send it to FW
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  eScanTag - scan tag, used for scan complete and result tracking
+ * \return command status (OK / NOK)
+ * \sa     cmdBld_CmdStartScan
+ */ TI_STATUS cmdBld_CmdStopSPSScan (TI_HANDLE hCmdBld, EScanResultTag eScanTag, 
+                                 void* fScanCommandResponseCB, TI_HANDLE hCb)
+{
+    return cmdBld_CmdIeStopSPSScan (hCmdBld, fScanCommandResponseCB, hCb);
+}
+
+TI_STATUS cmdBld_CmdSetSplitScanTimeOut (TI_HANDLE hCmdBld, TI_UINT32 uTimeOut)
+{
+    DB_WLAN(hCmdBld).uSlicedScanTimeOut = uTimeOut;
+
+	return cmdBld_CmdIeSetSplitScanTimeOut (hCmdBld, uTimeOut, NULL, NULL);
+}
+
+/** 
+ * \fn     cmdBld_debugPrintPeriodicScanChannles 
+ * \brief  Print periodic scan channel list for debug purposes
+ * 
+ * Print periodic scan channel list for debug purposes
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  pChannel - pointer to the channel list to print
+ * \param  uChannelCount - number of channles to print
+ * \return None
+ * \sa     cmdBld_debugPrintPeriodicScanParams
+ */ 
+void cmdBld_debugPrintPeriodicScanChannles (TI_HANDLE hCmdBld, ConnScanChannelInfo_t* pChannel,
+                                            TI_UINT32 uChannelCount)
+{
+    TCmdBld                 *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT32               uIndex;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Index  Channel  MinTime  MaxTime  DFStime  PowerLevel\n");
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "-------------------------------------------------------------------\n");
+    for (uIndex = 0; uIndex <  uChannelCount; uIndex++)
+    {
+        TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "%-10d %-10d %-10d %-10d %-10d %-11d\n", uIndex, pChannel[ uIndex ].channel, pChannel[ uIndex ].scanMinDuration, pChannel[ uIndex ].scanMaxDuration, pChannel[ uIndex ].passiveScanDuration, pChannel[ uIndex ].txPowerLevelDbm);
+    }
+}
+
+/** 
+ * \fn     cmdBld_debugPrintPeriodicScanParams 
+ * \brief  Print periodic scan parameters for debug purposes
+ * 
+ * Print periodic scan parameters for debug purposes
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  pCommand - pointer to the periodic scan command to print
+ * \return None
+ * \sa     cmdBld_debugPrintPeriodicScanChannles
+ */ 
+void cmdBld_debugPrintPeriodicScanParams (TI_HANDLE hCmdBld, ConnScanParameters_t* pCommand)
+{
+    TCmdBld                 *pCmdBld = (TCmdBld *)hCmdBld;
+
+    /* print periodic scan params command */
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Cycle intervals:\n");
+    TRACE8(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "0:  %-6d %-6d %-6d %-6d %-6d %-6d %-6d %-6d\n", pCommand->cycleIntervals[ 0 ], pCommand->cycleIntervals[ 1 ], pCommand->cycleIntervals[ 2 ], pCommand->cycleIntervals[ 3 ], pCommand->cycleIntervals[ 4 ], pCommand->cycleIntervals[ 5 ], pCommand->cycleIntervals[ 6 ], pCommand->cycleIntervals[ 7 ]);
+    TRACE8(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "8:  %-6d %-6d %-6d %-6d %-6d %-6d %-6d %-6d\n", pCommand->cycleIntervals[ 8 ], pCommand->cycleIntervals[ 9 ], pCommand->cycleIntervals[ 10 ], pCommand->cycleIntervals[ 11 ], pCommand->cycleIntervals[ 12 ], pCommand->cycleIntervals[ 13 ], pCommand->cycleIntervals[ 14 ], pCommand->cycleIntervals[ 15 ]);
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "RSSI threshold: %d, SNR threshold: %d, number of cycles: %d, reporth threshold: %d\n", pCommand->rssiThreshold, pCommand->snrThreshold, pCommand->maxNumOfCycles, pCommand->reportThreshold);
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Terminate on report: %d, result tag: %d, BSS type: %d, number of probe requests: %d\n", pCommand->terminateOnReport, pCommand->resultsTag, pCommand->bssType, pCommand->numProbe);
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "SSID filter type: %d, SSID length: %d, SSID: \n", pCommand->ssidFilterType, pCommand->ssidLength);
+    /* print channel info */
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "2.4 GHz Channels:\n");
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "-----------------\n");
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Number of passive channels: %d, number of active channels: %d\n", pCommand->numOfPassive[ 0 ], pCommand->numOfActive[ 0 ]);
+    cmdBld_debugPrintPeriodicScanChannles (hCmdBld, &(pCommand->channelList[ 0 ]),
+                                           pCommand->numOfPassive[ 0 ] + 
+                                           pCommand->numOfActive[ 0 ]);
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "5.0 GHz Channels:\n");
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "-----------------\n");
+    TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Number of passive channels: %d, number of DFS channels: %d, number of active channels: %d\n", pCommand->numOfPassive[ 1 ], pCommand->numOfDfs, pCommand->numOfActive[ 2 ]);
+    cmdBld_debugPrintPeriodicScanChannles (hCmdBld, &(pCommand->channelList[ CONN_SCAN_MAX_CHANNELS_BG ]),
+                                           pCommand->numOfPassive[ 1 ] + 
+                                           pCommand->numOfActive[ 1 ] +
+                                           pCommand->numOfDfs);
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "4.9 GHz channles:\n");
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "-----------------\n");
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Number of passive channels: %d, number of active channels: %d\n", pCommand->numOfPassive[ 2 ], pCommand->numOfActive[ 2 ]);
+    cmdBld_debugPrintPeriodicScanChannles (hCmdBld, &(pCommand->channelList[ CONN_SCAN_MAX_CHANNELS_BG + CONN_SCAN_MAX_CHANNELS_A ]),
+                                           pCommand->numOfPassive[ 2 ] + 
+                                           pCommand->numOfActive[ 2 ]);
+}
+
+/** 
+ * \fn     cmdBld_debugPrintPeriodicScanSsidList 
+ * \brief  Print periodic scan SSID list for debug purposes
+ * 
+ * Print periodic scan SSID list for debug purposes
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  pCommand - pointer to the periodic scan SSID list command to print
+ * \return None
+ * \sa     cmdBld_debugPrintPeriodicScanParams
+ */ 
+void cmdBld_debugPrintPeriodicScanSsidList (TI_HANDLE hCmdBld, ConnScanSSIDList_t* pCommand)
+{
+    TCmdBld                 *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT32               uIndex;
+
+    /* print SSID list command */
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "SSID list:\n");
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "---------\n");
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Num of entries: %d\n", pCommand->numOfSSIDEntries);
+    for (uIndex = 0; uIndex < pCommand->numOfSSIDEntries; uIndex++)
+    {
+        TRACE3(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "index: %d, SSID type: %d, SSID length:% d, SSID string:\n", uIndex, pCommand->SSIDList[ uIndex ].ssidType, pCommand->SSIDList[ uIndex ].ssidLength);
+    }
+
+}
+
+/** 
+ * \fn     cmdBld_BuildPeriodicScanChannlesn 
+ * \brief  Copy channels info for periodic scan to FW structure for a specific band and scan type 
+ * 
+ * Copy channels info, from driver structure, to FW structure, for periodic scan, for a specific
+ * band and scan type.
+ * 
+ * \param  pPeriodicScanParams - driver priodic scan parameters (source)
+ * \param  pChannelList - FW scan channel list (destination)
+ * \param  eScanType - scan type (passive or active)
+ * \param  eRadioBand - band (G, A or J)
+ * \param  uPassiveScanDfsDwellTime - Dwell time for passive scan on DFS channels (in milli-secs)
+ * \return Number of channels found for this scan type and band
+ * \sa     cmdBld_StartPeriodicScan 
+ */ 
+TI_UINT32 cmdBld_BuildPeriodicScanChannles (TPeriodicScanParams *pPeriodicScanParams, 
+                                            ConnScanChannelInfo_t *pChannelList,
+                                            EScanType eScanType, ERadioBand eRadioBand,
+                                            TI_UINT32 uPassiveScanDfsDwellTime)
+{
+    TI_UINT32       uIndex, uNumChannels = 0;
+
+    /* check all channels */
+    for (uIndex = 0; uIndex < pPeriodicScanParams->uChannelNum; uIndex++)
+    {
+        /* if this channel is on the required band and uses the required scan type */
+        if ((eRadioBand == pPeriodicScanParams->tChannels[ uIndex ].eBand) &&
+            (eScanType == pPeriodicScanParams->tChannels[ uIndex ].eScanType))
+        {
+            /* update scan parameters */
+            pChannelList[ uNumChannels ].channel = (TI_UINT8)pPeriodicScanParams->tChannels[ uIndex ].uChannel;
+            pChannelList[ uNumChannels ].passiveScanDuration = ENDIAN_HANDLE_WORD ((TI_UINT16)uPassiveScanDfsDwellTime);
+            pChannelList[ uNumChannels ].scanMaxDuration = 
+                ENDIAN_HANDLE_WORD ((TI_UINT16)pPeriodicScanParams->tChannels[ uIndex ].uMaxDwellTimeMs);
+            pChannelList[ uNumChannels ].scanMinDuration = 
+                ENDIAN_HANDLE_WORD ((TI_UINT16)pPeriodicScanParams->tChannels[ uIndex ].uMinDwellTimeMs);
+            pChannelList[ uNumChannels ].txPowerLevelDbm = (TI_UINT8)pPeriodicScanParams->tChannels[ uIndex ].uTxPowerLevelDbm;
+            if (SCAN_TYPE_PACTSIVE == eScanType) /* DFS channel */
+            {
+                pChannelList[ uNumChannels ].passiveScanDuration = ENDIAN_HANDLE_WORD ((TI_UINT16)uPassiveScanDfsDwellTime);
+                pChannelList[ uNumChannels ].channelFlags = 1; /* mark as DFS channel */
+            }
+            else
+            {
+                pChannelList[ uNumChannels ].channelFlags = 0; /* mark as not DFS channel */
+            }
+
+            /* advance mathcing channel counter */
+            uNumChannels++;
+        }
+    }
+
+    /* return channel count */
+    return uNumChannels;
+}
+
+/** 
+ * \fn     cmdBld_StartPeriodicScan 
+ * \brief  Copy driver periodic scan parameters to FW structures and send all commands to FW
+ * 
+ * Copy driver periodic scan parameters to FW structures (SSID list, parameters including channels
+ * and start command) and send all commands to FW.
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  pPeriodicScanParams - periodic scan driver parameters (source)
+ * \param  eScanTag - scan tag, used for scan complete and result tracking
+ * \param  uPassiveScanDfsDwellTimeUs - Passive dwell time for DFS channels
+ * \param  fScanCommandResponseCB - scan command complete CB
+ * \param  hCb - scan command response handle
+ * \return TI_OK on success, other codes indicate failure
+ * \sa     cmdBld_BuildPeriodicScanChannles, cmdBld_StopPeriodicScan
+ */ 
+TI_STATUS cmdBld_StartPeriodicScan (TI_HANDLE hCmdBld, TPeriodicScanParams *pPeriodicScanParams,
+                                    EScanResultTag eScanTag, TI_UINT32 uPassiveScanDfsDwellTimeMs,
+                                    void* fScanCommandResponseCB, TI_HANDLE hCb)
+{
+    TCmdBld                         *pCmdBld = (TCmdBld *)hCmdBld;
+    ConnScanParameters_t            tFWPeriodicScanParams;
+    ConnScanSSIDList_t              tFWSsidList;
+    PeriodicScanTag                 tScanStart;
+    TI_UINT32                       uIndex;
+    TI_STATUS                       tStatus;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Building start periodic scan commands:\n");
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "--------------------------------------\n");
+    /* copy parameters to FW structure */
+    tFWPeriodicScanParams.bssType = (ScanBssType_e)pPeriodicScanParams->eBssType;
+    for (uIndex = 0; uIndex < PERIODIC_SCAN_MAX_INTERVAL_NUM; uIndex ++)
+    {
+        tFWPeriodicScanParams.cycleIntervals[ uIndex ] = 
+            ENDIAN_HANDLE_LONG (pPeriodicScanParams->uCycleIntervalMsec[ uIndex ]);
+    }
+    tFWPeriodicScanParams.maxNumOfCycles = (TI_UINT8)pPeriodicScanParams->uCycleNum;
+    tFWPeriodicScanParams.numProbe = (TI_UINT8)pPeriodicScanParams->uProbeRequestNum;
+    tFWPeriodicScanParams.reportThreshold = (TI_UINT8)pPeriodicScanParams->uFrameCountReportThreshold;
+    tFWPeriodicScanParams.rssiThreshold = (TI_UINT8)pPeriodicScanParams->iRssiThreshold;
+    tFWPeriodicScanParams.snrThreshold = (TI_INT8)pPeriodicScanParams->iSnrThreshold;
+    tFWPeriodicScanParams.terminateOnReport = (TI_UINT8)pPeriodicScanParams->bTerminateOnReport;
+    tFWPeriodicScanParams.resultsTag = (TI_UINT8)eScanTag;
+    switch (pPeriodicScanParams->uSsidNum)
+    {
+    case 0: /* No SSIDs defined - no need to filter according to SSID */
+        tFWPeriodicScanParams.ssidFilterType = (ScanSsidFilterType_e)SCAN_SSID_FILTER_TYPE_ANY;
+        tFWPeriodicScanParams.ssidLength = 0;
+        break;
+
+    case 1: /* Only one SSID defined - copy it to the scan command (no need to send SSID list as well) */
+        tFWPeriodicScanParams.ssidFilterType = (ScanSsidFilterType_e)SCAN_SSID_FILTER_TYPE_SPECIFIC;
+        tFWPeriodicScanParams.ssidLength = (TI_UINT8)pPeriodicScanParams->tDesiredSsid[ 0 ].tSsid.len;
+        os_memoryCopy (pCmdBld->hOs, (void*)&(tFWPeriodicScanParams.ssid[ 0 ]), 
+                       (void*)&(pPeriodicScanParams->tDesiredSsid[ 0 ].tSsid.str[ 0 ]),
+                       pPeriodicScanParams->tDesiredSsid[ 0 ].tSsid.len);
+        break;
+
+    default: /* More than one SSID - copy SSIDs to SSID list command */
+        tFWPeriodicScanParams.ssidFilterType = (ScanSsidFilterType_e)SCAN_SSID_FILTER_TYPE_LIST;
+        tFWPeriodicScanParams.ssidLength = 0;
+        tFWSsidList.numOfSSIDEntries = (TI_UINT8)pPeriodicScanParams->uSsidNum;
+        for (uIndex = 0; uIndex < pPeriodicScanParams->uSsidNum; uIndex++)
+        {
+            tFWSsidList.SSIDList[ uIndex ].ssidType = 
+                (TI_UINT8)pPeriodicScanParams->tDesiredSsid[ uIndex ].eVisability;
+            tFWSsidList.SSIDList[ uIndex ].ssidLength = 
+                (TI_UINT8)pPeriodicScanParams->tDesiredSsid[ uIndex ].tSsid.len;
+            os_memoryCopy (pCmdBld->hOs, (void*)&(tFWSsidList.SSIDList[ uIndex ].ssid[ 0 ]),
+                           (void*)&(pPeriodicScanParams->tDesiredSsid[ uIndex ].tSsid.str[ 0 ]),
+                           tFWSsidList.SSIDList[ uIndex ].ssidLength);
+        }
+
+        /* print the SSID list parameters */
+        cmdBld_debugPrintPeriodicScanSsidList (hCmdBld, &tFWSsidList);
+
+        /* send the SSID list command */
+        tStatus = cmdBld_CmdIeScanSsidList (hCmdBld, &tFWSsidList, NULL, NULL);
+        if (TI_OK != tStatus)
+        {
+            TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR , "cmdBld_StartPeriodicScan: status %d when configuring SSID list", tStatus);
+            return tStatus;
+        }
+        break;
+    }
+
+    /* copy channels */
+    tFWPeriodicScanParams.numOfPassive[ 0 ] =  /* build passive B/G channels */
+        cmdBld_BuildPeriodicScanChannles (pPeriodicScanParams, &(tFWPeriodicScanParams.channelList[ 0 ]),
+                                          SCAN_TYPE_NORMAL_PASSIVE, RADIO_BAND_2_4_GHZ, uPassiveScanDfsDwellTimeMs);
+    tFWPeriodicScanParams.numOfActive[ 0 ] = /* build active B/G channels */
+        cmdBld_BuildPeriodicScanChannles (pPeriodicScanParams, &(tFWPeriodicScanParams.channelList[ tFWPeriodicScanParams.numOfPassive[ 0 ] ]),
+                                          SCAN_TYPE_NORMAL_ACTIVE, RADIO_BAND_2_4_GHZ, uPassiveScanDfsDwellTimeMs);
+    tFWPeriodicScanParams.numOfPassive[ 1 ] = /* build passive A channels */
+        cmdBld_BuildPeriodicScanChannles (pPeriodicScanParams, &(tFWPeriodicScanParams.channelList[ CONN_SCAN_MAX_CHANNELS_BG ]),
+                                          SCAN_TYPE_NORMAL_PASSIVE, RADIO_BAND_5_0_GHZ, uPassiveScanDfsDwellTimeMs);
+    tFWPeriodicScanParams.numOfDfs = /* build DFS A channels */
+        cmdBld_BuildPeriodicScanChannles (pPeriodicScanParams, &(tFWPeriodicScanParams.channelList[ CONN_SCAN_MAX_CHANNELS_BG + tFWPeriodicScanParams.numOfPassive[ 1 ] ]),
+                                          SCAN_TYPE_PACTSIVE, RADIO_BAND_5_0_GHZ, uPassiveScanDfsDwellTimeMs);
+    tFWPeriodicScanParams.numOfActive[ 1 ] = /* build active A channels */
+        cmdBld_BuildPeriodicScanChannles (pPeriodicScanParams, &(tFWPeriodicScanParams.channelList[ CONN_SCAN_MAX_CHANNELS_BG + tFWPeriodicScanParams.numOfPassive[ 1 ] + tFWPeriodicScanParams.numOfDfs ]),
+                                          SCAN_TYPE_NORMAL_ACTIVE, RADIO_BAND_5_0_GHZ, uPassiveScanDfsDwellTimeMs);
+
+    /* until J is supported, mark zero channels for J passive and active */
+    tFWPeriodicScanParams.numOfPassive[ 2 ] = 0;
+    tFWPeriodicScanParams.numOfActive[ 2 ] = 0;
+
+    /* print the command */
+    cmdBld_debugPrintPeriodicScanParams (hCmdBld, &tFWPeriodicScanParams);
+
+    /* Send the periodic scan parameters command */
+    tStatus = cmdBld_CmdIePeriodicScanParams (hCmdBld, &tFWPeriodicScanParams, NULL, NULL);
+    if (TI_OK != tStatus)
+    {
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_ERROR , "cmdBld_StartPeriodicScan: status %d when configuring periodic scan parameters", tStatus);
+        return tStatus;
+    }
+
+    /* send the periodic scan start command */
+    tScanStart.scanTag = eScanTag;
+    return cmdBld_CmdIeStartPeriodicScan (hCmdBld, &tScanStart, fScanCommandResponseCB, hCb);
+}
+
+/** 
+ * \fn     cmdBld_StopPeriodicScan 
+ * \brief  Stops an on-going periodic scan operation
+ * 
+ * Stops an on-going periodic scan operation 
+ * 
+ * \param  hCmdBld - handle to the command builder object
+ * \param  eScanTag - scan tag, used for scan complete and result tracking
+ * \param  fScanCommandResponseCB - scan command complete CB
+ * \param  hCb - scan command response handle
+ * \return TI_OK on success, other codes indicate failure
+ * \sa     cmdBld_BuildPeriodicScanChannles, cmdBld_StartPeriodicScan
+ */ 
+TI_STATUS cmdBld_StopPeriodicScan (TI_HANDLE hCmdBld, EScanResultTag eScanTag, 
+                                   void* fScanCommandResponseCB, TI_HANDLE hCb)
+{
+    PeriodicScanTag tScanStop;
+
+    /* send the periodic scan stop command */
+    tScanStop.scanTag = eScanTag;
+    return cmdBld_CmdIeStopPeriodicScan (hCmdBld, &tScanStop, fScanCommandResponseCB, hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_SetBssType()
+ ****************************************************************************
+ * DESCRIPTION: Set Bss type, set RxFilter 
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+static TI_STATUS cmdBld_CmdSetBssType (TI_HANDLE hCmdBld, ScanBssType_e BssType, TI_UINT8 *HwBssType)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    switch (BssType)
+    {
+    case BSS_INFRASTRUCTURE:
+        DB_BSS(hCmdBld).BssType = BSS_TYPE_STA_BSS;
+        cmdBld_SetRxFilter (hCmdBld, RX_CONFIG_OPTION_FOR_JOIN, RX_FILTER_OPTION_JOIN);
+        break;
+
+    case BSS_INDEPENDENT:
+        DB_BSS(hCmdBld).BssType = BSS_TYPE_IBSS;
+        cmdBld_SetRxFilter (hCmdBld, RX_CONFIG_OPTION_FOR_IBSS_JOIN, RX_FILTER_OPTION_DEF);
+        break;
+
+    default: 
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_FATAL_ERROR, "cmdBld_SetBssType: FATAL_ERROR, unknown BssType %d\n", BssType);
+        return TI_NOK;
+    }
+
+    *HwBssType = DB_BSS(hCmdBld).BssType;
+
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *                      cmdBld_StartJoin()
+ ****************************************************************************
+ * DESCRIPTION: Enable Rx/Tx and send Start/Join command 
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdStartJoin (TI_HANDLE hCmdBld, ScanBssType_e BssType, void *fJoinCompleteCB, TI_HANDLE hCb)
+{
+    TI_UINT8  HwBssType = 0;
+#ifdef TI_DBG  
+    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8 *pBssId = DB_BSS(hCmdBld).BssId;
+
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INIT, "cmdBld_StartJoin: Enable Tx, Rx and Start the Bss, type=%d\n", BssType);
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INIT, "------------------------------------------------------------\n");
+    TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INIT, "START/JOIN, SSID=, BSSID=%02X-%02X-%02X-%02X-%02X-%02X, Chan=%d\n", pBssId[0], pBssId[1], pBssId[2], pBssId[3], pBssId[4], pBssId[5], DB_BSS(hCmdBld).RadioChannel);
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INIT, "------------------------------------------------------------\n");
+#endif /* TI_DBG */
+
+    /* 
+     * set RxFilter (but don't write it to the FW, this is done in the join command),
+     * Configure templates content, ...
+     */
+    cmdBld_CmdSetBssType (hCmdBld, BssType, &HwBssType);
+
+    return cmdBld_CmdIeStartBss (hCmdBld, HwBssType, fJoinCompleteCB, hCb);
+}
+
+
+TI_STATUS cmdBld_CmdJoinBss (TI_HANDLE hCmdBld, TJoinBss *pJoinBssParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld        *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams    *pWlanParams = &DB_WLAN(hCmdBld);
+    TBssInfoParams *pBssInfoParams = &DB_BSS(hCmdBld);
+#ifdef TI_DBG
+    TI_UINT8 dbgSsidStr[33];
+#endif /* TI_DBG */
+
+    /* for debug purpose, can be removed later*/
+    if (pJoinBssParams->ssidLength > 32)
+        pJoinBssParams->ssidLength = 32;
+
+    /* Update Tx-Session-Counter in the Ctrl field of the Join command. */
+    pBssInfoParams->Ctrl &= ~JOIN_CMD_CTRL_TX_SESSION;
+    pBssInfoParams->Ctrl |= (TI_UINT8)(pJoinBssParams->txSessionCount << JOIN_CMD_CTRL_OFFSET_TX_SESSION);
+
+#ifdef TI_DBG
+    os_memoryCopy (pCmdBld->hOs, (void *)dbgSsidStr, (void *)pJoinBssParams->pSSID, pJoinBssParams->ssidLength);
+    dbgSsidStr[pJoinBssParams->ssidLength] = '\0';
+
+    TRACE14(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "TWD_JoinBss : bssType = %d, beaconInterval = %d, dtimInterval = %d, channel = %d, BSSID = %x-%x-%x-%x-%x-%x, ssidLength = %d, basicRateSet = 0x%x, RadioBand = %d, Ctrl = 0x%x", pJoinBssParams->bssType, pJoinBssParams->beaconInterval, pJoinBssParams->dtimInterval, pJoinBssParams->channel, pJoinBssParams->pBSSID[0], pJoinBssParams->pBSSID[1], pJoinBssParams->pBSSID[2], pJoinBssParams->pBSSID[3], pJoinBssParams->pBSSID[4], pJoinBssParams->pBSSID[5], pJoinBssParams->ssidLength, pJoinBssParams->basicRateSet, pJoinBssParams->radioBand, pBssInfoParams->Ctrl);
+#endif /* TI_DBG */
+    /*
+     * save Bss info parameters
+     */
+    DB_BSS(hCmdBld).ReqBssType = pJoinBssParams->bssType;
+    MAC_COPY (DB_BSS(hCmdBld).BssId, pJoinBssParams->pBSSID);
+    pBssInfoParams->tSsid.len = pJoinBssParams->ssidLength;
+    os_memoryZero (pCmdBld->hOs, (void *)pBssInfoParams->tSsid.str, sizeof (pBssInfoParams->tSsid.str));
+    os_memoryCopy (pCmdBld->hOs, (void *)pBssInfoParams->tSsid.str, (void *)pJoinBssParams->pSSID, pJoinBssParams->ssidLength);
+    DB_BSS(hCmdBld).BeaconInterval = pJoinBssParams->beaconInterval;
+    DB_BSS(hCmdBld).DtimInterval = (TI_UINT8)pJoinBssParams->dtimInterval;
+    DB_BSS(hCmdBld).RadioChannel = pJoinBssParams->channel;
+    DB_WLAN(hCmdBld).RadioBand = (TI_UINT8)pJoinBssParams->radioBand;
+    DB_BSS(hCmdBld).BasicRateSet = pJoinBssParams->basicRateSet;
+
+    /* In case we're joining a new BSS, reset the TKIP/AES sequence counter. */
+    /* The firmware resets its own counter - so we won't have mismatch in the following TX complete events */
+    pCmdBld->uSecuritySeqNumLow = 0;
+    pCmdBld->uSecuritySeqNumHigh = 0;
+
+    /* clear HT commands flags */
+    DB_BSS(hCmdBld).bHtCap = TI_FALSE;
+    DB_BSS(hCmdBld).bHtInf = TI_FALSE;
+
+    pWlanParams->bJoin = TI_TRUE;
+    pWlanParams->bStaConnected = TI_FALSE;
+    /*
+     * call the hardware to start/join the bss
+     */
+    return cmdBld_CmdStartJoin (hCmdBld, pJoinBssParams->bssType, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CmdTemplate (TI_HANDLE hCmdBld, TSetTemplate *pTemplateParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld   *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_STATUS  Stt;
+    TTemplateParams *pTemplate;
+    TI_UINT8   uIndex = 0;
+    TemplateType_e eType;
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CmdTemplate: Type=%d, size=%d, index=%d, RateMask=0x%x\n", pTemplateParams->type, pTemplateParams->len, pTemplateParams->index, pTemplateParams->uRateMask);
+
+    switch (pTemplateParams->type)
+    {
+        case BEACON_TEMPLATE:
+        eType = TEMPLATE_BEACON;
+        pTemplate = &(DB_TEMP(hCmdBld).Beacon);
+            break;
+
+        case PROBE_RESPONSE_TEMPLATE:
+        eType = TEMPLATE_PROBE_RESPONSE;
+        pTemplate = &(DB_TEMP(hCmdBld).ProbeResp);
+            break;
+
+        case PROBE_REQUEST_TEMPLATE:
+            if (pTemplateParams->eBand == RADIO_BAND_2_4_GHZ)
+            {
+            eType = CFG_TEMPLATE_PROBE_REQ_2_4;
+            pTemplate = &(DB_TEMP(hCmdBld).ProbeReq24);
+            }
+            else
+            {
+            eType = CFG_TEMPLATE_PROBE_REQ_5;
+            pTemplate = &(DB_TEMP(hCmdBld).ProbeReq50);
+            }
+            break;
+
+        case NULL_DATA_TEMPLATE:
+        eType = TEMPLATE_NULL_DATA;
+        pTemplate = &(DB_TEMP(hCmdBld).NullData);
+            break;
+
+        case PS_POLL_TEMPLATE:
+        eType = TEMPLATE_PS_POLL;
+        pTemplate = &(DB_TEMP(hCmdBld).PsPoll);
+            break;
+
+        case QOS_NULL_DATA_TEMPLATE:
+        eType = TEMPLATE_QOS_NULL_DATA;
+        pTemplate = &(DB_TEMP(hCmdBld).QosNullData);
+            break;
+
+        case KEEP_ALIVE_TEMPLATE:
+        eType = TEMPLATE_KLV;
+        uIndex = pTemplateParams->index;
+        pTemplate = &(DB_TEMP(hCmdBld).KeepAlive[uIndex]);
+            break;
+
+        case DISCONN_TEMPLATE:
+        eType = TEMPLATE_DISCONNECT;
+        pTemplate = &(DB_TEMP(hCmdBld).Disconn);
+        break;
+
+    default:
+        return TI_NOK;
+    }
+
+    /* Save template information to DB (for recovery) */
+    pTemplate->Size = pTemplateParams->len;
+    pTemplate->uRateMask = pTemplateParams->uRateMask;
+            os_memoryCopy (pCmdBld->hOs, 
+                   (void *)(pTemplate->Buffer), 
+                   (void *)(pTemplateParams->ptr), 
+                           pTemplateParams->len);
+
+    /* Configure template to FW */
+            Stt = cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, 
+                                              pTemplate, 
+                                                      (TI_UINT16)pTemplateParams->len,
+                                              eType,
+                                              uIndex, /* index is only relevant for keep-alive template */
+                                                      fCb,
+                                                      hCb);
+
+    return Stt;
+}
+
+
+/****************************************************************************
+ *                      cmdBld_switchChannel()
+ ****************************************************************************
+ * DESCRIPTION: Switching the serving channel 
+ * 
+ * INPUTS: channel  -   new channel number  
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdEnableTx (TI_HANDLE hCmdBld, TI_UINT8 channel, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CmdIeEnableTx (hCmdBld, channel, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_DisableTx()
+ ****************************************************************************
+ * DESCRIPTION: Disable Tx path. 
+ * 
+ * INPUTS: None
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdDisableTx (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CmdIeDisableTx (hCmdBld, fCb, hCb);
+}
+
+
+
+/****************************************************************************
+ *                      cmdBld_SwitchChannelCmd()
+ ****************************************************************************
+ * DESCRIPTION: Send Switch Channel command 
+ * 
+ * INPUTS: None  
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdSwitchChannel (TI_HANDLE hCmdBld, TSwitchChannelParams *pSwitchChannelCmd, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "\n SwitchChannelCmd :\n                             channelNumber = %d\n                             switchTime = %d\n                             txFlag = %d\n                             flush = %d \n ", pSwitchChannelCmd->channelNumber, pSwitchChannelCmd->switchTime, pSwitchChannelCmd->txFlag, pSwitchChannelCmd->flush);
+
+    DB_BSS(hCmdBld).RadioChannel = pSwitchChannelCmd->channelNumber;
+
+    return cmdBld_CmdIeSwitchChannel (hCmdBld, pSwitchChannelCmd, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_SwitchChannelCmd()
+ ****************************************************************************
+ * DESCRIPTION: Send Switch Channel command 
+ * 
+ * INPUTS: None  
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdSwitchChannelCancel (TI_HANDLE hCmdBld, TI_UINT8 channel, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "\n TWD_SwitchChannelCancelCmd :\n ");
+
+    DB_BSS(hCmdBld).RadioChannel = channel;
+
+    return cmdBld_CmdIeSwitchChannelCancel (hCmdBld, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_FwDisconnect()
+ ****************************************************************************
+ * DESCRIPTION: Disconnect. 
+ * 
+ * INPUTS: None
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdFwDisconnect (TI_HANDLE hCmdBld, TI_UINT32 uConfigOptions, TI_UINT32 uFilterOptions, DisconnectType_e uDisconType, TI_UINT16 uDisconReason, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
+
+    pWlanParams->bJoin = TI_FALSE;
+    pWlanParams->bStaConnected = TI_FALSE;
+
+    TRACE4(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Sending FW disconnect, ConfigOptions=%x, FilterOPtions=%x, uDisconType=%d, uDisconReason=%d\n",uConfigOptions, uFilterOptions, uDisconType, uDisconReason);
+
+
+    return cmdBld_CmdIeFwDisconnect (hCmdBld, uConfigOptions, uFilterOptions, uDisconType, uDisconReason, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CmdMeasurement (TI_HANDLE          hCmdBld, 
+                                 TMeasurementParams *pMeasurementParams,
+                                 void               *fCommandResponseCB, 
+                                 TI_HANDLE          hCb)
+{
+    return cmdBld_CmdIeMeasurement (hCmdBld, pMeasurementParams, fCommandResponseCB, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_measurementStop()
+ ****************************************************************************
+ * DESCRIPTION: send Command for stoping measurement  
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdMeasurementStop (TI_HANDLE hCmdBld, void* fMeasureCommandResponseCB, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_measurementStop\n");
+
+    return cmdBld_CmdIeMeasurementStop (hCmdBld, fMeasureCommandResponseCB, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ApDiscovery()
+ ****************************************************************************
+ * DESCRIPTION: send Command for AP Discovery 
+ *              to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdApDiscovery (TI_HANDLE hCmdBld, TApDiscoveryParams *pApDiscoveryParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ApDiscovery\n");
+
+    return cmdBld_CmdIeApDiscovery (hCmdBld, pApDiscoveryParams, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ApDiscoveryStop()
+ ****************************************************************************
+ * DESCRIPTION: send Command for stoping AP Discovery
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdApDiscoveryStop (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ApDiscoveryStop\n");
+    
+    return cmdBld_CmdIeApDiscoveryStop (hCmdBld, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CmdNoiseHistogram (TI_HANDLE hCmdBld, TNoiseHistogram *pNoiseHistParams, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CmdIeNoiseHistogram (hCmdBld, pNoiseHistParams, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_PowerMgmtConfigurationSet ()
+ ****************************************************************************
+ * DESCRIPTION: Set the ACX power management option IE
+ * 
+ * INPUTS: powerSaveParams
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdSetPsMode (TI_HANDLE hCmdBld, TPowerSaveParams* powerSaveParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    /* Rate conversion is done in the HAL */
+    cmdBld_ConvertAppRatesBitmap (powerSaveParams->NullPktRateModulation, 
+                                  0, 
+                                  &powerSaveParams->NullPktRateModulation);
+
+    TRACE5(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, " cmdBld_PowerMgmtConfigurationSet  ps802_11Enable=0x%x hangOverPeriod=%d needToSendNullData=0x%x  numNullPktRetries=%d  NullPktRateModulation=0x%x\n", powerSaveParams->ps802_11Enable, powerSaveParams->hangOverPeriod, powerSaveParams->needToSendNullData, powerSaveParams->numNullPktRetries, powerSaveParams->NullPktRateModulation);
+
+    return cmdBld_CmdIeSetPsMode (hCmdBld, powerSaveParams, fCb, hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_EnableRx()
+ ****************************************************************************
+ * DESCRIPTION: Enable Rx and send Start/Join command 
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdEnableRx (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CmdIeEnableRx (hCmdBld, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_CmdAddKey (TI_HANDLE hCmdBld, TSecurityKeys* pKey, TI_BOOL reconfFlag, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8     keyIdx  = (TI_UINT8)pKey->keyIndex;
+
+    /* store the security key for reconfigure phase (FW reload)*/
+    if (reconfFlag != TI_TRUE)
+    {
+        if (keyIdx >= (pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION + NO_OF_EXTRA_RECONF_SECUR_KEYS))
+        {
+            TRACE2(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CmdAddKey: ERROR Key keyIndex field out of range =%d, range is (0 to %d)\n", pKey->keyIndex, pCmdBld->tSecurity.uNumOfStations * NO_OF_RECONF_SECUR_KEYS_PER_STATION+NO_OF_EXTRA_RECONF_SECUR_KEYS - 1);
+            
+            return TI_NOK;
+        }
+
+        if (pKey->keyType == KEY_NULL)
+        {
+            TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, "cmdBld_CmdAddKey: ERROR KeyType is NULL_KEY\n");
+            
+            return TI_NOK;
+        }
+
+        os_memoryCopy (pCmdBld->hOs, 
+                       (void *)(DB_KEYS(pCmdBld).pReconfKeys + keyIdx),
+                       (void *)pKey, 
+                       sizeof(TSecurityKeys));
+    }
+    
+    switch (pCmdBld->tSecurity.eSecurityMode)
+    {
+        case TWD_CIPHER_WEP:
+        case TWD_CIPHER_WEP104:
+				return cmdBld_CmdAddWepKey (hCmdBld, pKey, fCb, hCb);
+                        
+        case TWD_CIPHER_TKIP:
+        case TWD_CIPHER_AES_CCMP:
+        #ifdef GEM_SUPPORT
+            case TWD_CIPHER_GEM:
+        #endif
+            return cmdBld_CmdAddWpaKey (hCmdBld, pKey, fCb, hCb);
+
+        default:
+            return TI_NOK;
+    }
+}
+
+
+TI_STATUS cmdBld_CmdAddWpaKey (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+ 
+    /* Only WEP, TKIP, AES keys are handled*/
+    switch (pKey->keyType)
+    {
+        case KEY_WEP:
+            /* Configure the encKeys to the HW - default keys cache*/
+            return cmdBld_CmdAddWepDefaultKey (hCmdBld, pKey, fCb, hCb);
+        
+        case KEY_TKIP:
+            /* Set the REAL TKIP key into the TKIP key cache*/
+            if (cmdBld_CmdAddTkipMicMappingKey (hCmdBld, pKey, fCb, hCb) != TI_OK)
+                return TI_NOK;
+
+            break;
+        
+        case KEY_AES:
+            if (cmdBld_CmdAddAesMappingKey (hCmdBld, pKey, fCb, hCb) != TI_OK)
+                return TI_NOK;
+            break;
+
+        #ifdef GEM_SUPPORT
+            case KEY_GEM:
+                if (cmdBld_CmdAddGemMappingKey (hCmdBld, pKey, fCb, hCb) != TI_OK)
+                    return TI_NOK;
+                break;
+        #endif
+        
+        default:
+            return TI_NOK;
+    }
+    
+    /* AES or TKIP key has been successfully added. Store the current */
+    /* key type of the unicast (i.e. transmit !) key                  */
+    if (!MAC_BROADCAST (pKey->macAddress))
+    {
+        pCmdBld->tSecurity.eCurTxKeyType = pKey->keyType;
+    }
+
+    return TI_OK;
+}
+
+
+TI_STATUS cmdBld_CmdRemoveWpaKey (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb)
+{
+    /* Only WEP, TKIP, AES keys are handled*/
+    switch (pKey->keyType)
+    {
+        case KEY_WEP:
+            /* Configure the encKeys to the HW - default keys cache*/
+            return cmdBld_CmdRemoveWepKey (hCmdBld, pKey, fCb, hCb);
+        
+        case KEY_TKIP:
+            /* Configure the encKeys to the HW - mapping keys cache*/
+            /* configure through SET_KEYS command */
+
+            /* remove the TKIP key from the TKIP key cache*/
+            if (cmdBld_CmdRemoveTkipMicMappingKey (hCmdBld, pKey, fCb, hCb) != TI_OK)
+                return (TI_NOK);
+            break;
+        
+        case KEY_AES:
+            if (cmdBld_CmdRemoveAesMappingKey (hCmdBld, pKey, fCb, hCb) != TI_OK)
+                return TI_NOK;
+            break;
+
+        #ifdef GEM_SUPPORT
+            case KEY_GEM:
+                if (cmdBld_CmdRemoveGemMappingKey (hCmdBld, pKey, fCb, hCb) != TI_OK)
+                    return TI_NOK;
+                break;
+        #endif
+        
+        default:
+            return TI_NOK;
+    }
+    
+    return TI_OK;
+}
+
+
+/*
+ * ----------------------------------------------------------------------------
+ * Function : cmdBld_CmdRemoveKey
+ *
+ * Input    : 
+ * Output   :
+ * Process  :
+ * Note(s)  :
+ * -----------------------------------------------------------------------------
+ */
+TI_STATUS cmdBld_CmdRemoveKey (TI_HANDLE hCmdBld, TSecurityKeys* pKey, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8  keyIdx  = (TI_UINT8)pKey->keyIndex;
+
+    /* Clear the remove key in the reconfigure data base */
+    (DB_KEYS(pCmdBld).pReconfKeys + keyIdx)->keyType = KEY_NULL;
+
+    switch (pCmdBld->tSecurity.eSecurityMode)
+    {
+        case TWD_CIPHER_WEP:
+        case TWD_CIPHER_WEP104:
+				return cmdBld_CmdRemoveWepKey (hCmdBld, pKey, fCb, hCb);
+        case TWD_CIPHER_TKIP:
+        case TWD_CIPHER_AES_CCMP:
+        #ifdef GEM_SUPPORT
+            case TWD_CIPHER_GEM:
+        #endif
+            return cmdBld_CmdRemoveWpaKey (hCmdBld, pKey, fCb, hCb);
+        
+        default:
+            return TI_NOK;
+    }
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdAddWepKey()
+ ****************************************************************************
+ * DESCRIPTION: Decide wheather to call cmdBld_CmdAddWepDefaultKey, or cmdBld_CmdAddWepMappingKey
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdAddWepKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb) 
+{    
+	/* Non WEP keys are trashed*/
+	if (aSecurityKey->keyType != KEY_WEP)
+    {
+        return TI_NOK;
+    }
+
+    return (cmdBld_CmdAddWepMappingKey (hCmdBld, aSecurityKey, fCb, hCb));            
+
+
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdRemoveWepKey()
+ ****************************************************************************
+ * DESCRIPTION: Decide wheather to call cmdBld_CmdRemoveWepDefaultKey, or cmdBld_CmdRemoveWepMappingKey
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdRemoveWepKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb) 
+{    
+	/* Non WEP keys are trashed*/
+	if (aSecurityKey->keyType != KEY_WEP)
+    {
+        return TI_NOK;
+    }
+
+    /* Check for mapping key or default key */
+    if ( MAC_NULL(&aSecurityKey->macAddress) )
+    {
+        /* Configure the encKeys to the HW - default keys cache*/
+        return (cmdBld_CmdRemoveWepDefaultKey (hCmdBld, aSecurityKey, fCb, hCb));             
+    } 
+    else /* Use key mapping */
+    {
+        return (cmdBld_CmdRemoveWepMappingKey (hCmdBld, aSecurityKey, fCb, hCb));            
+    }
+
+}
+
+/****************************************************************************
+ *                      cmdBld_WepDefaultKeyAdd()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual default key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdAddWepDefaultKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb) 
+{
+    TI_STATUS  status;
+    TI_UINT8   sMacAddrDummy[6]={0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+    status = cmdBld_CmdIeSetKey (hCmdBld, 
+                                 KEY_ADD_OR_REPLACE,
+                                 sMacAddrDummy, 
+                                 aSecurityKey->encLen, 
+                                 CIPHER_SUITE_WEP,
+                                 aSecurityKey->keyIndex, 
+                                 (TI_UINT8*)aSecurityKey->encKey, 
+                                 0,
+                                 0,
+                                 fCb, 
+                                 hCb);
+    return status;
+}
+
+/****************************************************************************
+ *                      cmdBld_WepDefaultKeyRemove()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual default key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdSetWepDefaultKeyId (TI_HANDLE hCmdBld, TI_UINT8 aKeyIdVal, void *fCb, TI_HANDLE hCb) 
+{
+    TCmdBld  *pCmdBld          = (TCmdBld *)hCmdBld;
+    TI_UINT8 sMacAddrDummy[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+    /* Save the deafult key ID for reconfigure phase */
+    DB_KEYS(pCmdBld).bDefaultKeyIdValid  = TI_TRUE;
+    DB_KEYS(pCmdBld).uReconfDefaultKeyId = aKeyIdVal;
+
+    return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_SET_ID,
+                               sMacAddrDummy, 
+                               0, 
+                               CIPHER_SUITE_WEP,
+                               aKeyIdVal, 
+                               0, 
+                               0, 
+                               0,
+                               fCb, 
+                               hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_WepDefaultKeyRemove()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual default key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdRemoveWepDefaultKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb) 
+{
+    TI_UINT8  sMacAddrDummy[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+
+    return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_REMOVE,
+                               sMacAddrDummy, 
+                               aSecurityKey->encLen, 
+                               CIPHER_SUITE_WEP,
+                               aSecurityKey->keyIndex, 
+                               (TI_UINT8*)aSecurityKey->encKey, 
+                               0, 
+                               0,
+                               fCb, 
+                               hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_WepMappingKeyAdd()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual mapping key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdAddWepMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_ADD_OR_REPLACE,
+                               (TI_UINT8*)aSecurityKey->macAddress, 
+                               aSecurityKey->encLen, 
+                               CIPHER_SUITE_WEP,
+                               aSecurityKey->keyIndex, 
+                               (TI_UINT8*)aSecurityKey->encKey, 
+                               0, 
+                               0,
+                               fCb, 
+                               hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_WepMappingKeyRemove()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual mapping key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdRemoveWepMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb)
+{
+	/*In the new security interface it is not allowed to remove uni-cast keys. it will be cleaned on the next join command*/
+	if (!MAC_BROADCAST(aSecurityKey->macAddress) ) 
+	{
+		return TI_OK;
+	}
+    return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_REMOVE,
+                               (TI_UINT8*)aSecurityKey->macAddress, 
+                               aSecurityKey->encLen, 
+                               CIPHER_SUITE_WEP,
+                               aSecurityKey->keyIndex, 
+                               (TI_UINT8*)aSecurityKey->encKey, 
+                               0, 
+                               0,
+                               fCb, 
+                               hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_TkipMicMappingKeyAdd()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual mapping key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdAddTkipMicMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8      keyType;
+    TI_UINT8      keyBuffer[KEY_SIZE_TKIP];
+
+    keyType = CIPHER_SUITE_TKIP;
+
+    os_memoryCopy (pCmdBld->hOs, (void*)(&keyBuffer[0]), (void*)aSecurityKey->encKey, 16);
+    os_memoryCopy (pCmdBld->hOs, (void*)(&keyBuffer[16]), (void*)aSecurityKey->micRxKey, 8);
+    os_memoryCopy (pCmdBld->hOs, (void*)(&keyBuffer[24]), (void*)aSecurityKey->micTxKey, 8);
+
+    return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_ADD_OR_REPLACE,
+                               (TI_UINT8*)aSecurityKey->macAddress, 
+                               KEY_SIZE_TKIP, 
+                               keyType,
+                               aSecurityKey->keyIndex, 
+                               (TI_UINT8*)keyBuffer, 
+                               pCmdBld->uSecuritySeqNumLow, 
+                               pCmdBld->uSecuritySeqNumHigh,
+                               fCb, 
+                               hCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_TkipMappingKeyAdd()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual mapping key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdRemoveTkipMicMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb)
+{
+    TI_UINT8 keyType;
+
+    keyType = CIPHER_SUITE_TKIP;
+
+	/*In the new security interface it is not allowed to remove uni-cast keys. it will be cleaned on the next join command*/
+	if (!MAC_BROADCAST(aSecurityKey->macAddress) ) 
+	{
+		return TI_OK;
+	}
+
+
+    return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_REMOVE,
+                               (TI_UINT8*)aSecurityKey->macAddress, 
+                               aSecurityKey->encLen, 
+                               keyType,
+                               aSecurityKey->keyIndex, 
+                               (TI_UINT8*)aSecurityKey->encKey,
+                               0,
+                               0,
+                               fCb, 
+                               hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_AesMappingKeyAdd()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual Aes mapping key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdAddAesMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8      keyType;
+
+    keyType = CIPHER_SUITE_AES;
+
+    TRACE2(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_AesMappingKeyAdd: uSecuritySeqNumHigh=%ld, pHwCtrl->uSecuritySeqNumLow=%ld \n", pCmdBld->uSecuritySeqNumHigh, pCmdBld->uSecuritySeqNumLow);
+
+    return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_ADD_OR_REPLACE,
+                               (TI_UINT8*)aSecurityKey->macAddress, 
+                               aSecurityKey->encLen, keyType,
+                               aSecurityKey->keyIndex, 
+                               (TI_UINT8*)aSecurityKey->encKey, 
+                               pCmdBld->uSecuritySeqNumLow, 
+                               pCmdBld->uSecuritySeqNumHigh,
+                               fCb, 
+                               hCb);
+}
+
+
+ /****************************************************************************
+ *                      cmdBld_AesMappingKeyRemove()
+ ****************************************************************************
+ * DESCRIPTION: Remove  Aes mapping key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdRemoveAesMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb)
+{
+    TI_UINT8  keyType;
+
+    keyType = CIPHER_SUITE_AES;
+
+	/*In the new security interface it is not allowed to remove uni-cast keys. it will be cleaned on the next join command*/
+	if (!MAC_BROADCAST(aSecurityKey->macAddress) ) 
+	{
+		return TI_OK;
+	}
+
+	return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_REMOVE,
+                               (TI_UINT8*)aSecurityKey->macAddress, 
+                               aSecurityKey->encLen, 
+                               keyType,
+                               aSecurityKey->keyIndex, 
+                               (TI_UINT8*)aSecurityKey->encKey, 
+                               0, 
+                               0,
+                               fCb, 
+                               hCb);
+ }
+
+/****************************************************************************
+ *                      cmdBld_CmdSetStaState()
+ ****************************************************************************
+ * DESCRIPTION: Set station status . 
+ * 
+ * INPUTS: None
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdSetStaState (TI_HANDLE hCmdBld, TI_UINT8 staState, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    TWlanParams *pWlanParams = &DB_WLAN(hCmdBld);
+
+    pWlanParams->bStaConnected = TI_TRUE;
+    TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION , "Sending StaState %d\n",staState);
+
+    return cmdBld_CmdIeSetStaState (hCmdBld, staState, fCb, hCb);
+ }
+
+#ifdef GEM_SUPPORT
+/****************************************************************************
+ *                      cmdBld_CmdAddGemMappingKey()
+ ****************************************************************************
+ * DESCRIPTION: Set the actual GEM mapping key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdAddGemMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8      keyType;
+    TI_UINT8      keyBuffer[MAX_KEY_SIZE];
+
+    keyType = CIPHER_SUITE_GEM;
+
+    os_memoryCopy (pCmdBld->hOs, (void*)(&keyBuffer[0]), (void*)aSecurityKey->encKey, 16);
+    os_memoryCopy (pCmdBld->hOs, (void*)(&keyBuffer[16]), (void*)aSecurityKey->micRxKey, 16);
+    
+    return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_ADD_OR_REPLACE,
+                               aSecurityKey->macAddress, 
+                               MAX_KEY_SIZE, 
+                               keyType,
+                               aSecurityKey->keyIndex, 
+                               keyBuffer, 
+                               pCmdBld->uSecuritySeqNumLow, 
+                               pCmdBld->uSecuritySeqNumHigh,
+                               fCb, 
+                               hCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdRemoveGemMappingKey()
+ ****************************************************************************
+ * DESCRIPTION: Remove  GEM mapping key
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdRemoveGemMappingKey (TI_HANDLE hCmdBld, TSecurityKeys* aSecurityKey, void *fCb, TI_HANDLE hCb)
+{
+    TI_UINT8  keyType;
+
+    keyType = CIPHER_SUITE_GEM;
+
+	/*In the new security interface it is not allowed to remove uni-cast keys. it will be cleaned on the next join command*/
+	if (!MAC_BROADCAST(aSecurityKey->macAddress) ) 
+	{
+		return TI_OK;
+	}
+
+	return cmdBld_CmdIeSetKey (hCmdBld, 
+                               KEY_REMOVE,
+                               aSecurityKey->macAddress, 
+                               aSecurityKey->encLen, 
+                               keyType,
+                               aSecurityKey->keyIndex, 
+                               aSecurityKey->encKey, 
+                               0, 
+                               0,
+                               fCb, 
+                               hCb);
+ }
+#endif /*GEM_SUPPORT*/
+
+/****************************************************************************
+ *                      cmdBld_healthCheck()
+ ****************************************************************************
+ * DESCRIPTION: 
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdHealthCheck (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CmdIeHealthCheck\n");
+    
+    return cmdBld_CmdIeHealthCheck (hCmdBld, fCb, hCb);
+}
+
+TI_STATUS cmdBld_CmdTest (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TTestCmd* pTestCmd)
+{
+    return cmdBld_CmdIeTest (hCmdBld, fCb, hCb, pTestCmd);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldCmdIE.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1091 @@
+/*
+ * CmdBldCmdIE.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdBldCmdIE.c 
+ *  \brief Command builder. Command information elements
+ *
+ *  \see   CmdBldCmdIE.h 
+ */
+#define __FILE_ID__  FILE_ID_94
+#include "osApi.h"
+#include "tidef.h"
+#include "report.h"
+#include "TWDriver.h"
+#include "CmdQueue_api.h"
+#include "CmdBld.h"
+
+
+/* Local Macros */
+
+#define MAC_TO_VENDOR_PREAMBLE(mac) ((mac[0] << 16) | (mac[1] << 8) | mac[2])
+
+/*******************************************
+ * Wlan hardware Test (BIT)
+ * =================
+ *
+ * Tests description:
+ * ==================
+ * FCC           = Continuous modulated transmission (should not emit carrier)
+ * TELEC         = Continuous unmodulated carrier transmission (carrier only)
+ * PER_TX_STOP   = Stops the TX test in progress (FCC or TELEC).
+ * ReadRegister  = Read a register value.
+ * WriteRegister = Sets a register value.
+* 
+* Rx PER test
+* ========
+* PerRxStart       = Start or resume the PER measurement. This function will put the device in promiscuous mode, and resume counters update.
+* PerRxStop        = Stop Rx PER measurements. This function stop counters update and make it is safe to read the PER test result.
+* PerRxGetResults  = Get the last Rx PER test results.
+* PerRxClear       = Clear the Rx PER test results. 
+ */
+
+enum
+{
+/* 0 */   TEST_MOD_QPSK,
+/* 1 */   TEST_MOD_CCK,
+/* 2 */   TEST_MOD_PBCC,
+          TEST_MOD_NUMOF
+};
+
+enum
+{
+/* 0 */   TEST_MOD_LONG_PREAMBLE,
+/* 1 */   TEST_MOD_SHORT_PREAMBLE
+};
+
+enum
+{
+/* 0 */   TEST_BAND_2_4GHZ,
+/* 1 */   TEST_BAND_5GHZ,
+/* 2 */   TEST_BAND_4_9GHZ
+};
+
+
+enum
+{
+    MOD_PBCC = 1,
+    MOD_CCK,
+    MOD_OFDM
+};
+
+
+#define TEST_MOD_MIN_GAP           200
+#define TEST_MOD_MIN_TX_BODYLEN    0
+#define TEST_MOD_MAX_TX_BODYLEN    2304
+
+#define TEST_RX_CAL_SAFE_TIME      5000  /*uSec*/
+
+#define TEST_MOD_IS_GAP_OK(gap)     ((gap) >= TEST_MOD_MIN_GAP)
+
+#define TEST_MOD_IS_TX_BODYLEN_OK(len)  \
+   (INRANGE((len), TEST_MOD_MIN_TX_BODYLEN, TEST_MOD_MAX_TX_BODYLEN) && \
+   (((len) & 3) == 0) )
+
+#define TEST_MOD_IS_PREAMBLE_OK(p)  \
+   INRANGE((p), TEST_MOD_LONG_PREAMBLE, TEST_MOD_SHORT_PREAMBLE)
+
+
+#define RESEARVED_SIZE_FOR_RESPONSE 4
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeStartBss()
+ ****************************************************************************
+ * DESCRIPTION: Construct the StartBss command fileds and send it to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeStartBss (TI_HANDLE hCmdBld, BSS_e BssType, void *fJoinCompleteCb, TI_HANDLE hCb)
+{
+    TCmdBld            *pCmdBld = (TCmdBld *)hCmdBld;
+    StartJoinRequest_t  AcxCmd_StartBss;
+    StartJoinRequest_t *pCmd = &AcxCmd_StartBss;
+    TSsid              *pSsid = &DB_BSS(hCmdBld).tSsid;
+    TBssInfoParams     *pBssInfoParams = &DB_BSS(hCmdBld);
+    TI_UINT8 *BssId;
+    TI_UINT8 *cmdBssId;
+    EHwRateBitFiled HwBasicRatesBitmap;
+    TI_UINT32 i; 
+    
+    os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(StartJoinRequest_t));
+
+    /*
+     * Set RxCfg and RxFilterCfg values
+     */
+    pCmd->rxFilter.ConfigOptions = ENDIAN_HANDLE_LONG (DB_WLAN(hCmdBld).RxConfigOption);
+    pCmd->rxFilter.FilterOptions = ENDIAN_HANDLE_LONG (DB_WLAN(hCmdBld).RxFilterOption);
+    pCmd->beaconInterval = ENDIAN_HANDLE_WORD (DB_BSS(hCmdBld).BeaconInterval);
+    pCmd->dtimInterval = DB_BSS(hCmdBld).DtimInterval; 
+    pCmd->channelNumber = DB_BSS(hCmdBld).RadioChannel;
+    pCmd->bssType = BssType;
+    /* Add radio band */
+    pCmd->bssType |= DB_WLAN(hCmdBld).RadioBand << 4;
+    /* Bits 0-2: Tx-Session-Count. bit 7: indicates if to flush the Tx queues */
+    pCmd->ctrl = pBssInfoParams->Ctrl; 
+    
+    /*
+     * BasicRateSet
+     * The wlan hardware uses pHwMboxCmd field to determine the rate at which to transmit 
+     * control frame responses (such as ACK or CTS frames)
+     */
+    cmdBld_ConvertAppRatesBitmap (pBssInfoParams->BasicRateSet, 0, &HwBasicRatesBitmap);
+    pCmd->basicRateSet = ENDIAN_HANDLE_LONG(HwBasicRatesBitmap);
+
+    /* BSS ID - reversed order (see wlan hardware spec) */
+    BssId = DB_BSS(hCmdBld).BssId;
+    cmdBssId = (TI_UINT8*)&pCmd->bssIdL;
+    for (i = 0; i < MAC_ADDR_LEN; i++)
+        cmdBssId[i] = BssId[MAC_ADDR_LEN - 1 - i];
+
+    /* SSID string */ 
+    pCmd->ssidLength = pSsid->len;
+    os_memoryCopy (pCmdBld->hOs, (void *)pCmd->ssidStr, (void *)pSsid->str, pSsid->len);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_START_JOIN, 
+                             (TI_CHAR *)pCmd, 
+                             sizeof(*pCmd), 
+                             fJoinCompleteCb, 
+                             hCb, 
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeEnableRx()
+ ****************************************************************************
+ * DESCRIPTION: Construct the EnableRx command fileds and send it to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeEnableRx (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld  *pCmdBld = (TCmdBld *)hCmdBld;
+    TI_UINT8  uChannelNumber;
+
+    uChannelNumber = DB_DEFAULT_CHANNEL (hCmdBld);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_ENABLE_RX, 
+                             (TI_CHAR *)&uChannelNumber, 
+                             sizeof(TI_UINT8),
+                             fCb,
+                             hCb,
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeEnableTx()
+ ****************************************************************************
+ * DESCRIPTION: Construct the EnableTx command fileds and send it to the mailbox
+ *              Note: This Enable_TX command is used also for changing the serving 
+ *              channel.
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeEnableTx (TI_HANDLE hCmdBld, TI_UINT8 channel, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_ENABLE_TX, 
+                             (TI_CHAR *)&channel, 
+                             sizeof(TI_UINT8),
+                             fCb,
+                             hCb,
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeDisableRx()
+ ****************************************************************************
+ * DESCRIPTION: Construct the DisableRx command fileds and send it to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeDisableRx (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_DISABLE_RX, NULL, 0, fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CmdIeDisableTx()
+ ****************************************************************************
+ * DESCRIPTION: Construct the DisableTx command fileds and send it to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeDisableTx (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_DISABLE_TX, NULL, 0, fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CmdIeConfigureTemplateFrame()
+ ****************************************************************************
+ * DESCRIPTION: Generic function which sets the Fw with a template frame according
+ *              to the given template type.
+ * 
+ * INPUTS: templateType - CMD_BEACON, CMD_PROBE_REQ, CMD_PROBE_RESP etc.
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeConfigureTemplateFrame (TI_HANDLE         hCmdBld, 
+                                              TTemplateParams  *pTemplate, 
+                                              TI_UINT16         uFrameSize, 
+                                              TemplateType_e    eTemplateType, 
+                                              TI_UINT8          uIndex, 
+                                              void *            fCb, 
+                                              TI_HANDLE         hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    PktTemplate_t AcxCmd_PktTemplate;
+    PktTemplate_t *pCmd = &AcxCmd_PktTemplate;
+
+    /* If the frame size is too big - we truncate the frame template */
+    if (uFrameSize > MAX_TEMPLATES_SIZE)
+    {
+        TRACE3(pCmdBld->hReport, REPORT_SEVERITY_ERROR, ": Frame size (=%d) of CmdType (=%d) is bigger than MAX_TEMPLATES_SIZE(=%d) !!!\n", uFrameSize, eTemplateType, MAX_TEMPLATES_SIZE);
+
+        uFrameSize = MAX_TEMPLATES_SIZE;
+    }
+    
+    /* if pTemplate is NULL than it means that we just want to reserve place in Fw, and there is no need to copy */
+    if (pTemplate != NULL)
+    {
+        os_memoryCopy(pCmdBld->hOs, (void *)&pCmd->templateStart, (void *)(pTemplate->Buffer), uFrameSize);
+        pCmd->templateTxAttribute.enabledRates    = pTemplate->uRateMask;
+    }
+    pCmd->len = ENDIAN_HANDLE_WORD(uFrameSize);
+    pCmd->index = uIndex;
+    pCmd->templateType = eTemplateType;
+    pCmd->templateTxAttribute.shortRetryLimit = 10;
+    pCmd->templateTxAttribute.longRetryLimit  = 10;
+
+#ifdef TI_DBG
+    if (pCmdBld->uDbgTemplatesRateMask != 0) 
+    {
+        pCmd->templateTxAttribute.enabledRates = pCmdBld->uDbgTemplatesRateMask;
+    }
+#endif
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_SET_TEMPLATE, 
+                             (TI_CHAR *)pCmd, 
+                             sizeof (PktTemplate_t),
+                             fCb,
+                             hCb,
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeSetKey()
+ ****************************************************************************
+ * DESCRIPTION: Construct the SetKey command fileds and send it to the mailbox
+ * 
+ * INPUTS: 
+ *      Action      - add/remove key
+ *      MacAddr     - relevant only for mapping keys
+ *      KeySize     - key size
+ *      KeyType     - default/mapping/TKIP
+ *      KeyId       - relevant only for default keys
+ *      Key         - key data
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeSetKey (TI_HANDLE hCmdBld, 
+                              TI_UINT32 action, 
+                              TI_UINT8  *pMacAddr, 
+                              TI_UINT32 uKeySize, 
+                              TI_UINT32 uKeyType, 
+                              TI_UINT32 uKeyId, 
+                              TI_UINT8  *pKey, 
+                              TI_UINT32 uSecuritySeqNumLow, 
+                              TI_UINT32 uSecuritySeqNumHigh,
+                              void      *fCb, 
+                              TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    SetKey_t AcxCmd_SetKey;
+    SetKey_t *pCmd = &AcxCmd_SetKey;
+
+    os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
+
+    MAC_COPY (pCmd->addr, pMacAddr);
+
+    if (uKeySize > MAX_KEY_SIZE)
+    {
+        os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, MAX_KEY_SIZE);
+    }
+    else 
+    {
+        os_memoryCopy (pCmdBld->hOs, (void *)pCmd->key, (void *)pKey, uKeySize);
+    }
+
+    pCmd->action = ENDIAN_HANDLE_WORD((TI_UINT16)action);
+    pCmd->keySize = (TI_UINT8)uKeySize;
+    pCmd->type = (TI_UINT8)uKeyType;
+    pCmd->id = (TI_UINT8)uKeyId;
+    pCmd->ssidProfile = 0;
+
+    /* 
+     * Preserve TKIP/AES security sequence number after recovery.
+     * Note that our STA Tx is currently using only one sequence-counter 
+     * for all ACs (unlike the Rx which is separated per AC).  
+     */
+    pCmd->AcSeqNum16[0] = ENDIAN_HANDLE_WORD((TI_UINT16)uSecuritySeqNumLow);
+    pCmd->AcSeqNum16[1] = 0;
+    pCmd->AcSeqNum16[2] = 0;
+    pCmd->AcSeqNum16[3] = 0;
+    
+    pCmd->AcSeqNum32[0] = ENDIAN_HANDLE_LONG(uSecuritySeqNumHigh);
+    pCmd->AcSeqNum32[1] = 0;
+    pCmd->AcSeqNum32[2] = 0;
+    pCmd->AcSeqNum32[3] = 0;
+
+
+TRACE6(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Addr: %02x:%02x:%02x:%02x:%02x:%02x\n", pCmd->addr[0],pCmd->addr[1],pCmd->addr[2],pCmd->addr[3],pCmd->addr[4],pCmd->addr[5]);
+			
+TRACE7(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "Action=%x,keySize=0x%x,type=%x, id=%x, ssidProfile=%x, AcSeqNum16[0]=%x, AcSeqNum32[0]=%x\n", pCmd->action,pCmd->keySize, pCmd->type,pCmd->id,pCmd->ssidProfile,pCmd->AcSeqNum16[0],pCmd->AcSeqNum32[0] );
+
+	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_KEYS, (char *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeStartScan ()
+ ****************************************************************************
+ * DESCRIPTION: Send SCAN Command
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeStartScan (TI_HANDLE hCmdBld, ScanParameters_t* pScanParams, void *fScanResponseCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
+                             CMD_SCAN, 
+                             (TI_CHAR *)pScanParams,  
+                             sizeof(ScanParameters_t),
+                             fScanResponseCb, 
+                             hCb, 
+                             NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CmdIeStartSPSScan ()
+ ****************************************************************************
+ * DESCRIPTION: Send SPS SCAN Command
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeStartSPSScan (TI_HANDLE hCmdBld, ScheduledScanParameters_t* pScanParams, void* fScanResponseCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_SPS_SCAN, 
+                             (TI_CHAR *)pScanParams, 
+                             sizeof(ScheduledScanParameters_t),
+                             fScanResponseCb, 
+                             hCb, 
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeStopScan ()
+ ****************************************************************************
+ * DESCRIPTION: Construct the STOP_SCAN command fields and send it to the
+ *              mailbox 
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeStopScan (TI_HANDLE hCmdBld, void *fScanResponseCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CmdIeStopScan: -------------- \n");
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_STOP_SCAN, 0, 0, fScanResponseCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeStopSPSScan ()
+ ****************************************************************************
+ * DESCRIPTION: Construct the STOP_SPS_SCAN command fields and send it to the
+ *              mailbox 
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeStopSPSScan (TI_HANDLE hCmdBld, void* fScanResponseCB, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CmdIeStopSPSScan: -------------- \n");
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_STOP_SPS_SCAN, 0, 0, fScanResponseCB, hCb, NULL);
+}
+
+
+TI_STATUS cmdBld_CmdIeSetSplitScanTimeOut (TI_HANDLE hCmdBld, TI_UINT32 uTimeOut, void *fCB, TI_HANDLE hCb)
+{
+	TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+	enhancedTriggerTO_t Cmd_enhancedTrigger;
+	enhancedTriggerTO_t *pCmd = &Cmd_enhancedTrigger;
+
+TRACE1(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_CmdIeSetSplitScanTimeOut: uTimeOut=%d -------------- \n", uTimeOut);
+
+	pCmd->slicedScanTimeOut = uTimeOut;
+
+	return cmdQueue_SendCommand(pCmdBld->hCmdQueue, CMD_TRIGGER_SCAN_TO, (char *)pCmd, sizeof(*pCmd), fCB, hCb, NULL);
+}
+
+/** 
+ * \fn     cmdBld_CmdIeScanSsidList 
+ * \brief  Sets SSID list for periodic scan 
+ * 
+ * Sets SSID list for periodic scan 
+ * 
+ * \param  hCmdBld - handle to command builder object
+ * \param  pSsidList - command data
+ * \param  fScanResponseCB - command complete function callback
+ * \param  hCb - command complete callback handle
+ * \return TI_OK on success, any other code on error 
+ * \sa     cmdBld_CmdIePeriodicScanParams, cmdBld_CmdIeStartPeriodicScan, cmdBld_CmdIeStopPeriodicScan
+ */ 
+TI_STATUS cmdBld_CmdIeScanSsidList (TI_HANDLE hCmdBld, ConnScanSSIDList_t *pSsidList,
+                                    void* fScanResponseCB, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
+                             CMD_CONNECTION_SCAN_SSID_CFG, 
+                             (char *)pSsidList,  
+                             sizeof(ConnScanSSIDList_t),
+                             fScanResponseCB, 
+                             hCb, 
+                             NULL);
+}
+
+/** 
+ * \fn     cmdBld_CmdIePeriodicScanParams 
+ * \brief  Sets periodic scan parameters 
+ * 
+ * Sets periodic scan parameters
+ * 
+ * \param  hCmdBld - handle to command builder object
+ * \param  pPeriodicScanParams - command data
+ * \param  fScanResponseCB - command complete function callback
+ * \param  hCb - command complete callback handle
+ * \return TI_OK on success, any other code on error 
+ * \sa     cmdBld_CmdIeScanSsidList, cmdBld_CmdIeStartPeriodicScan, cmdBld_CmdIeStopPeriodicScan
+ */ 
+TI_STATUS cmdBld_CmdIePeriodicScanParams (TI_HANDLE hCmdBld, ConnScanParameters_t *pPeriodicScanParams,
+                                          void* fScanResponseCB, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
+                             CMD_CONNECTION_SCAN_CFG, 
+                             (char *)pPeriodicScanParams,  
+                             sizeof(ConnScanParameters_t),
+                             fScanResponseCB, 
+                             hCb, 
+                             NULL);
+}
+
+/** 
+ * \fn     cmdBld_CmdIeStartPeriodicScan 
+ * \brief  Starts a periodic scan operation
+ * 
+ * Starts a periodic scan operation
+ * 
+ * \param  hCmdBld - handle to command builder object
+ * \param  pPeriodicScanStart - command data
+ * \param  fScanResponseCB - command complete function callback
+ * \param  hCb - command complete callback handle
+ * \return TI_OK on success, any other code on error 
+ * \sa     cmdBld_CmdIeScanSsidList,  cmdBld_CmdIePeriodicScanParams, cmdBld_CmdIeStopPeriodicScan
+ */ 
+TI_STATUS cmdBld_CmdIeStartPeriodicScan (TI_HANDLE hCmdBld, PeriodicScanTag* pPeriodicScanStart,
+                                         void* fScanResponseCB, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
+                             CMD_START_PERIODIC_SCAN, 
+                             pPeriodicScanStart, sizeof (PeriodicScanTag),
+                             fScanResponseCB, 
+                             hCb, 
+                             NULL);
+}
+
+/** 
+ * \fn     cmdBld_CmdIeStopPeriodicScan
+ * \brief  Stops an on-going periodic scan operation 
+ * 
+ * Stops an on-going periodic scan operation
+ * 
+ * \param  hCmdBld - handle to command builder object
+ * \param  fScanResponseCB - command complete function callback
+ * \param  hCb - command complete callback handle
+ * \return TI_OK on success, any other code on error 
+ * \sa     cmdBld_CmdIeScanSsidList, cmdBld_CmdIePeriodicScanParams, cmdBld_CmdIeStartPeriodicScan
+ */ 
+TI_STATUS cmdBld_CmdIeStopPeriodicScan (TI_HANDLE hCmdBld, 
+                                        PeriodicScanTag* pPeriodicScanStop, 
+                                        void* fScanResponseCB, 
+                                        TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue,
+                             CMD_STOP_PERIODIC_SCAN, 
+                             pPeriodicScanStop, 
+                             sizeof(pPeriodicScanStop),
+                             fScanResponseCB, 
+                             hCb, 
+                             NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CmdIeNoiseHistogram ()
+ ****************************************************************************
+ * DESCRIPTION: Send NOISE_HISTOGRAM Command
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeNoiseHistogram (TI_HANDLE hCmdBld, TNoiseHistogram *pNoiseHistParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    NoiseHistRequest_t AcxCmd_NoiseHistogram;
+    NoiseHistRequest_t *pCmd = &AcxCmd_NoiseHistogram;
+
+    os_memoryZero(pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
+
+    pCmd->mode = ENDIAN_HANDLE_WORD((TI_UINT16)pNoiseHistParams->cmd);
+    pCmd->sampleIntervalUSec = ENDIAN_HANDLE_WORD(pNoiseHistParams->sampleInterval);
+
+    os_memoryCopy (pCmdBld->hOs, (void *)&(pCmd->thresholds[0]), (void *)&(pNoiseHistParams->ranges[0]), MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_NOISE_HIST, (TI_CHAR *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeSetPsMode()
+ ****************************************************************************
+ * DESCRIPTION: send Command for Power Management configuration 
+ *              to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeSetPsMode (TI_HANDLE hCmdBld, TPowerSaveParams* powerSaveParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    PSModeParameters_t   Cmd_PowerMgmtCnf;
+    PSModeParameters_t * pCmd = &Cmd_PowerMgmtCnf;
+
+    os_memoryZero(pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
+
+    if (powerSaveParams->ps802_11Enable)
+    {
+        pCmd->mode = 1;
+    }
+    else
+    {
+        pCmd->mode = 0;
+    }
+    
+    pCmd->hangOverPeriod            = powerSaveParams->hangOverPeriod;
+    pCmd->needToSendNullData        = powerSaveParams->needToSendNullData;
+    pCmd->rateToTransmitNullData    = ENDIAN_HANDLE_LONG(powerSaveParams->NullPktRateModulation);
+    pCmd->numberOfRetries           = powerSaveParams->numNullPktRetries;
+
+  	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_SET_PS_MODE, (TI_CHAR *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeSwitchChannel ()
+ ****************************************************************************
+ * DESCRIPTION: Send CMD_SWITCH_CHANNEL Command
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeSwitchChannel (TI_HANDLE hCmdBld, TSwitchChannelParams *pSwitchChannelCmd, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ChannelSwitchParameters_t AcxCmd_SwitchChannel;
+    ChannelSwitchParameters_t *pCmd = &AcxCmd_SwitchChannel;
+
+    os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
+
+    pCmd->channel = pSwitchChannelCmd->channelNumber;
+    pCmd->switchTime = pSwitchChannelCmd->switchTime;
+    pCmd->txSuspend = pSwitchChannelCmd->txFlag;
+    pCmd->flush = pSwitchChannelCmd->flush;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CHANNEL_SWITCH, (TI_CHAR *)pCmd, sizeof(*pCmd), fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeSwitchChannelCancel ()
+ ****************************************************************************
+ * DESCRIPTION: Send CMD_SWITCH_CHANNEL_CANCEL Command
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeSwitchChannelCancel (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_STOP_CHANNEL_SWICTH, 0, 0, fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeFwDisconnect()
+ ****************************************************************************
+ * DESCRIPTION: Construct the Disconnect command fileds and send it to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeFwDisconnect (TI_HANDLE hCmdBld, TI_UINT32 uConfigOptions, TI_UINT32 uFilterOptions, DisconnectType_e uDisconType, TI_UINT16 uDisconReason, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    DisconnectParameters_t AcxCmd_Disconnect;
+    
+    AcxCmd_Disconnect.rxFilter.ConfigOptions = ENDIAN_HANDLE_LONG(uConfigOptions);
+    AcxCmd_Disconnect.rxFilter.FilterOptions = ENDIAN_HANDLE_LONG(uFilterOptions);
+    AcxCmd_Disconnect.disconnectReason = ENDIAN_HANDLE_LONG(uDisconReason);
+    AcxCmd_Disconnect.disconnectType = uDisconType;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_DISCONNECT, 
+                             (void *)&AcxCmd_Disconnect, 
+                             sizeof(AcxCmd_Disconnect),
+                             fCb,
+                             hCb,
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeMeasurement()
+ ****************************************************************************
+ * DESCRIPTION: send Command for measurement configuration 
+ *              to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeMeasurement (TI_HANDLE          hCmdBld, 
+                                   TMeasurementParams *pMeasurementParams,
+                                   void               *fMeasureResponseCb, 
+                                   TI_HANDLE          hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    MeasurementParameters_t Cmd_MeasurementParam;
+    MeasurementParameters_t *pCmd = &Cmd_MeasurementParam;
+
+    os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
+    
+    pCmd->band =                    pMeasurementParams->band;
+    pCmd->channel =                 pMeasurementParams->channel;
+    pCmd->duration =                ENDIAN_HANDLE_LONG(pMeasurementParams->duration);
+    pCmd->rxFilter.ConfigOptions =  ENDIAN_HANDLE_LONG(pMeasurementParams->ConfigOptions);
+    pCmd->rxFilter.FilterOptions =  ENDIAN_HANDLE_LONG(pMeasurementParams->FilterOptions);
+    pCmd->scanTag =                 (TI_UINT8)pMeasurementParams->eTag;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_MEASUREMENT, 
+                             (TI_CHAR *)pCmd, 
+                             sizeof(*pCmd),
+                             fMeasureResponseCb, 
+                             hCb, 
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeMeasurementStop()
+ ****************************************************************************
+ * DESCRIPTION: send Command for stoping measurement  
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeMeasurementStop (TI_HANDLE hCmdBld, void* fMeasureResponseCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_STOP_MEASUREMENT, 
+                             0, 
+                             0,
+                             fMeasureResponseCb, 
+                             hCb, 
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeApDiscovery()
+ ****************************************************************************
+ * DESCRIPTION: send Command for AP Discovery 
+ *              to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeApDiscovery (TI_HANDLE hCmdBld, TApDiscoveryParams *pApDiscoveryParams, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ApDiscoveryParameters_t Cmd_ApDiscovery;
+    ApDiscoveryParameters_t *pCmd = &Cmd_ApDiscovery;
+
+    os_memoryZero (pCmdBld->hOs, (void *)pCmd, sizeof(*pCmd));
+    
+    pCmd->txPowerAttenuation = pApDiscoveryParams->txPowerDbm;
+    pCmd->numOfProbRqst = pApDiscoveryParams->numOfProbRqst;
+    pCmd->scanDuration  =  ENDIAN_HANDLE_LONG(pApDiscoveryParams->scanDuration);
+    pCmd->scanOptions   =  ENDIAN_HANDLE_WORD(pApDiscoveryParams->scanOptions);
+    pCmd->txdRateSet    =  ENDIAN_HANDLE_LONG(pApDiscoveryParams->txdRateSet);
+    pCmd->rxFilter.ConfigOptions =  ENDIAN_HANDLE_LONG(pApDiscoveryParams->ConfigOptions);
+    pCmd->rxFilter.FilterOptions =  ENDIAN_HANDLE_LONG(pApDiscoveryParams->FilterOptions);
+
+	return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_AP_DISCOVERY, 
+                             (void *)pCmd, 
+                             sizeof(*pCmd),
+                             fCb,
+                             hCb,
+                             NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeApDiscoveryStop()
+ ****************************************************************************
+ * DESCRIPTION: send Command for stoping AP Discovery
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeApDiscoveryStop (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_STOP_AP_DISCOVERY, 0, 0, fCb, hCb, NULL);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_CmdIeHealthCheck()
+ ****************************************************************************
+ * DESCRIPTION: 
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS:
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeHealthCheck (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_HEALTH_CHECK, NULL, 0, fCb, hCb, NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_CmdIeSetStaState()
+ ****************************************************************************
+ * DESCRIPTION: Construct the Disconnect command fileds and send it to the mailbox
+ * 
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeSetStaState (TI_HANDLE hCmdBld, TI_UINT8 staState, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    SetStaState_t AcxCmd_SetStaState;
+    
+    AcxCmd_SetStaState.staState = staState;
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_SET_STA_STATE, 
+                             (void *)&AcxCmd_SetStaState, 
+                             sizeof(AcxCmd_SetStaState),
+                             fCb,
+                             hCb,
+                             NULL);
+}
+
+/****************************************************************************
+ *                      cmdBld_BitIeTestCmd()
+ ****************************************************************************
+ * DESCRIPTION:   
+ * INPUTS: None 
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_CmdIeTest (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TTestCmd* pTestCmd)
+{
+    TCmdBld		 *pCmdBld = (TI_HANDLE)hCmdBld;
+    TI_UINT32	 paramLength;
+    TI_BOOL      bIsCBfuncNecessary = TI_TRUE;
+
+    if (NULL == pTestCmd)
+    {
+         TRACE0(pCmdBld->hReport, REPORT_SEVERITY_ERROR, " pTestCmd_Buf = NULL!!!\n");
+		 return TI_NOK;
+    }
+
+	if ( (TestCmdID_enum)pTestCmd->testCmdId < MAX_TEST_CMD_ID )
+	{
+        bIsCBfuncNecessary = TI_TRUE; 
+	}
+	else
+	{
+        TRACE1(pCmdBld->hReport, REPORT_SEVERITY_WARNING, " Unsupported testCmdId (%d)\n", pTestCmd->testCmdId);
+	}
+
+    if (bIsCBfuncNecessary && fCb == NULL) 
+    {
+        return TI_OK;
+    }
+	
+	switch( pTestCmd->testCmdId )
+	{
+		case TEST_CMD_PD_BUFFER_CAL:
+			paramLength = sizeof(TTestCmdPdBufferCal);
+			break;
+
+		case TEST_CMD_P2G_CAL:
+			paramLength = sizeof(TTestCmdP2GCal);
+			break;
+
+		case TEST_CMD_RX_STAT_GET:
+			paramLength = sizeof(RadioRxStatistics);
+			break;
+
+		/* packet */
+		case TEST_CMD_FCC:
+			paramLength = sizeof(TPacketParam);
+			break;
+
+		/* tone */
+		case TEST_CMD_TELEC:
+			paramLength = sizeof(TToneParam);
+			break;
+
+		case TEST_CMD_PLT_TEMPLATE:
+			paramLength = sizeof(TTxTemplate);
+			break;
+
+		/* channel tune */
+		case TEST_CMD_CHANNEL_TUNE:
+			paramLength = sizeof(TTestCmdChannel);
+			break;
+
+		case TEST_CMD_GET_FW_VERSIONS:
+			paramLength = sizeof(TFWVerisons);
+			break;
+
+        case TEST_CMD_INI_FILE_RADIO_PARAM:
+            paramLength = sizeof(IniFileRadioParam);
+            break;
+          
+        case TEST_CMD_INI_FILE_GENERAL_PARAM:
+            paramLength = sizeof(IniFileGeneralParam);
+            break;
+          
+		case TEST_CMD_PLT_GAIN_ADJUST:
+			paramLength = sizeof(uint32);
+			break;
+
+		case TEST_CMD_RUN_CALIBRATION_TYPE:
+			paramLength = sizeof(TTestCmdRunCalibration);
+			break;
+
+		case TEST_CMD_TX_GAIN_ADJUST:
+			paramLength = sizeof(TTxGainAdjust);
+			break;
+        case TEST_CMD_TEST_TONE:
+            paramLength = sizeof(TestToneParams_t);
+            break;
+
+		case TEST_CMD_SET_EFUSE:
+			paramLength = sizeof(EfuseParameters_t);
+			break;
+		case TEST_CMD_GET_EFUSE:
+			paramLength = sizeof(EfuseParameters_t);
+			break;
+
+		case TEST_CMD_RX_PLT_CAL:
+			paramLength = sizeof(RadioRxPltCal);
+			break;
+			
+		case TEST_CMD_UPDATE_PD_REFERENCE_POINT:
+			paramLength = sizeof(TTestCmdUpdateReferncePoint);
+			break;
+
+		case TEST_CMD_UPDATE_PD_BUFFER_ERRORS:
+			paramLength = sizeof(TTestCmdPdBufferErrors);
+			break;
+			
+		case TEST_CMD_POWER_MODE:
+			paramLength = sizeof(TTestCmdPowerMode);
+			break;
+
+                case TEST_CMD_FREE_RUN_RSSI:
+                        paramLength = sizeof(TTestCmdFreeRSSI);
+			break;
+
+
+		case TEST_CMD_STOP_TX:
+		case TEST_CMD_RX_STAT_STOP:
+		case TEST_CMD_RX_STAT_START:
+		case TEST_CMD_RX_STAT_RESET:
+		case TEST_CMD_RX_PLT_ENTER:
+		case TEST_CMD_RX_PLT_EXIT:
+			paramLength = 0;
+			break;
+
+		default:
+			paramLength = sizeof(pTestCmd->testCmd_u);
+	}
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                             CMD_TEST, 
+                             (void *)pTestCmd, 
+                             paramLength + RESEARVED_SIZE_FOR_RESPONSE,
+                             fCb, 
+                             hCb, 
+                             (void*)pTestCmd);    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldCmdIE.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,83 @@
+/*
+ * CmdBldCmdIE.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdBldCmdIE.h 
+ *  \brief Command builder. Command information elements
+ *
+ *  \see   CmdBld.c 
+ */
+
+#ifndef CMDBLDCMDIE_H
+#define CMDBLDCMDIE_H
+
+
+TI_STATUS cmdBld_CmdIeStartBss          (TI_HANDLE hCmdBld, BSS_e BssType, void *fJoinCompleteCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeEnableRx          (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeEnableTx          (TI_HANDLE hCmdBld, TI_UINT8 channel, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeDisableRx         (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeDisableTx         (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeInitMemory        (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeConfigureTemplateFrame (TI_HANDLE hCmdBld, TTemplateParams *pTemplate, TI_UINT16 uFrameSize, TemplateType_e templateType, TI_UINT8 uIndex, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeStartScan         (TI_HANDLE hCmdBld, ScanParameters_t* pScanParams, void* fScanCommandResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeStartSPSScan      (TI_HANDLE hCmdBld, ScheduledScanParameters_t* pScanParams, void* fScanCommandResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeStopScan          (TI_HANDLE hCmdBld, void *fScanCommandResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeStopSPSScan       (TI_HANDLE hCmdBld, void *fScanCommandResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeSetSplitScanTimeOut (TI_HANDLE hCmdBld, TI_UINT32 uTimeOut, void *fCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeScanSsidList      (TI_HANDLE hCmdBld, ConnScanSSIDList_t *pSsidList, void* fScanResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIePeriodicScanParams(TI_HANDLE hCmdBld, ConnScanParameters_t *pPeriodicScanParams, void* fScanResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeStartPeriodicScan (TI_HANDLE hCmdBld, PeriodicScanTag* pPeriodicScanStart, void* fScanResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeStopPeriodicScan  (TI_HANDLE hCmdBld, PeriodicScanTag* pPeriodicScanStop, void* fScanResponseCB, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeNoiseHistogram    (TI_HANDLE hCmdBld, TNoiseHistogram *pNoiseHistParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeSwitchChannel     (TI_HANDLE hCmdBld, TSwitchChannelParams *pSwitchChannelCmd, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeSwitchChannelCancel (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeSetKey            (TI_HANDLE hCmdBld, TI_UINT32 uAction, TI_UINT8 *pMacAddr, TI_UINT32 uKeySize, TI_UINT32 uKeyType, TI_UINT32 uKeyId, TI_UINT8 *pKey, TI_UINT32 uSecuritySeqNumLow, TI_UINT32 SecuritySeqNumHigh, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeSetPsMode         (TI_HANDLE hCmdBld, TPowerSaveParams *pPowerSaveParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeStartNewScan      (TI_HANDLE hCmdBld, TScanParams *pScanParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeFwDisconnect      (TI_HANDLE hCmdBld, TI_UINT32 uConfigOptions, TI_UINT32 uFilterOptions, DisconnectType_e uDisconType, TI_UINT16 uDisconReason, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeMeasurement       (TI_HANDLE hCmdBld, TMeasurementParams *pMeasurementParams, void* fMeasureCommandResponseCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeMeasurementStop   (TI_HANDLE hCmdBld, void *fMeasureCommandResponseCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeApDiscovery       (TI_HANDLE hCmdBld, TApDiscoveryParams* pMeasurementParams, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeApDiscoveryStop   (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeHealthCheck       (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_CmdIeSetStaState       (TI_HANDLE hCmdBld, TI_UINT8 staState, void *fCb, TI_HANDLE hCb);
+
+TI_STATUS cmdBld_CmdIeTest              (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TTestCmd* pTestCmdBuf);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldDb.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,358 @@
+/*
+ * CmdBldDb.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdBldDb.h 
+ *  \brief Command builder database
+ *
+ *  \see   CmdBld.h 
+ */
+
+#ifndef CMDBLDDB_H
+#define CMDBLDDB_H
+
+
+#include "TWDriverInternal.h"
+#include "public_infoele.h"
+
+
+/* 
+ * Dot11 params
+ * ------------
+ */
+typedef struct
+{
+    TI_UINT16                  RtsThreshold;
+    TI_UINT8                   CtsToSelf;
+    TRxTimeOut                 rxTimeOut;
+    TI_UINT16                  FragmentThreshold;
+    TI_UINT8                   ListenInterval;
+    TI_UINT16                  Capabilities;
+    TI_UINT32                  MaxTxMsduLifetime;
+    TI_UINT32                  MaxRxMsduLifetime;
+    TI_UINT8                   calibrationChannel2_4;
+    TI_UINT8                   calibrationChannel5_0;
+    TI_UINT16                  Aid;
+    TI_UINT8                   CurrAntenna;
+    TI_UINT8                   TxAntenna;
+    TI_UINT8                   RxAntenna;
+    TI_UINT8                   Hw_TxAntenna;
+    TI_UINT8                   Hw_RxAntenna;
+    TI_UINT16                  CwMin;
+    TI_UINT8                   RateFallback;
+    TI_UINT32                  RxConfigOption;
+    TI_UINT32                  RxFilterOption;
+    TI_BOOL                    WiFiWmmPS;
+
+    /* Data interrupts pacing */
+    TI_UINT16                  TxCompletePacingThreshold;
+    TI_UINT16                  TxCompletePacingTimeout; 
+    TI_UINT16                  RxIntrPacingThreshold;	 
+    TI_UINT16                  RxIntrPacingTimeout;	 
+
+    /* ARP IP Addr table */
+    TI_UINT32                  arp_IP_ver;
+    TI_UINT32                  isArpIpFilteringEnabled;
+    TIpAddr                    arp_IP_addr;
+
+    /* Mac addresses filter */
+    TI_UINT8                   isMacAddrFilteringnabled;
+    TI_UINT8                   numGroupAddrs;
+    TMacAddr                   aGroupAddr[MAX_MULTICAST_GROUP_ADDRS];
+
+    TI_UINT32                  FeatureOptions;
+    TI_UINT32                  FeatureDataFlowOptions;
+    TI_UINT8                   SlotTime;
+    TI_UINT8                   preamble;
+    TI_UINT8                   RadioBand;
+    TI_UINT8                   MacClock;
+    TI_UINT8                   ArmClock;
+    TI_UINT8                   CurrPowerSaveState;
+    ESoftGeminiEnableModes     SoftGeminiEnable;
+    TSoftGeminiParams          SoftGeminiParams;
+    TFmCoexParams              tFmCoexParams;
+    TI_UINT8                   maxSitesFragCollect;
+    TI_UINT8                   hwAccessMethod;
+    TI_UINT32                  nullTemplateSize;
+    TI_UINT32                  disconnTemplateSize;
+    TI_UINT32                  beaconTemplateSize;
+    TI_UINT32                  probeRequestTemplateSize;
+    TI_UINT32                  probeResponseTemplateSize;
+    TI_UINT32                  PsPollTemplateSize;
+    TI_UINT32                  qosNullDataTemplateSize;
+    TI_BOOL                    EnergyDetection;
+    TI_UINT8                   PacketDetectionThreshold;
+    TI_UINT8                   FcsErrThrsh;
+    TI_UINT8                   UseDeviceErrorInterrupt;
+    TI_BOOL                    RetryPreemption;
+    /* This flag indicate if to discards all broadcast frames */
+    TI_BOOL                    RxDisableBroadcast; 
+    /* Indicate if the station is joined */
+    TI_BOOL                    bJoin;              
+    /* Indicate if the station is connected */
+    TI_BOOL                    bStaConnected;              
+    TI_UINT8                   AntDiversity;
+    /* Parameters for roaming triggers configuration */
+    TRroamingTriggerParams     roamTriggers;
+    /* Power control param */
+    EPowerPolicy               minPowerLevel;
+    TBcnBrcOptions             BcnBrcOptions;
+    TBeaconFilterIeTable       beaconFilterIETable;
+    TBeaconFilterInitParams    beaconFilterParams;
+
+    /*Beacon Early Termination (Bet)*/
+    TI_UINT8                   BetEnable;
+    TI_UINT8                   MaximumConsecutiveET;
+    TI_UINT8                   ConsecutivePsPollDeliveryFailureThreshold;
+
+    /* RSSI/SNR triggers */
+    RssiSnrTriggerCfg_t        tRssiSnrTrigger[NUM_OF_RSSI_SNR_TRIGGERS];
+    RssiSnrAverageWeights_t    tRssiSnrWeights;
+
+    TI_UINT32                  uSlicedScanTimeOut;
+
+    /* HT capabilities */
+    TTwdHtCapabilities         tTwdHtCapabilities;
+
+    /* PM Config params */
+    TI_UINT32                  uHostClkSettlingTime;	 
+    TI_UINT8                   uHostFastWakeupSupport;
+
+    TI_UINT8                   TxPowerDbm;
+
+    /* CoexActivity Table */
+    THalCoexActivityTable      tWlanParamsCoexActivityTable;
+    
+    /* DCO Itrim params */
+    TI_BOOL                    dcoItrimEnabled;
+    TI_UINT32                  dcoItrimModerationTimeoutUsec;
+    
+} TWlanParams;
+
+
+/* 
+ * BssInfo params
+ * --------------
+ */
+typedef struct
+{
+    TI_UINT8                   ReqBssType;
+    TI_UINT8                   BssType;
+    TI_UINT16                  BeaconInterval;
+    TI_UINT8                   DtimInterval; 
+    TI_UINT8                   RadioChannel;
+    TI_UINT8                   BssId[MAC_ADDR_LEN];
+    TSsid                      tSsid;
+    /* Policy for recovery */  
+    TTxRatePolicy              TxRateClassParams; 
+    TI_UINT32                  BasicRateSet;   
+    /* The ctrl field in the Join-Command (see StartJoinRequest_t) */
+    TI_UINT8                   Ctrl;                                 
+    /* ATIM window of IBSS*/
+    /* Note that when ATIM window is zero the*/
+    /* initiated IBSS does not support powersave*/
+    TI_UINT16                  ATimWindow;     
+    /* Specifies the PLCP preamble type used*/
+    /* 0 for long preamble*/
+    /* 1 for short preamble*/
+    TI_UINT8                   DefaultPreamble;
+
+    /* 
+     * HT setting 
+     */
+    /* capabilities */
+    TI_BOOL   bHtCap;
+    TI_UINT32 uHtCapabilites;
+    TMacAddr  tMacAddress;
+    TI_UINT8  uAmpduMaxLeng;
+    TI_UINT8  uAmpduMinSpac;
+    /* Information */
+    TI_BOOL   bHtInf;
+    TI_UINT8  uRifsMode;     
+    TI_UINT8  uHtProtection;
+    TI_UINT8  uGfProtection;     
+    TI_UINT8  uHtTxBurstLimit;
+    TI_UINT8  uDualCtsProtection;
+    /* BA session */
+    TI_BOOL                               bBaInitiator[MAX_NUM_OF_802_1d_TAGS];
+    TAxcBaSessionInitiatorResponderPolicy tBaSessionInitiatorPolicy[MAX_NUM_OF_802_1d_TAGS]; 
+    TI_BOOL                               bBaResponder[MAX_NUM_OF_802_1d_TAGS];
+    TAxcBaSessionInitiatorResponderPolicy tBaSessionResponderPolicy[MAX_NUM_OF_802_1d_TAGS]; 
+
+} TBssInfoParams;
+
+
+/* 
+ * General counters
+ * ----------------
+ */
+typedef struct
+{
+    TI_UINT32                  FcsErrCnt;
+
+} TGenCounters;
+
+
+/*
+ * queuesParam_T - Queue params for Quality Of Service
+ * ------------------------------------------
+ */
+typedef struct
+{
+    TQueueTrafficParams        queues[MAX_NUM_OF_AC];
+    TI_BOOL                    isQueueConfigured[MAX_NUM_OF_AC];
+
+} TQueuesParams;
+
+
+typedef struct 
+{
+    TAcQosParams               ac[MAX_NUM_OF_AC];
+    TI_BOOL                    isAcConfigured[MAX_NUM_OF_AC];
+	TI_BOOL					   isBurstModeEnabled;
+} TAcConfParams;
+
+
+typedef struct 
+{
+    TPsRxStreaming             tid[MAX_NUM_OF_802_1d_TAGS];
+
+} TPsRxStreamingParams;
+
+
+/* 
+ * Templates params
+ * ----------------
+ */
+typedef struct
+{
+    TTemplateParams            Beacon;
+    TTemplateParams            ProbeReq24;
+    TTemplateParams            ProbeReq50;
+    TTemplateParams            ProbeResp;
+    TTemplateParams            NullData;
+    TTemplateParams            PsPoll;
+    TTemplateParams            QosNullData;
+    TTemplateParams            KeepAlive[ KLV_MAX_TMPL_NUM ];
+    TTemplateParams            Disconn;
+
+} TTemplateListParams;
+
+typedef struct
+{
+    TI_UINT8                   enaDisFlag;
+    TKeepAliveParams           keepAliveParams[ KLV_MAX_TMPL_NUM ];
+} TKeepAliveList;
+
+/* Security keys structure for reconfigure phase */
+typedef struct
+{
+    TI_BOOL                    bReconfHwEncEnable;     
+    TI_BOOL                    bHwEncDecrEnableValid; 
+    TI_UINT8                   uReconfDefaultKeyId;   
+    TI_BOOL                    bDefaultKeyIdValid;  
+    TSecurityKeys*             pReconfKeys; 
+                                   
+} TSecurReconf;
+
+
+/* Rx Data Filters */
+typedef struct
+{
+    TI_UINT8                   uIndex;
+    TI_UINT8                   uCommand; 
+    filter_e                   eAction;
+    TI_UINT8                   uNumFieldPatterns;
+    TI_UINT8                   uLenFieldPatterns;
+    TI_UINT8                   aFieldPattern[MAX_DATA_FILTER_SIZE];
+                                   
+} TRxDataFilter;
+
+typedef struct
+{
+    TI_BOOL                    bEnabled;
+    filter_e                   eDefaultAction;
+    TRxDataFilter              aRxDataFilter[MAX_DATA_FILTERS];
+                                   
+} TRxDataFiltersTable;
+
+typedef struct
+{
+ ACXSmartReflexConfigParams_t     tSmartReflexParams;       
+ ACXSmartReflexDebugParams_t      tSmartReflexDebugParams;  
+ ACXSmartReflexState_t            tSmartReflexState;        
+
+}TSmartReflexParams ;
+
+typedef struct
+{  
+	RateMangeParams_t rateMngParams;
+
+} TRateMngParams;
+
+
+
+/*
+ * ----------------------------------------------------------------
+ *                  MAIN PARAMETERS STRUCTURE
+ * ----------------------------------------------------------------
+ */
+typedef struct 
+{
+    TDmaParams                 dma;                 /* Rx/Tx queue parameters   */
+    TQueuesParams              queues;              /* Queues params for QOS    */
+    TAcConfParams              ac;                  /* AC params for QoS        */
+    TPsRxStreamingParams       psStream;            /* PS-Rx-Streaming params   */
+    TWlanParams                wlan;                /* Wlan parameters          */
+    TBssInfoParams             bss;                 /* Bss information          */
+    TFwInfo                    hw;                  /* HW eeprom & versions info*/
+    TGenCounters               counters;            /* General counters         */
+    TTemplateListParams        templateList;        /* Templates for recovery   */
+    TKeepAliveList             klvList;             /* Keep-Alive paramters     */  
+    TSecurReconf               keys;                /* Security keys            */
+    TRxDataFiltersTable        rxDataFilters;       /* Rx data filters          */
+    IniFileGeneralParam        tPlatformGenParams;   /* platfrom gen params from public_radio.h  */   
+    IniFileRadioParam          tRadioIniParams;      /* Radio ini params from public_radio.h     */
+    TSmartReflexParams         tSmartReflex;
+	TRateMngParams		       tRateMngParams;      /* rate management params */
+} TCmdBldDb;
+
+#endif
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldItr.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,131 @@
+/*
+ * CmdBldItr.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdBldItr.c 
+ *  \brief Command builder. Interrogate commands
+ *
+ *  \see   CmdBld.h 
+ */
+
+#define __FILE_ID__  FILE_ID_95
+#include "tidef.h"
+#include "CmdBld.h"
+#include "CmdBldItrIE.h"
+
+
+TI_STATUS cmdBld_ItrMemoryMap (TI_HANDLE hCmdBld, MemoryMap_t *apMap, void *fCb, TI_HANDLE hCb)
+{
+    return cmdBld_ItrIeMemoryMap (hCmdBld, apMap, fCb, hCb);
+}
+
+
+TI_STATUS cmdBld_ItrRoamimgStatisitics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    return cmdBld_ItrIeRoamimgStatisitics (hCmdBld, fCb, hCb, pCb);
+}
+
+
+TI_STATUS cmdBld_ItrErrorCnt (TI_HANDLE hCmdBld, void * fCb, TI_HANDLE hCb, void * pCb)
+{
+    return cmdBld_ItrIeErrorCnt (hCmdBld, fCb, hCb, pCb);
+}
+
+
+/*
+ * ----------------------------------------------------------------------------
+ * Function : TWD_GetAverageRSSI
+ *
+ * Input    :   averageRSSI - pointer for return verage RSSI result
+ *
+ * Output   :   averageRSSI
+ * Process  :
+ * -----------------------------------------------------------------------------
+ */
+TI_STATUS cmdBld_ItrRSSI (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    return cmdBld_ItrIeRSSI (hCmdBld, fCb, hCb, pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_GetSoftGeminiParams()
+ ****************************************************************************
+ * DESCRIPTION: Get Soft Gemini config parameter
+ *
+ * INPUTS:
+ *
+ * OUTPUT:
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrSg (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb)
+{                  
+    return cmdBld_ItrIeSg (hCmdBld, fCb, hCb, pCb);
+}
+
+TI_STATUS cmdBld_ItrRateParams(TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb)
+{
+    TTwd *pTWD = (TTwd *)hCmdBld;
+
+    return cmdBld_ItrIeRateParams (pTWD->hCmdBld, fCb, hCb, pCb);
+
+}
+
+
+TI_STATUS cmdBld_ItrStatistics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    return cmdBld_ItrIeStatistics (hCmdBld, fCb, hCb, pCb);
+}
+
+/****************************************************************************
+ *                      cmdBld_ItrDataFilterStatistics()
+ ****************************************************************************
+ * DESCRIPTION: Get the ACX GWSI counters 
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrDataFilterStatistics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    return cmdBld_ItrIeDataFilterStatistics (hCmdBld, fCb, hCb, pCb);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldItrIE.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,349 @@
+/*
+ * CmdBldItrIE.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+#define __FILE_ID__  FILE_ID_96
+#include "osApi.h"
+#include "report.h"
+#include "CmdBld.h"
+#include "CmdQueue_api.h"
+
+
+TI_STATUS cmdBld_ItrIeMemoryMap (TI_HANDLE hCmdBld, MemoryMap_t *apMap, void *fCb, TI_HANDLE hCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+   
+    /* Set information element header */
+    apMap->EleHdr.id  = ACX_MEM_MAP;
+    apMap->EleHdr.len = sizeof(*apMap) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, apMap, sizeof(*apMap), fCb, hCb, apMap);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeRoamimgStatisitics ()
+ ****************************************************************************
+ * DESCRIPTION: Get the ACX GWSI statistics 
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeRoamimgStatisitics (TI_HANDLE  hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXRoamingStatisticsTable_t acx;
+    ACXRoamingStatisticsTable_t * pCfg = &acx;
+
+    /* 
+     * Set information element header
+     */
+    pCfg->EleHdr.id  = ACX_ROAMING_STATISTICS_TBL;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+   
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(*pCfg), fCb, hCb, pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeErrorCnt ()
+ ****************************************************************************
+ * DESCRIPTION: Get the ACX GWSI counters 
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeErrorCnt (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXErrorCounters_t acx;
+    ACXErrorCounters_t * pCfg = &acx;
+
+    /* 
+     * Set information element header
+     */
+    pCfg->EleHdr.id  = ACX_ERROR_CNT;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+     
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(*pCfg), fCb, hCb, pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeRSSI ()
+ ****************************************************************************
+ * DESCRIPTION: Configure/Interrogate StationId information element to/from
+ *      the wlan hardware.
+ *      This information element specifies the MAC Address assigned to the
+ *      STATION or AP.
+ *      This default value is the permanent MAC address that is stored in the
+ *      adaptor's non-volatile memory.
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeRSSI (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, TI_UINT8* pCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXRoamingStatisticsTable_t AcxElm_GetAverageRSSI;
+    ACXRoamingStatisticsTable_t* pCfg = &AcxElm_GetAverageRSSI;
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_ROAMING_STATISTICS_TBL;
+    pCfg->EleHdr.len = sizeof(ACXRoamingStatisticsTable_t) - sizeof(EleHdrStruct);
+    
+      
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(ACXRoamingStatisticsTable_t), fCb, hCb, pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeSg()
+ ****************************************************************************
+ * DESCRIPTION: Get the BTH-WLAN co-exsistance parameters from the Fw   
+ *
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeSg (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXBluetoothWlanCoParamsStruct  AcxElm_BluetoothWlanEnable;
+    ACXBluetoothWlanCoParamsStruct* pCfg = &AcxElm_BluetoothWlanEnable;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ItrIeSg \n");
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_SG_CFG;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(ACXBluetoothWlanCoParamsStruct), fCb, hCb, pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeRateParams()
+ ****************************************************************************
+ * DESCRIPTION: Get the rate managment configuration  
+ *
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+
+TI_STATUS cmdBld_ItrIeRateParams (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+	AcxRateMangeParams  RateParams;
+    AcxRateMangeParams* pCfg = &RateParams;
+
+    TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ItrIeRateParams \n");
+
+    /* Set information element header */
+    pCfg->EleHdr.id = ACX_GET_RATE_MAMAGEMENT_PARAMS;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(AcxRateMangeParams), fCb, hCb, pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeStatistics ()
+ ****************************************************************************
+ * DESCRIPTION: Print the statistics from the input IE statistics
+ *
+ * INPUTS:
+ *          ACXStatisticsStruct* pElem  The Statistics information element
+ *                                      to be printed
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeStatistics (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXStatistics_t *pACXStatistics = (ACXStatistics_t *)pCb;
+
+    /* Set information element header */
+    pACXStatistics->EleHdr.id  = ACX_STATISTICS;
+    pACXStatistics->EleHdr.len = sizeof(*pACXStatistics) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCb, sizeof(*pACXStatistics), fCb, hCb, pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeMediumOccupancy ()
+ ****************************************************************************
+ * DESCRIPTION: Get the Medium Occupancy.
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeMediumOccupancy (TI_HANDLE hCmdBld,
+                                       TInterrogateCmdCbParams  mediumUsageCBParams)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXMediumUsage_t    medium;
+    ACXMediumUsage_t    *pCfg = &medium;
+
+    /* Set information element header */
+    pCfg->EleHdr.id  = ACX_MEDIUM_USAGE;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                                 CMD_INTERROGATE, 
+                                 pCfg, 
+                                          sizeof(*pCfg),
+                                          mediumUsageCBParams.fCb,
+                                          mediumUsageCBParams.hCb,
+                                          mediumUsageCBParams.pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeTfsDtim ()
+ ****************************************************************************
+ * DESCRIPTION: Get the Tsf and Dtim counter from Fw
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeTfsDtim (TI_HANDLE hCmdBld,
+                               TInterrogateCmdCbParams  mediumUsageCBParams)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    ACX_fwTSFInformation_t    fwTsfDtimMib;
+    ACX_fwTSFInformation_t    *pCfg = &fwTsfDtimMib;
+
+    /* Set information element header*/
+    pCfg->EleHdr.id  = ACX_TSF_INFO;
+    pCfg->EleHdr.len = sizeof(ACX_fwTSFInformation_t) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                                 CMD_INTERROGATE, 
+                                 pCfg, 
+                                          sizeof(*pCfg), 
+                                          mediumUsageCBParams.fCb,
+                                          mediumUsageCBParams.hCb,
+                                          mediumUsageCBParams.pCb);
+}
+
+
+/****************************************************************************
+ *                      cmdBld_ItrIeNoiseHistogramResults()
+ ****************************************************************************
+ * DESCRIPTION: Get the Noise Histogram Measurement Results.
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeNoiseHistogramResults (TI_HANDLE hCmdBld,
+                                             TInterrogateCmdCbParams noiseHistCBParams)
+{
+    TCmdBld *pCmdBld = (TCmdBld *)hCmdBld;
+    NoiseHistResult_t   results;
+    NoiseHistResult_t   *pCfg = &results;
+
+    /* Set information element header*/
+    pCfg->EleHdr.id  = ACX_NOISE_HIST;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, 
+                                 CMD_INTERROGATE, 
+                                          pCfg, 
+                                          sizeof(*pCfg),
+                                          noiseHistCBParams.fCb,
+                                          noiseHistCBParams.hCb,
+                                          noiseHistCBParams.pCb);
+} 
+
+/****************************************************************************
+ *                      cmdBld_ItrIeDataFilterStatistics()
+ ****************************************************************************
+ * DESCRIPTION: Get the ACX GWSI counters 
+ *
+ * INPUTS:
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS cmdBld_ItrIeDataFilterStatistics (TI_HANDLE  hCmdBld, 
+                                            void      *fCb, 
+                                            TI_HANDLE  hCb, 
+                                            void      *pCb)
+{
+	TCmdBld       *pCmdBld = (TCmdBld *)hCmdBld;
+    ACXDataFilteringStatistics_t acx;
+    ACXDataFilteringStatistics_t * pCfg = &acx;
+
+    /* Set information element header */
+    pCfg->EleHdr.id  = ACX_GET_DATA_FILTER_STATISTICS;
+    pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct);
+
+    TRACE_INFO_HEX(pCmdBld->hReport, (TI_UINT8 *) pCfg, sizeof(ACXDataFilteringStatistics_t));
+
+    /* Send the interrogation command */
+    return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(*pCfg), fCb, hCb, pCb);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdBldItrIE.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,57 @@
+/*
+ * CmdBldItrIE.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 CMDBLDITRIE_H
+#define CMDBLDITRIE_H
+
+
+TI_STATUS cmdBld_ItrIeMemoryMap                	(TI_HANDLE hCmdBld, MemoryMap_t *apMap, void *fCb, TI_HANDLE hCb);
+TI_STATUS cmdBld_ItrIeRoamimgStatisitics       	(TI_HANDLE hCmdBld, void * fCb, TI_HANDLE hCb, void * pCb);
+TI_STATUS cmdBld_ItrIeErrorCnt                 	(TI_HANDLE hCmdBld, void * fCb, TI_HANDLE hCb, void * pCb);
+TI_STATUS cmdBld_ItrIeRSSI                     	(TI_HANDLE hCmdBld, void * fCb, TI_HANDLE hCb, void * pCb);
+TI_STATUS cmdBld_ItrIeSg                       	(TI_HANDLE hCmdBld, void * fCb, TI_HANDLE hCb, void * pCb);
+TI_STATUS cmdBld_ItrIeStatistics               	(TI_HANDLE hCmdBld, void * fCb, TI_HANDLE hCb, void *pCb);
+TI_STATUS cmdBld_ItrIeDataFilterStatistics     	(TI_HANDLE hCmdBld, void * fCb, TI_HANDLE hCb, void *pCb);
+TI_STATUS cmdBld_ItrIeMediumOccupancy          	(TI_HANDLE hCmdBld, TInterrogateCmdCbParams interogateCmdCBParams);
+TI_STATUS cmdBld_ItrIeTfsDtim                  	(TI_HANDLE hCmdBld, TInterrogateCmdCbParams interogateCmdCBParams);
+TI_STATUS cmdBld_ItrIeNoiseHistogramResults    	(TI_HANDLE hCmdBld, TInterrogateCmdCbParams noiseHistCBParams);
+TI_STATUS cmdBld_ItrIeRateParams                (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb);
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdQueue.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1091 @@
+/*
+ * CmdQueue.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdQueue.c
+ *  \brief Handle the wlan command queue
+ *
+ *  \see CmdQueue.h, CmdQueue_api.h, CmdMBox.c
+ */
+
+
+#define __FILE_ID__  FILE_ID_97
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "TwIf.h"
+#include "public_commands.h"
+#include "CmdQueue_api.h"
+#include "CmdMBox_api.h"
+#include "CmdQueue.h"
+
+
+
+/*****************************************************************************
+ **         Internal functions prototypes                                   **
+ *****************************************************************************/
+
+static TI_STATUS    cmdQueue_SM (TI_HANDLE hCmdQueue, ECmdQueueSmEvents event);
+static TI_STATUS    cmdQueue_Push (TI_HANDLE  hCmdQueue, 
+                                   Command_e  cmdType,
+                                   TI_UINT8   *pParamsBuf, 
+                                   TI_UINT32  uParamsLen,
+                                   void       *fCb, 
+                                   TI_HANDLE  hCb, 
+                                   void       *pCb);
+#ifdef TI_DBG
+static void         cmdQueue_PrintQueue(TCmdQueue  *pCmdQueue);
+static char *       cmdQueue_GetIEString (TI_INT32 MboxCmdType, TI_UINT16 id);
+static char *       cmdQueue_GetCmdString (TI_INT32 MboxCmdType);
+#endif /* TI_DBG */
+
+
+
+
+/*
+ * \brief	Create the TCmdQueue object
+ * 
+ * \param  hOs  - OS module object handle
+ * \return Handle to the created object
+ * 
+ * \par Description
+ * Calling this function creates a CmdQueue object
+ * 
+ * \sa cmdQueue_Destroy
+ */
+TI_HANDLE cmdQueue_Create (TI_HANDLE hOs)
+{
+    TCmdQueue  *pCmdQueue;
+
+    pCmdQueue = os_memoryAlloc (hOs, sizeof(TCmdQueue),MemoryNormal);
+    if (pCmdQueue == NULL)
+    {
+        WLAN_OS_REPORT(("FATAL ERROR: cmdQueue_Create(): Error Creating aCmdQueue - Aborting\n"));
+        return NULL;
+    }
+
+    /* reset control module control block */
+    os_memoryZero (hOs, pCmdQueue, sizeof(TCmdQueue));
+    pCmdQueue->hOs = hOs;
+    
+    return pCmdQueue;   
+}
+
+
+/*
+ * \brief	Destroys the cmdQueue object
+ * 
+ * \param  hCmdMbox  - The object to free
+ * \return TI_OK
+ * 
+ * \par Description
+ * Calling this function destroys the cmdQueue object
+ * 
+ * \sa cmdQueue_Create
+ */
+TI_STATUS cmdQueue_Destroy (TI_HANDLE hCmdQueue)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
+
+    /* Free context */
+    os_memoryFree (pCmdQueue->hOs, pCmdQueue, sizeof(TCmdQueue));
+
+	return TI_OK;
+}
+
+
+/*
+ * \brief	Configure the CmdQueue object
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  hReport - Handle to report module
+ * \param  hTwIf  - Handle to TwIf
+ * \param  hTimer  - Handle to os timer
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdQueue_Init   (TI_HANDLE hCmdQueue, 
+                           TI_HANDLE hCmdMbox, 
+                           TI_HANDLE hReport, 
+                           TI_HANDLE hTwIf,
+                           TI_HANDLE hTimer)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*) hCmdQueue;
+
+    pCmdQueue->head = 0;
+    pCmdQueue->tail = 0;
+    pCmdQueue->uNumberOfCommandInQueue = 0;
+    pCmdQueue->uMaxNumberOfCommandInQueue = 0;
+    pCmdQueue->state = CMDQUEUE_STATE_IDLE;
+    pCmdQueue->fCmdCompleteCb = NULL;
+    pCmdQueue->hCmdCompleteCb = NULL;
+    pCmdQueue->fFailureCb = NULL;
+    pCmdQueue->hFailureCb = NULL;
+    pCmdQueue->hReport = hReport;
+    pCmdQueue->hCmdMBox = hCmdMbox;
+    pCmdQueue->hTwIf = hTwIf;
+    pCmdQueue->bErrorFlag = TI_FALSE;
+    pCmdQueue->bMboxEnabled = TI_FALSE;
+    pCmdQueue->bAwake = TI_FALSE;
+
+    /* Configure Command Mailbox */
+    cmdMbox_Init (hCmdMbox, hReport, hTwIf,
+                  hTimer, hCmdQueue,
+                  cmdQueue_Error);
+
+    /*
+     * NOTE: don't set uNumberOfRecoveryNodes = 0; 
+     *       its value is used by recovery process
+     */
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Configure the CmdQueue object
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  eCmdQueueEvent - The event that triggered the SM
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Handles the CmdQueue SM.
+ * 
+ * \sa cmdQueue_Push, cmdQueue_ResultReceived
+ */
+static TI_STATUS cmdQueue_SM (TI_HANDLE hCmdQueue, ECmdQueueSmEvents eCmdQueueEvent)
+{   
+    TCmdQueue     *pCmdQueue = (TCmdQueue*)hCmdQueue;
+    TI_BOOL        bBreakWhile = TI_FALSE;
+    TI_STATUS      rc = TI_OK, status;
+    TCmdQueueNode *pHead;
+    TI_UINT32      uReadLen, uWriteLen;
+
+    while(!bBreakWhile)
+    {
+        switch (pCmdQueue->state)
+        {
+            case CMDQUEUE_STATE_IDLE:
+                switch(eCmdQueueEvent)
+                {
+                    case CMDQUEUE_EVENT_RUN:
+                        pCmdQueue->state = CMDQUEUE_STATE_WAIT_FOR_COMPLETION;
+
+                        pHead = &pCmdQueue->aCmdQueue[pCmdQueue->head];
+
+                        #ifdef CMDQUEUE_DEBUG_PRINT
+                        TRACE4(pCmdQueue->hReport, REPORT_SEVERITY_CONSOLE, "cmdQueue_SM: Send Cmd: CmdType = %d(%d) Len = %d, NumOfCmd = %d", pHead->cmdType, (pHead->aParamsBuf) ?  *(TI_UINT16 *)pHead->aParamsBuf:0, pHead->uParamsLen, pCmdQueue->uNumberOfCommandInQueue));
+
+                        WLAN_OS_REPORT(("cmdQueue_SM: Send Cmd: CmdType = %s(%s)\n"
+                                        "Len = %d, NumOfCmd = %d \n",
+                                        cmdQueue_GetCmdString(pHead->cmdType),
+                                        (pHead->aParamsBuf) ?  cmdQueue_GetIEString(pHead->cmdType,*(TI_UINT16 *)pHead->aParamsBuf):"",
+                                        pHead->uParamsLen, pCmdQueue->uNumberOfCommandInQueue));
+                        #endif
+                
+                        #ifdef TI_DBG
+                            pCmdQueue->uCmdSendCounter++;
+                        #endif 
+
+                        /* 
+                         * if bAwake is true, then we reached here because there were more commands 
+                         * in the queue after sending a previous command.
+                         * There is no need to send another awake command to TwIf. 
+                         */
+                        if (pCmdQueue->bAwake == TI_FALSE)
+                        {
+                            /* Keep the device awake for the entire Cmd transaction */
+                            twIf_Awake(pCmdQueue->hTwIf);
+                            pCmdQueue->bAwake = TI_TRUE;
+                        }
+
+                        if (pHead->cmdType == CMD_INTERROGATE)
+                        {
+                            uWriteLen = CMDQUEUE_INFO_ELEM_HEADER_LEN;
+                            /* Will be updated by CmdMbox to count the status response */
+                            uReadLen = pHead->uParamsLen;
+                        }
+                        else if(pHead->cmdType == CMD_TEST)
+                        {
+                            /* CMD_TEST has configure & interrogate abillities together */
+                            uWriteLen = pHead->uParamsLen;
+                            /* Will be updated by CmdMbox to count the status response */
+                            uReadLen = pHead->uParamsLen;
+                        }
+                        else /* CMD_CONFIGURE or others */
+                        {
+                            uWriteLen = pHead->uParamsLen;
+                            /* Will be updated by CmdMbox to count the status response */
+                            uReadLen = 0;
+
+                        }
+                        /* send the command to TNET */
+                        rc = cmdMbox_SendCommand (pCmdQueue->hCmdMBox, 
+                                              pHead->cmdType, 
+                                              pHead->aParamsBuf, 
+                                              uWriteLen,
+                                              uReadLen);
+
+                        bBreakWhile = TI_TRUE;
+
+                        /* end of CMDQUEUE_EVENT_RUN */
+                        break;
+
+                    default:
+                        TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_SM: ** ERROR **  No such event (%d) for state CMDQUEUE_STATE_IDLE\n",eCmdQueueEvent);
+                        bBreakWhile = TI_TRUE;
+                        rc =  TI_NOK;
+
+                        break;
+                }
+                break;
+            
+            case CMDQUEUE_STATE_WAIT_FOR_COMPLETION:
+                switch(eCmdQueueEvent)
+                {
+                    case CMDQUEUE_EVENT_RUN:
+                        /* We are in the middle of other command transaction so there is nothing top be done */
+                        bBreakWhile = TI_TRUE;
+                        rc = TXN_STATUS_PENDING;
+                        break;
+
+                    case CMDQUEUE_EVENT_COMPLETE:
+                        {
+                            Command_e cmdType;
+                            TI_UINT16        uParam;
+                            void *fCb, *hCb, *pCb;
+    
+                            pHead = &pCmdQueue->aCmdQueue[pCmdQueue->head];
+            
+                            /* Keep callback parameters in temporary variables */
+                            cmdType = pHead->cmdType;
+                            uParam  = *(TI_UINT16 *)pHead->aParamsBuf;
+                            fCb = pHead->fCb;
+                            hCb = pHead->hCb;
+                            pCb = pHead->pInterrogateBuf;
+                            
+                            /* 
+                             * Delete the command from the queue before calling a callback 
+                             * because there may be nested calls inside a callback
+                             */
+                            pCmdQueue->head ++;
+                            if (pCmdQueue->head >= CMDQUEUE_QUEUE_DEPTH)
+                                pCmdQueue->head = 0;                
+                            pCmdQueue->uNumberOfCommandInQueue --;                
+                
+                        #ifdef TI_DBG
+                            pCmdQueue->uCmdCompltCounter++;
+                        #endif 
+
+                            /* Read the latest command return status */
+                            status = cmdMbox_GetStatus (pCmdQueue->hCmdMBox);
+                            if (status != TI_OK)
+                            {
+                                pCmdQueue->bErrorFlag = TI_TRUE;
+                            }
+                            else
+                            {
+                                pCmdQueue->bErrorFlag = TI_FALSE;
+                            }
+
+                            /* If the command had a CB, then call it with the proper results buffer */
+                            if (fCb)
+                            {   
+                                if (pCb)
+                                {
+                                    /* If pInterrogateBuf isn't NULL we need to copy the results */
+                                    cmdMbox_GetCmdParams(pCmdQueue->hCmdMBox, pCb);
+                                    /* Call the CB with the result buffer and the returned status */
+                                    ((TCmdQueueInterrogateCb)fCb) (hCb, status, pCb); 
+                                }
+                                else
+                                {
+                                    /* Call the CB with only the returned status */
+                                    ((TCmdQueueCb)fCb) (hCb, status);
+                                }
+                            }
+                            else
+                            {
+                                /* Call the generic callback */
+                                if (pCmdQueue->fCmdCompleteCb)
+                                {
+                                    pCmdQueue->fCmdCompleteCb (pCmdQueue->hCmdCompleteCb, cmdType, uParam, status);
+                                }
+                            }
+
+                            /* Check if there are any more commands in queue */
+                            if (pCmdQueue->uNumberOfCommandInQueue > 0)               
+                            {
+                                /* If queue isn't empty, send the next command */
+                                pCmdQueue->state = CMDQUEUE_STATE_IDLE;
+                                eCmdQueueEvent = CMDQUEUE_EVENT_RUN;
+                            }
+                            else	
+                            {   
+                                /* If queue is empty, we can permit TwIf to send sleep a command if neccesary */
+                                twIf_Sleep(pCmdQueue->hTwIf);
+                                pCmdQueue->bAwake = TI_FALSE;
+                                pCmdQueue->state = CMDQUEUE_STATE_IDLE;
+
+                                bBreakWhile = TI_TRUE;
+                            }
+                        /* end of CMDQUEUE_EVENT_COMPLETE */
+                        }            
+                        break;
+
+                    default:
+                        TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_SM: ** ERROR **  No such event (%d) for state CMDQUEUE_STATE_IDLE\n",eCmdQueueEvent);
+                        bBreakWhile = TI_TRUE;
+                        rc =  TI_NOK;
+
+                        break;
+
+                /* end of switch event */
+                } 
+                break;
+        /* end of switch state */
+        }
+    /* end of while */
+    }
+
+    return rc;
+}
+
+
+/*
+ * \brief	Sends the command to the cmdMbox
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  eMboxCmdType - The command type
+ * \param  pMboxBuf - The command itself (parameters)
+ * \param  uParamsLen - The command's length
+ * \param  fCb - The command's Cb function
+ * \param  hCb - The command's Cb handle
+ * \param  pCb - Pointer to the results buffer (for interrogate commands)
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Pushes the command to the command queue, which triggers the 
+ * CmdQueue SM.
+ * 
+ * \sa cmdQueue_Push
+ */
+TI_STATUS cmdQueue_SendCommand (TI_HANDLE  hCmdQueue, 
+                            Command_e  eMboxCmdType, 
+                            void      *pMboxBuf, 
+                            TI_UINT32  uParamsLen, 
+                            void      *fCb, 
+                            TI_HANDLE  hCb, 
+                            void      *pCb)
+{
+    TCmdQueue *pCmdQueue = (TCmdQueue*)hCmdQueue;
+    TI_STATUS  status;
+
+    if (pCmdQueue->bErrorFlag) 
+        return TI_NOK;
+
+    status = cmdQueue_Push (pCmdQueue, 
+                            eMboxCmdType,
+                            (TI_UINT8*)pMboxBuf, 
+                            uParamsLen,
+                            fCb, 
+                            hCb, 
+                            (TI_UINT8*)pCb); 
+
+    return RC_CONVERT (status);
+}
+
+
+/*
+ * \brief	Push the command Node to the Queue with its information element parameter
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  cmdType - The command type
+ * \param  pParamsBuf - The command itself (parameters)
+ * \param  uParamsLen - The command's length
+ * \param  fCb - The command's Cb function
+ * \param  hCb - The command's Cb handle
+ * \param  pCb - Pointer to the results buffer (for interrogate commands)
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa cmdQueue_SendCommand, cmdQueue_SM
+ */
+static TI_STATUS cmdQueue_Push (TI_HANDLE  hCmdQueue, 
+                         Command_e  cmdType,
+                         TI_UINT8   *pParamsBuf, 
+                         TI_UINT32  uParamsLen,
+                         void       *fCb, 
+                         TI_HANDLE  hCb, 
+                         void       *pCb)
+{
+    TCmdQueue *pCmdQueue = (TCmdQueue*)hCmdQueue;
+
+    /* If command type is NOT CMD_INTERROGATE, enter Push only if Mailbox is enabled */
+    if (!pCmdQueue->bMboxEnabled) 
+        return TI_OK;
+
+    #ifdef TI_DBG
+        /*
+         * Check if Queue is Full
+         */
+        if (pCmdQueue->uNumberOfCommandInQueue == CMDQUEUE_QUEUE_DEPTH)
+        	{
+        TRACE0(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_Push: ** ERROR ** The Queue is full\n");
+
+            	return  TI_NOK;
+        	}
+    #endif /* TI_DBG*/
+
+    /* Initializes the last Node in the Queue with the arrgs */
+    pCmdQueue->aCmdQueue[pCmdQueue->tail].cmdType   = cmdType;
+    pCmdQueue->aCmdQueue[pCmdQueue->tail].uParamsLen = uParamsLen;
+    pCmdQueue->aCmdQueue[pCmdQueue->tail].fCb = fCb;
+    pCmdQueue->aCmdQueue[pCmdQueue->tail].hCb = hCb;   
+
+    os_memoryCopy (pCmdQueue->hOs, 
+                   pCmdQueue->aCmdQueue[pCmdQueue->tail].aParamsBuf, 
+                   pParamsBuf, 
+                   uParamsLen);
+    
+    pCmdQueue->aCmdQueue[pCmdQueue->tail].pInterrogateBuf = (TI_UINT8 *)pCb;
+            
+    /* Advance the queue tail*/
+    pCmdQueue->tail++;
+    if (pCmdQueue->tail == CMDQUEUE_QUEUE_DEPTH)
+        pCmdQueue->tail = 0;
+    
+    /* Update counters */
+    pCmdQueue->uNumberOfCommandInQueue++;
+
+    #ifdef TI_DBG    
+        if (pCmdQueue->uMaxNumberOfCommandInQueue < pCmdQueue->uNumberOfCommandInQueue)
+        {
+            pCmdQueue->uMaxNumberOfCommandInQueue = pCmdQueue->uNumberOfCommandInQueue;     
+        }
+    #endif /* TI_DBG*/
+      
+    #ifdef CMDQUEUE_DEBUG_PRINT    
+        WLAN_OS_REPORT(("cmdQueue_Push: CmdType = %s (%s(%d))"
+    			"Len = %d, NumOfCmd = %d \n",
+    			cmdQueue_GetCmdString(cmdType),
+    			(pParamsBuf) ?  cmdQueue_GetIEString(cmdType,*(TI_UINT16 *)pParamsBuf):"",			
+    			(pParamsBuf) ?  *(TI_UINT16 *)pParamsBuf:0,			
+                uParamsLen, pCmdQueue->uNumberOfCommandInQueue));
+    #endif
+
+    /* If queue has only one command trigger the send command from queue */  
+    if (pCmdQueue->uNumberOfCommandInQueue == 1)
+	{
+        return cmdQueue_SM (pCmdQueue, CMDQUEUE_EVENT_RUN);
+	}
+	else
+    {
+        return TI_OK;            
+    }
+}
+
+
+/*
+ * \brief	Notify the CmdQueue SM on the result received.
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Call the CmdQueue SM with CMDQUEUE_EVENT_COMPLETE
+ * 
+ * \sa cmdQueue_SM
+ */
+TI_STATUS  cmdQueue_ResultReceived(TI_HANDLE hCmdQueue)
+{
+    TCmdQueue *pCmdQueue = (TCmdQueue*)hCmdQueue;
+
+    return cmdQueue_SM (pCmdQueue, CMDQUEUE_EVENT_COMPLETE);
+}
+
+
+/*
+ * \brief	Prepere the command queue for recovery.
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * Copy the queue nodes to a recovery list, in order handle 
+ * the commands CB's after recovery has finished
+ * 
+ * \sa cmdQueue_EndReconfig
+ */
+TI_STATUS cmdQueue_Restart (TI_HANDLE hCmdQueue)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)   hCmdQueue;
+    TI_UINT32  uCurrentCmdIndex;
+    TI_UINT32  first  = pCmdQueue->head;
+    TCmdQueueNode *pHead;
+    TCmdQueueRecoveryNode *pRecoveryNode;
+    
+    /* 
+     * Stop the SM
+    */
+    pCmdQueue->state = CMDQUEUE_STATE_IDLE;
+    pCmdQueue->bAwake = TI_FALSE;
+
+TRACE0(pCmdQueue->hReport, REPORT_SEVERITY_INFORMATION, "cmdQueue_Clean: Cleaning aCmdQueue Queue");
+    
+	/*
+     * Save The Call Back Function in the Queue in order the return them after the recovery 
+     * with an error status 
+	*/ 
+
+	/* Clean The Command Call Back Counter */ 
+    pCmdQueue->uNumberOfRecoveryNodes = 0;
+    pRecoveryNode = &pCmdQueue->aRecoveryQueue[pCmdQueue->uNumberOfRecoveryNodes];
+
+    for (uCurrentCmdIndex = 0; 
+         uCurrentCmdIndex < pCmdQueue->uNumberOfCommandInQueue; 
+         uCurrentCmdIndex++)
+    {
+        pHead  =  &pCmdQueue->aCmdQueue[first];
+
+        if (pHead->fCb != NULL)
+        { 
+            /*Copy the interrogate CB and the interrogate data buffer pointer */
+            pRecoveryNode->fCb = pHead->fCb;
+            pRecoveryNode->hCb = pHead->hCb;
+            pRecoveryNode->pInterrogateBuf = pHead->pInterrogateBuf;
+            pCmdQueue->uNumberOfRecoveryNodes++;
+            pRecoveryNode = &pCmdQueue->aRecoveryQueue[pCmdQueue->uNumberOfRecoveryNodes];
+        }       
+        first++;
+        if (first == CMDQUEUE_QUEUE_DEPTH)
+            first = 0;
+    }
+
+    /*
+     * Init the queue
+     */
+    pCmdQueue->head = 0;
+    pCmdQueue->tail = 0;
+    pCmdQueue->uNumberOfCommandInQueue = 0;
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Call the stored CB to end the recovery of the MBox queue
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * Call the stored CB's with an error status 
+ * 
+ * \sa cmdQueue_Restart
+ */
+TI_STATUS cmdQueue_EndReconfig (TI_HANDLE hCmdQueue)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)   hCmdQueue;
+    TI_UINT32  uCbIndex;
+    TCmdQueueRecoveryNode *pHead;
+
+    for (uCbIndex = 0; uCbIndex < pCmdQueue->uNumberOfRecoveryNodes; uCbIndex++)
+    {
+        pHead  =  &pCmdQueue->aRecoveryQueue[uCbIndex];
+
+        if (pHead->pInterrogateBuf)
+        {
+            ((TCmdQueueInterrogateCb)pHead->fCb)(pHead->hCb, CMD_STATUS_FW_RESET, pHead->pInterrogateBuf);
+        }
+        else
+        {
+            ((TCmdQueueCb)pHead->fCb)(pHead->hCb, CMD_STATUS_FW_RESET);
+        }
+    }
+
+    pCmdQueue->uNumberOfRecoveryNodes = 0;
+	
+	return TI_OK;
+}
+
+
+/*
+ * \brief	Register for a call back to be called when Command Complete occured and the CmdMboxCB was NULL
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  fCb - The command's Cb function
+ * \param  hCb - The command's Cb handle
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdQueue_RegisterCmdCompleteGenericCb (TI_HANDLE hCmdQueue, void *fCb, TI_HANDLE hCb)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
+	
+    if (fCb == NULL || hCb == NULL)
+	{
+TRACE0(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_RegisterCmdCompleteGenericCB: NULL parameter\n");
+		return TI_NOK;
+	}
+
+    pCmdQueue->fCmdCompleteCb = (TCmdQueueGenericCb)fCb;
+    pCmdQueue->hCmdCompleteCb = hCb;
+
+	return TI_OK;
+}
+
+
+/*
+ * \brief	Register for a call back to be called when an Error (Timeout) occurs
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  fCb - The command's Cb function
+ * \param  hCb - The command's Cb handle
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdQueue_RegisterForErrorCb (TI_HANDLE hCmdQueue, void *fCb, TI_HANDLE hCb)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
+	
+    if (fCb == NULL || hCb == NULL)
+	{
+TRACE0(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_RegisterForErrorCB: NULL parameters\n");
+		return TI_NOK;
+	}
+
+    pCmdQueue->hFailureCb = hCb;
+    pCmdQueue->fFailureCb = (TCmdQueueCb)fCb;
+
+	return TI_OK;
+}
+
+
+/*
+ * \brief	Enables the CmdMbox (on exit from init mode)
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa cmdQueue_DisableMbox
+ */
+TI_STATUS cmdQueue_EnableMbox (TI_HANDLE hCmdQueue)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
+
+    pCmdQueue->bMboxEnabled = TI_TRUE;
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Disables the CmdMbox (when stopping the driver)
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa cmdQueue_EnableMbox
+ */
+TI_STATUS cmdQueue_DisableMbox (TI_HANDLE hCmdQueue)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
+
+    pCmdQueue->bMboxEnabled = TI_FALSE;
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Called when a command timeout occur
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa cmdQueue_Init, cmdMbox_TimeOut
+ */
+TI_STATUS cmdQueue_Error (TI_HANDLE hCmdQueue, TI_UINT32 command, TI_UINT32 status, void *param)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;     
+
+    if (status == CMD_STATUS_UNKNOWN_CMD)
+    {
+        TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR , "cmdQueue_Error: Unknown Cmd  (%d)\n", command);
+    }
+    else if (status == CMD_STATUS_UNKNOWN_IE)
+    {
+        TRACE4(pCmdQueue->hReport, REPORT_SEVERITY_CONSOLE,"cmdQueue_Error: Unknown IE, cmdType : %d (%d) IE: %d (%d)\n", command, command, (param) ? *(TI_UINT16 *) param : 0, *((TI_UINT16 *) param));
+
+        WLAN_OS_REPORT(("cmdQueue_Error: Unknown IE, cmdType : %s (%d) IE: %s (%d)\n",
+                        cmdQueue_GetCmdString (command),
+                        command,
+                        (param) ? cmdQueue_GetIEString (command, *((TI_UINT16 *) param)) : "",
+                        *((TI_UINT16 *) param)));
+    }
+    else
+    {
+        TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR , "cmdQueue_Error: CmdMbox status is %d\n", status);
+    }
+
+    if (status != CMD_STATUS_UNKNOWN_CMD && status != CMD_STATUS_UNKNOWN_IE)
+    {
+      #ifdef TI_DBG
+
+        TCmdQueueNode* pHead = &pCmdQueue->aCmdQueue[pCmdQueue->head];  
+        TI_UINT32 TimeStamp = os_timeStampMs(pCmdQueue->hOs);
+
+        WLAN_OS_REPORT(("cmdQueue_Error: **ERROR**  Command Occured \n"
+						 "                                        Cmd = %s %s, Len = %d \n"
+						 "                                        NumOfCmd = %d\n"
+						 "                                        MAC TimeStamp on timeout = %d\n",
+						cmdQueue_GetCmdString(pHead->cmdType), 
+						(pHead->aParamsBuf) ? cmdQueue_GetIEString(pHead->cmdType, *(TI_UINT16 *)pHead->aParamsBuf) : "",
+						pHead->uParamsLen, 
+						pCmdQueue->uNumberOfCommandInQueue, 
+						TimeStamp));
+
+        /* Print The command that was sent before the timeout occur */
+        cmdQueue_PrintHistory(pCmdQueue, CMDQUEUE_HISTORY_DEPTH);
+
+      #endif /* TI_DBG */
+
+        /* preform Recovery */
+        if (pCmdQueue->fFailureCb)
+        {
+            pCmdQueue->fFailureCb (pCmdQueue->hFailureCb, TI_NOK);
+        }
+    }
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Returns maximum number of commands (ever) in TCmdQueue queue
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return maximum number of commands (ever) in mailbox queue
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa cmdQueue_Error
+ */
+TI_UINT32 cmdQueue_GetMaxNumberOfCommands (TI_HANDLE hCmdQueue)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue;
+
+    return pCmdQueue->uMaxNumberOfCommandInQueue;
+}
+
+
+
+/********************************************************************************
+*                              DEBUG  FUNCTIONS           	          			*
+*********************************************************************************/
+
+#ifdef TI_DBG
+
+/*
+ * \brief	Print the command queue & statistics
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return void
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa cmdQueue_PrintQueue
+ */
+void cmdQueue_Print (TI_HANDLE hCmdQueue)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue; 
+	
+    WLAN_OS_REPORT(("------------- aCmdQueue Queue -------------------\n"));
+    
+    WLAN_OS_REPORT(("state = %d\n", pCmdQueue->state));
+    WLAN_OS_REPORT(("cmdQueue_Print:The Max NumOfCmd in Queue was = %d\n",
+                        pCmdQueue->uMaxNumberOfCommandInQueue));
+    WLAN_OS_REPORT(("cmdQueue_Print:The Current NumOfCmd in Queue = %d\n",
+                        pCmdQueue->uNumberOfCommandInQueue));
+    WLAN_OS_REPORT(("cmdQueue_Print:The Total number of Cmd send from Queue= %d\n",
+                        pCmdQueue->uCmdSendCounter));
+    WLAN_OS_REPORT(("cmdQueue_Print:The Total number of Cmd Completed interrupt= %d\n",
+                        pCmdQueue->uCmdCompltCounter));
+
+    cmdQueue_PrintQueue (pCmdQueue);
+}
+
+
+/*
+ * \brief	Print the command queue
+ * 
+ * \param  pCmdQueue - Pointer to TCmdQueue
+ * \return void
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa cmdQueue_Print, cmdQueue_GetCmdString, cmdQueue_GetIEString
+ */
+static void cmdQueue_PrintQueue (TCmdQueue *pCmdQueue)
+{
+    TI_UINT32 uCurrentCmdIndex;
+    TI_UINT32 first = pCmdQueue->head;
+    TCmdQueueNode* pHead;
+    TI_UINT32 NumberOfCommand = pCmdQueue->uNumberOfCommandInQueue;
+
+    for(uCurrentCmdIndex = 0 ; uCurrentCmdIndex < NumberOfCommand ; uCurrentCmdIndex++)
+    {
+        pHead = &pCmdQueue->aCmdQueue[first];
+
+        WLAN_OS_REPORT(("Cmd index %d CmdType = %s %s, Len = %d, Place in Queue = %d \n",
+                       uCurrentCmdIndex, 
+                       cmdQueue_GetCmdString(pHead->cmdType),
+                       cmdQueue_GetIEString(pHead->cmdType, (((pHead->cmdType == CMD_INTERROGATE)||(pHead->cmdType == CMD_CONFIGURE)) ? *(TI_UINT16 *)pHead->aParamsBuf : 0)),
+                       pHead->uParamsLen, 
+                       first));    
+
+        first++;
+        if (first == CMDQUEUE_QUEUE_DEPTH)
+        {
+            first = 0;
+        }
+    } 
+}
+
+
+/*
+ * \brief	print the last uNumOfCmd commands
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  uNumOfCmd - Number of commands to print
+ * \return void
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa cmdQueue_Error
+ */
+void cmdQueue_PrintHistory (TI_HANDLE hCmdQueue, TI_UINT32 uNumOfCmd)
+{
+    TCmdQueue* pCmdQueue = (TCmdQueue*)hCmdQueue; 
+    TI_UINT32 uCurrentCmdIndex;
+    TI_UINT32 first  = pCmdQueue->head;
+    TCmdQueueNode* pHead;
+
+    WLAN_OS_REPORT(("--------------- cmdQueue_PrintHistory of %d -------------------\n",uNumOfCmd));
+    
+    for (uCurrentCmdIndex = 0; uCurrentCmdIndex < uNumOfCmd; uCurrentCmdIndex++)
+    {
+        pHead  =  &pCmdQueue->aCmdQueue[first];
+
+        WLAN_OS_REPORT(("Cmd index %d CmdType = %s %s, Len = %d, Place in Queue = %d \n",
+                        uCurrentCmdIndex, 
+                        cmdQueue_GetCmdString(pHead->cmdType),
+                        cmdQueue_GetIEString(pHead->cmdType, (((pHead->cmdType == CMD_INTERROGATE)||(pHead->cmdType == CMD_CONFIGURE)) ? *(TI_UINT16 *)pHead->aParamsBuf : 0)),
+                        pHead->uParamsLen, 
+                        first));
+
+        if (first == 0)
+        {
+            first = CMDQUEUE_QUEUE_DEPTH - 1;
+        }
+		else
+        {
+			first--;
+        }
+	}
+
+	WLAN_OS_REPORT(("-----------------------------------------------------------------------\n"));
+}
+
+
+/*
+ * \brief	Interperts the command's type to the command's name 
+ * 
+ * \param  MboxCmdType - The command type
+ * \return The command name
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa
+ */
+static char* cmdQueue_GetCmdString (TI_INT32 MboxCmdType)
+    {
+    	switch (MboxCmdType)
+    	{
+    		case 0: return "CMD_RESET";
+    		case 1: return "CMD_INTERROGATE"; 
+    	 	case 2: return "CMD_CONFIGURE";
+    	    	case 3: return "CMD_ENABLE_RX";
+    		case 4: return "CMD_ENABLE_TX";
+    		case 5: return "CMD_DISABLE_RX";
+    	    	case 6: return "CMD_DISABLE_TX";	
+    		case 8: return "CMD_SCAN";
+    		case 9: return "CMD_STOP_SCAN";	
+    	    	case 10: return "CMD_VBM";
+    		case 11: return "CMD_START_JOIN";	
+    		case 12: return "CMD_SET_KEYS";	
+    		case 13: return "CMD_READ_MEMORY";	
+    	    	case 14: return "CMD_WRITE_MEMORY";
+            case 19: return "CMD_SET_TEMPLATE";
+    		case 23: return "CMD_TEST";		
+    		case 27: return "CMD_ENABLE_RX_PATH";
+    		case 28: return "CMD_NOISE_HIST";	
+    	    	case 29: return "CMD_RX_RESET";	
+    		case 32: return "CMD_LNA_CONTROL";	
+    		case 33: return "CMD_SET_BCN_MODE";	
+    		case 34: return "CMD_MEASUREMENT";	
+    		case 35: return "CMD_STOP_MEASUREMENT";
+    		case 36: return "CMD_DISCONNECT";		
+    		case 37: return "CMD_SET_PS_MODE";		
+    		case 38: return "CMD_CHANNEL_SWITCH";	
+    		case 39: return "CMD_STOP_CHANNEL_SWICTH";
+    		case 40: return "CMD_AP_DISCOVERY";
+    		case 41: return "CMD_STOP_AP_DISCOVERY";
+    		case 42: return "CMD_SPS_SCAN";			
+    		case 43: return "CMD_STOP_SPS_SCAN";		
+            case 45: return "CMD_HEALTH_CHECK";     
+            case 48: return "CMD_CONNECTION_SCAN_CFG";
+            case 49: return "CMD_CONNECTION_SCAN_SSID_CFG";
+            case 50: return "CMD_START_PERIODIC_SCAN";
+            case 51: return "CMD_STOP_PERIODIC_SCAN";
+            case 52: return "CMD_SET_STATUS";
+    		default: return " *** Error No Such CMD **** ";
+    	}
+    }
+    
+/*
+ * \brief	Interperts the command's IE to the command's IE name 
+ * 
+ * \param  MboxCmdType - The command IE number
+ * \return The command IE name
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa
+ */
+static char * cmdQueue_GetIEString (TI_INT32 MboxCmdType, TI_UINT16 Id)
+{
+    if( MboxCmdType== CMD_INTERROGATE || MboxCmdType == CMD_CONFIGURE)	
+    {
+        switch (Id)
+        {
+        case ACX_WAKE_UP_CONDITIONS: 		return " (ACX_WAKE_UP_CONDITIONS)";
+        case ACX_MEM_CFG: 					return " (ACX_MEM_CFG)";                 
+        case ACX_SLOT: 						return " (ACX_SLOT) ";                    
+        case ACX_AC_CFG: 					return " (ACX_AC_CFG) ";                  
+        case ACX_MEM_MAP: 					return " (ACX_MEM_MAP)";
+        case ACX_AID: 						return " (ACX_AID)";
+        case ACX_MEDIUM_USAGE: 				return " (ACX_MEDIUM_USAGE) ";                  
+        case ACX_RX_CFG: 					return " (ACX_RX_CFG) ";                  
+        case ACX_STATISTICS: 				return " (ACX_STATISTICS) ";
+        case ACX_FEATURE_CFG: 				return " (ACX_FEATURE_CFG) ";                    
+        case ACX_TID_CFG: 					return " (ACX_TID_CFG) ";                    
+        case ACX_BEACON_FILTER_OPT: 		return " (ACX_BEACON_FILTER_OPT) ";             			      											  
+        case ACX_NOISE_HIST: 				return " (ACX_NOISE_HIST)";           
+        case ACX_PD_THRESHOLD: 				return " (ACX_PD_THRESHOLD) ";                 
+        case ACX_TX_CONFIG_OPT: 			return " (ACX_TX_CONFIG_OPT) ";
+        case ACX_CCA_THRESHOLD: 			return " (ACX_CCA_THRESHOLD)";            
+        case ACX_EVENT_MBOX_MASK: 			return " (ACX_EVENT_MBOX_MASK) ";
+        case ACX_CONN_MONIT_PARAMS: 		return " (ACX_CONN_MONIT_PARAMS) ";
+        case ACX_CONS_TX_FAILURE: 			return " (ACX_CONS_TX_FAILURE) ";
+        case ACX_BCN_DTIM_OPTIONS: 			return " (ACX_BCN_DTIM_OPTIONS) ";                             
+        case ACX_SG_ENABLE: 				return " (ACX_SG_ENABLE) ";                                       
+        case ACX_SG_CFG: 					return " (ACX_SG_CFG) ";                                       
+        case ACX_FM_COEX_CFG: 				return " (ACX_FM_COEX_CFG) ";                                       
+        case ACX_BEACON_FILTER_TABLE: 		return " (ACX_BEACON_FILTER_TABLE) ";
+        case ACX_ARP_IP_FILTER: 			return " (ACX_ARP_IP_FILTER) ";
+        case ACX_ROAMING_STATISTICS_TBL:	return " (ACX_ROAMING_STATISTICS_TBL) ";  
+        case ACX_RATE_POLICY: 				return " (ACX_RATE_POLICY) ";  
+        case ACX_CTS_PROTECTION: 			return " (ACX_CTS_PROTECTION) ";  
+        case ACX_SLEEP_AUTH: 				return " (ACX_SLEEP_AUTH) ";  
+        case ACX_PREAMBLE_TYPE: 			return " (ACX_PREAMBLE_TYPE) ";  
+        case ACX_ERROR_CNT: 				return " (ACX_ERROR_CNT) ";  
+        case ACX_IBSS_FILTER: 				return " (ACX_IBSS_FILTER) ";  
+        case ACX_SERVICE_PERIOD_TIMEOUT:	return " (ACX_SERVICE_PERIOD_TIMEOUT) ";  
+        case ACX_TSF_INFO: 					return " (ACX_TSF_INFO) ";  
+        case ACX_CONFIG_PS_WMM: 			return " (ACX_CONFIG_PS_WMM) "; 
+        case ACX_ENABLE_RX_DATA_FILTER: 	return " (ACX_ENABLE_RX_DATA_FILTER) ";
+        case ACX_SET_RX_DATA_FILTER: 		return " (ACX_SET_RX_DATA_FILTER) ";
+        case ACX_GET_DATA_FILTER_STATISTICS:return " (ACX_GET_DATA_FILTER_STATISTICS) ";
+        case ACX_RX_CONFIG_OPT: 			return " (ACX_RX_CONFIG_OPT) ";
+        case ACX_FRAG_CFG: 				    return " (ACX_FRAG_CFG) ";
+        case ACX_BET_ENABLE: 				return " (ACX_BET_ENABLE) ";
+        case ACX_RSSI_SNR_TRIGGER: 			return " (ACX_RSSI_SNR_TRIGGER) ";
+        case ACX_RSSI_SNR_WEIGHTS: 			return " (ACX_RSSI_SNR_WEIGHTS) ";
+        case ACX_KEEP_ALIVE_MODE:           return " (ACX_KEEP_ALIVE_MODE) ";
+        case ACX_SET_KEEP_ALIVE_CONFIG:     return " (ACX_SET_KEEP_ALIVE_CONFIG) ";
+        case ACX_SET_DCO_ITRIM_PARAMS:      return " (ACX_SET_DCO_ITRIM_PARAMS) ";
+        case DOT11_RX_MSDU_LIFE_TIME: 		return " (DOT11_RX_MSDU_LIFE_TIME) ";
+        case DOT11_CUR_TX_PWR:   			return " (DOT11_CUR_TX_PWR) ";
+        case DOT11_RTS_THRESHOLD: 			return " (DOT11_RTS_THRESHOLD) ";
+        case DOT11_GROUP_ADDRESS_TBL: 		return " (DOT11_GROUP_ADDRESS_TBL) ";  
+               
+        default:	return " *** Error No Such IE **** ";
+        }
+    }
+    return "";
+}
+
+#endif  /* TI_DBG */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/CmdQueue.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,167 @@
+/*
+ * CmdQueue.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 CmdQueue.h
+ *  \brief CmdQueue internal defenitions
+ *
+ *  \see CmdQueue.c
+ */
+
+#ifndef _CMDQUEUE_H_
+#define _CMDQUEUE_H_
+
+
+
+
+/*****************************************************************************
+ **         Defines                                                         **
+ *****************************************************************************/
+#define CMDQUEUE_QUEUE_DEPTH          30
+#define CMDQUEUE_HISTORY_DEPTH        5
+#define CMDQUEUE_INFO_ELEM_HEADER_LEN 4
+
+
+#define RC_CONVERT(rc) \
+    (rc == TXN_STATUS_OK || rc == TXN_STATUS_COMPLETE || rc == TXN_STATUS_PENDING || rc == TI_OK) ? TI_OK : TI_NOK
+
+
+/*****************************************************************************
+ **         Enums                                                           **
+ *****************************************************************************/
+typedef enum 
+{
+    CMDQUEUE_EVENT_RUN,
+    CMDQUEUE_EVENT_COMPLETE,
+    CMDQUEUE_EVENT_NUM
+
+} ECmdQueueSmEvents;
+
+
+typedef enum 
+{
+    CMDQUEUE_STATE_IDLE,
+    CMDQUEUE_STATE_WAIT_FOR_COMPLETION
+
+} ECmdQueueSmStates;
+
+
+/*****************************************************************************
+ **         Structures                                                      **
+ *****************************************************************************/
+/*  CmdQueue Node */
+typedef struct 
+{
+    /* Command Type Config/interrogat ... */
+    Command_e               cmdType;        
+    TI_UINT32               uParamsLen; 
+    void*                   fCb;
+    TI_HANDLE               hCb;
+    /* Param for config */
+    TI_UINT8                aParamsBuf[MAX_CMD_PARAMS]; 
+    /* A returned value buffer */ 
+    TI_UINT8*               pInterrogateBuf; 
+
+} TCmdQueueNode;
+
+
+/*  Saved CallBack Node In case of Recovery*/
+typedef struct 
+{
+    void*                   fCb;
+    TI_HANDLE               hCb;
+    /* A returned value buffer */
+    TI_UINT8*               pInterrogateBuf; 
+
+} TCmdQueueRecoveryNode;
+
+
+typedef void (*TCmdQueueCb) (TI_HANDLE handle, TI_UINT16 uMboxStatus);
+
+
+typedef void (*TCmdQueueGenericCb)(TI_HANDLE handle, TI_UINT16 uCmdType, TI_UINT16 uCmdID, TI_UINT32 status);
+
+
+/** \struct TCmdQueue
+ * \brief CmdQueue structure
+ * 
+ * \par Description
+ * 
+ * \sa	
+ */ 
+typedef struct
+{   
+    /* Handles */
+    TI_HANDLE               hOs;
+    TI_HANDLE               hReport;
+    TI_HANDLE               hCmdMBox;
+    TI_HANDLE               hTwIf;
+
+    /* SM */
+    ECmdQueueSmStates       state;
+    TCmdQueueGenericCb      fCmdCompleteCb;
+    TI_HANDLE               hCmdCompleteCb;
+    TCmdQueueCb             fFailureCb;
+    TI_HANDLE               hFailureCb;
+
+    /* Queues */
+    TCmdQueueNode           aCmdQueue [CMDQUEUE_QUEUE_DEPTH]; 
+    TCmdQueueRecoveryNode   aRecoveryQueue [CMDQUEUE_QUEUE_DEPTH];
+
+    /* Indexes & counters */
+    TI_UINT32               head;
+    TI_UINT32               tail;
+    TI_UINT32               uNumberOfCommandInQueue;
+    TI_UINT32               uMaxNumberOfCommandInQueue;
+    TI_UINT32               uNumberOfRecoveryNodes;  
+    #ifdef TI_DBG
+        TI_UINT32               uCmdSendCounter;
+        TI_UINT32               uCmdCompltCounter;
+    #endif
+
+    /* Error handling */
+    TI_BOOL                 bErrorFlag;
+    /* Mbox status */
+    TI_BOOL                 bMboxEnabled;
+    /* Notify that we have already awaken the chip */
+    TI_BOOL                 bAwake;
+
+} TCmdQueue; 
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Ctrl/Export_Inc/CmdQueue_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,302 @@
+/*
+ * CmdQueue_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 CmdQueue_api.h
+ *  \brief CmdQueue api
+ *
+ *  \see CmdQueue.c
+ */
+
+#ifndef _CMDQUEUE_API_H_
+#define _CMDQUEUE_API_H_
+
+#include "public_commands.h"
+
+
+/*****************************************************************************
+ **         Structures                                                      **
+ *****************************************************************************/
+
+/* User Callback for Queue */
+typedef void (*TCmdQueueInterrogateCb) (TI_HANDLE handle, TI_UINT16 status, void *pItrBuf);
+
+
+/*****************************************************************************
+ **         APIs definitions                                  **
+ *****************************************************************************/
+
+/*
+ * \brief	Create the TCmdQueue object
+ * 
+ * \param  hOs  - OS module object handle
+ * \return Handle to the created object
+ * 
+ * \par Description
+ * Calling this function creates a CmdQueue object
+ * 
+ * \sa cmdQueue_Destroy
+ */
+TI_HANDLE cmdQueue_Create (TI_HANDLE hOS);
+
+
+/*
+ * \brief	Destroys the cmdQueue object
+ * 
+ * \param  hCmdMbox  - The object to free
+ * \return TI_OK
+ * 
+ * \par Description
+ * Calling this function destroys the cmdQueue object
+ * 
+ * \sa cmdQueue_Create
+ */
+TI_STATUS cmdQueue_Destroy (TI_HANDLE hCmdQueue);
+
+
+/*
+ * \brief	Configure the CmdQueue object
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  hReport - Handle to report module
+ * \param  hTwIf  - Handle to TwIf
+ * \param  hTimer  - Handle to os timer
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdQueue_Init   (TI_HANDLE hCmdQueue, 
+                           TI_HANDLE hCmdMbox, 
+                           TI_HANDLE hReport, 
+                           TI_HANDLE hTwIf,
+                           TI_HANDLE hTimer);
+
+
+/*
+ * \brief	Prepere the command queue for recovery.
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * Copy the queue nodes to a recovery list, in order handle 
+ * the commands CB's after recovery has finished
+ * 
+ * \sa cmdQueue_EndReconfig
+ */
+TI_STATUS cmdQueue_Restart (TI_HANDLE hCmdQueue);
+
+
+/*
+ * \brief	Call the stored CB to end the recovery of the MBox queue
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * Call the stored CB's with an error status 
+ * 
+ * \sa cmdQueue_StartReconfig
+ */
+TI_STATUS cmdQueue_EndReconfig (TI_HANDLE hCmdQueue);
+
+
+/*
+ * \brief	Register for a call back to be called when Command Complete occured and the CmdMboxCB was NULL
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  fCb - The command's Cb function
+ * \param  hCb - The command's Cb handle
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdQueue_RegisterCmdCompleteGenericCb (TI_HANDLE hCmdQueue, void *fCb, TI_HANDLE hCb);
+
+
+/*
+ * \brief	Register for a call back to be called when an Error (Timeout) occurs
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  fCb - The command's Cb function
+ * \param  hCb - The command's Cb handle
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdQueue_RegisterForErrorCb (TI_HANDLE hCmdQueue, void *fCb, TI_HANDLE hCb);
+
+
+/*
+ * \brief	Sends the command to the cmdMbox
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  eMboxCmdType - The command type
+ * \param  pMboxBuf - The command itself (parameters)
+ * \param  uParamsLen - The command's length
+ * \param  fCb - The command's Cb function
+ * \param  hCb - The command's Cb handle
+ * \param  pCb - Pointer to the results buffer (for interrogate commands)
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Pushes the command to the command queue, which triggers the 
+ * CmdQueue SM.
+ * 
+ * \sa cmdQueue_Push
+ */
+TI_STATUS cmdQueue_SendCommand (TI_HANDLE  hCmdQueue, 
+                            Command_e  eMboxCmdType, 
+                            void      *pMboxBuf, 
+                            TI_UINT32  uParamsLen, 
+                            void      *fCb, 
+                            TI_HANDLE  hCb, 
+                            void      *pCb);
+
+
+/*
+ * \brief	Notify the CmdQueue SM on the result received.
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Call the CmdQueue SM with CMDQUEUE_EVENT_COMPLETE
+ * 
+ * \sa cmdQueue_SM
+ */
+TI_STATUS cmdQueue_ResultReceived (TI_HANDLE hCmdQueue);
+
+
+
+/*
+ * \brief	Returns maximum number of commands (ever) in TCmdQueue queue
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return maximum number of commands (ever) in mailbox queue
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa cmdQueue_Error
+ */
+TI_UINT32 cmdQueue_GetMaxNumberOfCommands (TI_HANDLE hCmdQueue);
+
+
+/*
+ * \brief	Enables the CmdMbox (on exit from init mode)
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa cmdQueue_DisableMbox
+ */
+TI_STATUS cmdQueue_EnableMbox (TI_HANDLE hCmdQueue);
+
+
+/*
+ * \brief	Disables the CmdMbox (when stopping the driver)
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa cmdQueue_EnableMbox
+ */
+TI_STATUS cmdQueue_DisableMbox (TI_HANDLE hCmdQueue);
+
+
+/*
+ * \brief	Called when a command timeout occur
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa cmdQueue_Init, cmdMbox_TimeOut
+ */
+TI_STATUS cmdQueue_Error (TI_HANDLE hCmdQueue, TI_UINT32 command, TI_UINT32 status, void *param);
+
+
+#ifdef TI_DBG
+
+/*
+ * \brief	Print the command queue & statistics
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \return void
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa cmdQueue_PrintQueue
+ */
+void      cmdQueue_Print (TI_HANDLE hCmdQueue);
+
+
+/*
+ * \brief	print the last uNumOfCmd commands
+ * 
+ * \param  hCmdQueue - Handle to CmdQueue
+ * \param  uNumOfCmd - Number of commands to print
+ * \return void
+ * 
+ * \par Description
+ * Used for debugging purposes
+ *
+ * \sa cmdQueue_Error
+ */
+void      cmdQueue_PrintHistory (TI_HANDLE hCmdQueue, TI_UINT32 uNumOfCmd);
+
+
+#endif  /* TI_DBG */
+
+
+#endif  /* _CMDQUEUE_API_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Data_Service/Export_Inc/RxQueue_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,64 @@
+/*
+ * RxQueue_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   RxQueue_api.h 
+ *  \brief  RxQueue module header file.                                  
+ *
+ *  \see    RxQueue_api.c
+ */
+
+#ifndef _RX_QUEUE_H_
+#define _RX_QUEUE_H_
+
+/* 
+ * External Functions Prototypes 
+ * ============================= 
+ */
+TI_HANDLE RxQueue_Create        (TI_HANDLE hOs);
+TI_STATUS RxQueue_Destroy       (TI_HANDLE hRxQueue);
+TI_STATUS RxQueue_Init          (TI_HANDLE hRxQueue, TI_HANDLE hReport);
+void      RxQueue_CloseBaSession(TI_HANDLE hRxQueue, TI_UINT8 uFrameTid);
+void      RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void *aFrame);
+void      RxQueue_Register_CB   (TI_HANDLE hRxQueue, TI_UINT32 CallBackID, void *CBFunc, TI_HANDLE CBObj);
+
+
+#endif  /* _STA_CAP_H_ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Data_Service/Export_Inc/txCtrlBlk_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,66 @@
+/*
+ * txCtrlBlk_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:	txCtrlBlk_api.h											       */
+/*    PURPOSE:	Tx control block module API.							   */
+/*																		   */
+/***************************************************************************/
+#ifndef _TX_CTRL_BLK_API_H_
+#define _TX_CTRL_BLK_API_H_
+
+
+#include "TWDriver.h"
+
+/* Public Function Definitions */
+TI_HANDLE	txCtrlBlk_Create    (TI_HANDLE hOs);
+TI_STATUS	txCtrlBlk_Destroy   (TI_HANDLE hTxCtrlBlk);
+TI_STATUS   txCtrlBlk_Init      (TI_HANDLE hTxCtrlBlk, TI_HANDLE hReport, TI_HANDLE hContext);
+TTxCtrlBlk *txCtrlBlk_Alloc     (TI_HANDLE hTxCtrlBlk);
+void		txCtrlBlk_Free      (TI_HANDLE hTxCtrlBlk, TTxCtrlBlk *pCurrentEntry);
+TTxCtrlBlk *txCtrlBlk_GetPointer(TI_HANDLE hTxCtrlBlk, TI_UINT8 descId);
+#ifdef TI_DBG
+void		txCtrlBlk_PrintTable(TI_HANDLE hTxCtrlBlk);
+#endif /* TI_DBG */
+
+
+#endif  /* _TX_CTRL_BLK_API_H_ */
+		
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Data_Service/Export_Inc/txHwQueue_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,76 @@
+/*
+ * txHwQueue_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  txHwQueue_api.h
+ *
+ *   PURPOSE: HW Tx Queue module API.
+ * 
+ ****************************************************************************/
+
+#ifndef _TX_HW_QUEUE_API_H
+#define _TX_HW_QUEUE_API_H
+
+
+#include "TWDriver.h"
+#include "TWDriverInternal.h"
+
+
+/* Public Function Definitions */
+
+TI_HANDLE	txHwQueue_Create (TI_HANDLE hOs);
+TI_STATUS	txHwQueue_Destroy (TI_HANDLE hTxHwQueue);
+TI_STATUS	txHwQueue_Init (TI_HANDLE hTxHwQueue, TI_HANDLE hReport);
+TI_STATUS	txHwQueue_Config (TI_HANDLE hTxHwQueue, TTwdInitParams *pInitParams);
+TI_STATUS	txHwQueue_SetHwInfo (TI_HANDLE hTxHwQueue, TDmaParams *pDmaParams);
+TI_STATUS	txHwQueue_Restart (TI_HANDLE hTxHwQueue);
+ETxHwQueStatus txHwQueue_AllocResources (TI_HANDLE hTxHwQueue, TTxCtrlBlk *pTxCtrlBlk);
+void        txHwQueue_UpdateFreeResources (TI_HANDLE hTxHwQueue, FwStatus_t *pFwStatus);
+void        txHwQueue_RegisterCb (TI_HANDLE hTxHwQueue, TI_UINT32 uCallBackId, void *fCbFunc, TI_HANDLE hCbHndl);
+#ifdef TI_DBG
+void		txHwQueue_PrintInfo (TI_HANDLE hTxHwQueue);
+#endif /* TI_DBG */
+
+
+#endif /* _TX_HW_QUEUE_API_H */
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Data_Service/RxQueue.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,871 @@
+/*
+ * RxQueue.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   RxQueue.c 
+ *  \brief  RX Queue module that responsible to support re-ordering of received packets to upper layers.
+ *  
+ *  \see    RxQueue.h
+ */
+#define __FILE_ID__  FILE_ID_98
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h" 
+#include "RxBuf.h"
+#include "TWDriver.h"
+#include "public_descriptors.h"
+
+/************************ static definition declaration *****************************/
+#define RX_QUEUE_ARRAY_SIZE		                            8
+#define RX_QUEUE_ARRAY_SIZE_BIT_MASK                        0x7 /* RX_QUEUE_ARRAY_SIZE -1 */
+#define RX_QUEUE_WIN_SIZE		                            RX_QUEUE_ARRAY_SIZE
+
+/*
+ *explanation for this MACRO - it protects against wrap around
+ * 
+ *  if A = 0x0001   &   B = 0xFFFF  
+ * 
+ *                  (int16)(0x0001 - 0xFFFF) = 2 --> A > B
+ */ 
+#define A_GREATER_THAN_B(A, B) ( (TI_INT16)( (TI_UINT16)A - (TI_UINT16)B) > 0)
+#define BA_SESSION_IS_A_BIGGER_THAN_B(A,B)       (((((A)-(B)) & 0xFFF) < 0x7FF) && ((A)!=(B)))
+#define BA_SESSION_IS_A_BIGGER_EQUAL_THAN_B(A,B) (((((A)-(B)) & 0xFFF) < 0x7FF))
+#define SEQ_NUM_WRAP 0x1000
+#define SEQ_NUM_MASK 0xFFF
+
+
+/************************ static structures declaration *****************************/
+/* structure describe one entry of save packet information in the packet queue array */
+typedef struct 
+{
+    void                *pPacket;	/* Packet address of the packet */
+    TI_STATUS	        tStatus;	/* RxXfer status. */
+    TI_UINT16           uFrameSn;
+} TRxQueuePacketEntry;	
+
+/* structure describe set of data that one Tid, also including the arras himself */
+typedef struct 
+{
+    /* array packets Entries */
+    TRxQueuePacketEntry aPaketsQueue [RX_QUEUE_ARRAY_SIZE];	
+    /* TID BA state */
+    TI_BOOL	            aTidBaEstablished;	              
+    /* index that winStar point on */
+    TI_UINT32 	        aWinStartArrayInex;	                    
+    /* windows size */
+    TI_UINT32	        aTidWinSize;
+	/* expected sequence number (ESN) */ 
+    TI_UINT16	        aTidExpectedSn;
+} TRxQueueTidDataBase;	
+
+/* structure describe set of data that assist of manage one SA RxQueue arrays */
+typedef struct 
+{
+    TRxQueueTidDataBase tSa1ArrayMng [MAX_NUM_OF_802_1d_TAGS];
+} TRxQueueArraysMng;	
+
+/* main RxQueue structure in order to management the packets disordered array. */
+typedef struct 
+{
+    TI_HANDLE           hOs;                        /* OS handler */
+    TI_HANDLE           hReport;                    /* Report handler */
+    TRxQueueArraysMng   tRxQueueArraysMng;          /* manage each Source Address RxQueue arrays */
+    TPacketReceiveCb    tReceivePacketCB;           /* Receive packets CB address */
+    TI_HANDLE           hReceivePacketCB_handle;    /* Receive packets CB handler */
+
+} TRxQueue;	
+
+/************************ static function declaration *****************************/
+static TI_STATUS RxQueue_PassPacket (TI_HANDLE hRxQueue, TI_STATUS tStatus, const void *pBuffer);
+
+/** 
+ * \fn     RxQueue_Create() 
+ * \brief  Create the RxQueue module.
+ * 
+ * Allocate and clear the RxQueue module object.
+ * 
+ * \param  hOs - Handle to Os Abstraction Layer
+ * \return Handle of the allocated object 
+ * \sa     RxQueue_Destroy
+ */ 
+TI_HANDLE RxQueue_Create (TI_HANDLE hOs)
+{
+	TRxQueue *pRxQueue;
+
+	/* allocate module object */
+	pRxQueue = os_memoryAlloc (hOs, sizeof(TRxQueue),MemoryNormal);
+	
+	if (!pRxQueue)
+	{
+		WLAN_OS_REPORT (("RxQueue_Create():  Allocation failed!!\n"));
+		return NULL;
+	}
+	
+    os_memoryZero (hOs, pRxQueue, (sizeof(TRxQueue)));
+
+    pRxQueue->hOs = hOs;
+
+	return (pRxQueue);
+}
+
+
+/** 
+ * \fn     RxQueue_Destroy()
+ * \brief  Destroy the module. 
+ * 
+ * Free the module's queues and object.
+ * 
+ * \param  hRxQueue - The module object
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     RxQueue_Create
+ */ 
+TI_STATUS RxQueue_Destroy (TI_HANDLE hRxQueue)
+{
+    TRxQueue *pRxQueue = (TRxQueue *)hRxQueue;
+
+    /* free module object */
+	os_memoryFree (pRxQueue->hOs, pRxQueue, sizeof(TRxQueue));
+	
+    return TI_OK;
+}
+
+
+/** 
+ * \fn     RxQueue_Init() 
+ * \brief  Init required handles 
+ * 
+ * Init required handles and module variables.
+ * 
+ * \note    
+ * \param  hRxQueue - The module object
+ * \param  hReport - Report module Handles
+ * \return TI_OK on success or TI_NOK on failure  
+ * \sa     
+ */ 
+TI_STATUS RxQueue_Init (TI_HANDLE hRxQueue, TI_HANDLE hReport)
+{
+	TRxQueue *pRxQueue = (TRxQueue *)hRxQueue;
+    
+    pRxQueue->hReport   = hReport;
+    
+	return TI_OK;
+}
+
+
+/** 
+ * \fn     RxQueue_Register_CB()
+ * \brief  Register the function to be called for received Rx.
+ * 
+ * \note   
+ * \param  hRxQueue - The module object
+ * \param  CallBackID - event ID
+ * \param  CBFunc - function address.
+ * \param  CBObj - function parameter.
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     
+ */ 
+void RxQueue_Register_CB (TI_HANDLE hRxQueue, TI_UINT32 uCallBackID, void *CBFunc, TI_HANDLE CBObj)
+{
+    TRxQueue* pRxQueue = (TRxQueue *)hRxQueue;
+
+    TRACE1(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_Register_CB: CallBack ID = 0x%x\n", uCallBackID);
+
+    switch(uCallBackID)
+    {
+    case TWD_INT_RECEIVE_PACKET:
+        pRxQueue->tReceivePacketCB = (TPacketReceiveCb)CBFunc;
+        pRxQueue->hReceivePacketCB_handle = CBObj;
+        break;
+
+    default:
+        TRACE0(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_Register_CB: Illegal value\n");
+        break;
+    }
+}
+
+/** 
+ * \fn     RxQueue_CloseBaSession ()
+ * \brief  Close BA session receiver and pass all packets in the TID queue to upper layer.
+ *
+ * \note   
+ * \param  hRxQueue - RxQueue handle.
+ * \param  uFrameTid - TID session.
+ * \return None 
+ * \sa     
+ */ 
+void RxQueue_CloseBaSession(TI_HANDLE hRxQueue, TI_UINT8 uFrameTid)
+{
+    TRxQueue            *pRxQueue     = (TRxQueue *)hRxQueue;
+    TI_UINT32            i;
+    /*set the SA Tid pointer */
+    TRxQueueTidDataBase *pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]);
+    
+    /* TID illegal value ? */
+    if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS)
+    {
+        TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_CloseBaSession: BA event - DELBA frame with TID value too big, TID = %d\n", uFrameTid);
+        
+        return;
+    }
+
+    if(pTidDataBase->aTidBaEstablished == TI_TRUE)
+    {
+        /* clean BA session */
+        pTidDataBase->aTidBaEstablished = TI_FALSE;
+
+        /* pass all valid entries at the array */ 
+        for (i = 0; (i < RX_QUEUE_ARRAY_SIZE) && (i < RX_QUEUE_WIN_SIZE); i++)
+        {
+            if (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL)
+            {
+                RxQueue_PassPacket (pRxQueue, 
+                                    pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus,
+                                    pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket);
+
+                pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL;
+            }
+
+            pTidDataBase->aWinStartArrayInex ++;
+
+            /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */
+            pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK;
+        }
+    }
+}
+
+
+/** 
+ * \fn     RxQueue_PassPacket()
+ * \brief  Responsible on decode packet parameters and pass it to upper layer.
+ *
+ * \note   
+ * \param  hRxQueue - RxQueue handle.
+ * \param  aStatus - RxXfer status that indicate if the upper layer should free the packet or use it.
+ * \param  pFrame - paket address of the packet
+ * \param  pRxParams - address to structure of the Rx Descriptor received by FW.
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     
+ */ 
+static TI_STATUS RxQueue_PassPacket (TI_HANDLE hRxQueue, TI_STATUS tStatus, const void *pBuffer)
+{
+
+    TRxQueue            *pRxQueue   = (TRxQueue *)hRxQueue;
+
+    if (tStatus == TI_OK)
+    {
+        /* Get the mac header location in the packet Buffer */
+        dot11_header_t *pMacHdr = (dot11_header_t *)(TI_UINT8*)RX_BUF_DATA(pBuffer);
+
+        /* Handle endian for the frame control fields */
+        pMacHdr->fc  = ENDIAN_HANDLE_WORD(pMacHdr->fc);
+        pMacHdr->duration = ENDIAN_HANDLE_WORD(pMacHdr->duration);
+        pMacHdr->seqCtrl = ENDIAN_HANDLE_WORD(pMacHdr->seqCtrl);
+    }
+    else
+    {
+        RxIfDescriptor_t    *pRxParams  = (RxIfDescriptor_t*)pBuffer;
+
+        pRxParams->status &= ~RX_DESC_STATUS_MASK;
+        pRxParams->status |= RX_DESC_STATUS_DRIVER_RX_Q_FAIL;
+    }
+
+    TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_PassPacket: call TWD_OWNER_RX_QUEUE CB. In std rxData_ReceivePacket()\n");
+
+    /* Set the packet to upper layer */
+    /* if the packet status not success it will be discarded */
+    pRxQueue->tReceivePacketCB (pRxQueue->hReceivePacketCB_handle, pBuffer);
+
+    return TI_OK;
+}
+
+
+/** 
+ * \fn     RxQueue_ReceivePacket()
+ * \brief  Main function of the RxQueue module. 
+ * Responsible on reorder of the packets from the RxXfer to the RX module.
+ * Call from RxXfer in order to pass packet to uppers layers.
+ * In order to save disordered packets the module use array of structures per TID 
+ * that each entry describe a packet. The array elements is sorted in the way that 
+ * the winStart array index represent always the winStar packet and the lowest SN. 
+ * Each increment index represent index at the BA window. Array index winEnd  always 
+ * represent winEnd packet. The indexes of winStart and winEnd handled in cyclic manner.
+ * The function functionality devided to parts:
+ *   Part 1: 
+ * in case the modulo receive packet with SN equal to winStart: 
+ * "	pass it to upper layers
+ * "	increases winStart and array index winStart
+ * "	validate that all sequential queue packet are pass to the upper layers.
+ *   Part 2: 
+ * in case the modulo receive packet that SN between winStart to winEnd: 
+ * "	Save it sorted at the array at index: Save index = ((SN - winStart) + index array winStart) % arraySize.
+ *   Part 3: 
+ * in case the modulo receive packet that SN higher then winEnd: 
+ * "	Update winStart and WinEnd. 
+ * "	Save it sorted at the array in index winEnd index.
+ * "	Pass to the upper layers all packets at the array indexes from old winStart index to the updated winStart index.
+ *   Part 4 + 5: 
+ * in case the modulo receive BA event packet: 
+ * "	Update winStart and WinEnd 
+ * "	Pass to the upper layers all packets at the array indexes from old winStart index to the updated winStart index.
+ * "	Free BA event packet via pass it to upper layers with error status.
+ *
+ * \note   
+ * \param  hRxQueue - RxQueue handle.
+ * \param  aStatus - RxXfer status that indicate if the upper layer should free the packet or use it.
+ * \param  pBuffer - paket address of the packet
+ * \return None 
+ * \sa     
+ */ 
+void RxQueue_ReceivePacket (TI_HANDLE hRxQueue, const void * pBuffer)
+{
+    TRxQueue            *pRxQueue   = (TRxQueue *)hRxQueue;
+    RxIfDescriptor_t    *pRxParams  = (RxIfDescriptor_t*)pBuffer;
+    TI_UINT8            *pFrame     = RX_BUF_DATA((TI_UINT8 *)pBuffer);
+    TI_STATUS           tStatus     = TI_OK;
+    dot11_header_t      *pHdr       = (dot11_header_t *)pFrame;
+    TI_UINT16		    uQosControl;
+
+    COPY_WLAN_WORD(&uQosControl, &pHdr->qosControl); /* copy with endianess handling. */
+    TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: packet_class_tag = 0x%x(%d)",pRxParams->packet_class_tag,pRxParams->packet_class_tag);
+
+    /* 
+     * Retrieving the TAG from the packet itself and not from the Rx Descriptor since by now it is not correct  
+     * Note: in the DR TAG_CLASS_EAPOL packet handled as TAG_CLASS_QOS_DATA   
+     */
+    if (IS_QOS_FRAME(*(TI_UINT16*)pFrame) && (pRxParams->packet_class_tag != TAG_CLASS_QOS_DATA) && (pRxParams->packet_class_tag != TAG_CLASS_AMSDU))
+	{
+        TRACE1(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: BAD CLASS TAG =0x%x from FW.\n", pRxParams->packet_class_tag);
+
+		
+        /* Get AMSDU bit from frame */
+        if( uQosControl & DOT11_QOS_CONTROL_FIELD_A_MSDU_BITS)
+        {
+            pRxParams->packet_class_tag = TAG_CLASS_AMSDU;
+        }
+        else
+        {
+            pRxParams->packet_class_tag = TAG_CLASS_QOS_DATA;
+        }
+	}
+
+    /* 
+     * packet doesn't need reorder ? 
+     */
+    if ((pRxParams->packet_class_tag != TAG_CLASS_QOS_DATA) && (pRxParams->packet_class_tag != TAG_CLASS_BA_EVENT) && (pRxParams->packet_class_tag != TAG_CLASS_AMSDU))
+    {
+        TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_ReceivePacket: pass packet without reorder.\n");
+
+        RxQueue_PassPacket (pRxQueue, tStatus, pBuffer);
+
+        return;
+    }
+
+
+    /* 
+     * pRxParams->type == TAG_CLASS_QOS_DATA ? 
+     */
+    if ((pRxParams->packet_class_tag == TAG_CLASS_QOS_DATA) || (pRxParams->packet_class_tag == TAG_CLASS_AMSDU))
+    {
+        TI_UINT8            uFrameTid;
+        TI_UINT16           uFrameSn;
+        TI_UINT16		    uSequenceControl;
+        TRxQueueTidDataBase *pTidDataBase;
+
+        /* Get TID from frame */
+        uFrameTid = uQosControl & DOT11_QOS_CONTROL_FIELD_TID_BITS;
+
+        TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: QoS Packet received");
+        TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: uFrameTid = 0x%x(%d)",uFrameTid,uFrameTid);
+
+        /* TID illegal value ? */
+        if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS)
+        {
+            TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: TID value too big, TID = %d. packet discarded!\n",uFrameTid);
+
+            RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+            return;
+        }
+
+        /*set the SA Tid pointer */
+        pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]);
+
+        /* TID legal value */
+        /* packet TID BA not established ? */ 
+        if (pTidDataBase->aTidBaEstablished != TI_TRUE)
+        {
+            TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: pass packet without reorder.\n");
+
+            RxQueue_PassPacket (pRxQueue, tStatus, pBuffer);
+
+            return;
+        }
+
+        /* packet TID BA established */
+        /* Get Sequence Number from frame */
+        COPY_WLAN_WORD(&uSequenceControl, &pHdr->seqCtrl); /* copy with endianess handling. */
+        uFrameSn = (uSequenceControl & DOT11_SC_SEQ_NUM_MASK) >> 4;
+
+        TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: uFrameSn = 0x%x(%d)",uFrameSn,uFrameSn);
+        TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: aTidExpectedSn = 0x%x(%d)",pTidDataBase->aTidExpectedSn,pTidDataBase->aTidExpectedSn);
+
+        /* 
+         * note: 
+         * the FW never send paket, in establish TID BA, that the SN less then ESN !!! 
+         */
+
+        /* frame Sequence Number is the expected one ? */
+        if (uFrameSn == pTidDataBase->aTidExpectedSn)
+        {
+            TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: frame Sequence Number == expected one Sequence Number.\n");
+
+            /* pass the packet */
+            RxQueue_PassPacket (pRxQueue, tStatus, pBuffer);
+
+            pTidDataBase->aTidExpectedSn++;
+
+            /* increase the ArrayInex to the next */
+            pTidDataBase->aWinStartArrayInex++;
+
+            /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */
+            pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK;
+
+            /* pass all saved queue packets with SN higher then the expected one */
+            while (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL)
+            {
+                TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: pass all saved queue packets with SN higher then the expected one");
+                TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: aTidExpectedSn = 0x%x(%d)",pTidDataBase->aTidExpectedSn,pTidDataBase->aTidExpectedSn);
+                TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: aWinStartArrayInex = 0x%x(%d)",pTidDataBase->aWinStartArrayInex,pTidDataBase->aWinStartArrayInex);
+
+                RxQueue_PassPacket (pRxQueue, 
+                                    pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus,
+                                    pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket);
+
+                pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL;
+
+                pTidDataBase->aWinStartArrayInex++;
+
+                /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */
+                pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK;
+
+                 pTidDataBase->aTidExpectedSn++;
+            }
+
+            /* aTidExpectedSn % 0xfff in order to tack care of wrap around */
+            pTidDataBase->aTidExpectedSn &= 0xfff; 
+
+            return;
+        }
+
+        /* frame Sequence Number is lower then Expected sequence number (ISN) ? */ 
+        if (! BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn, pTidDataBase->aTidExpectedSn))
+
+        {
+            TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: frame Sequence Number is lower then expected sequence number.\n");
+
+            RxQueue_PassPacket (pRxQueue, tStatus, pBuffer);
+
+            return;
+        }
+
+        /* frame Sequence Number between winStart and winEnd ? */
+        if ((BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn, pTidDataBase->aTidExpectedSn)) &&
+            /* mean: uFrameSn <= pTidDataBase->aTidExpectedSn + pTidDataBase->aTidWinSize) */
+            ( ! BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn,(pTidDataBase->aTidExpectedSn + pTidDataBase->aTidWinSize - 1))))
+        {
+            TI_UINT16 uSaveInex = pTidDataBase->aWinStartArrayInex + (TI_UINT16)((uFrameSn + SEQ_NUM_WRAP - pTidDataBase->aTidExpectedSn) & SEQ_NUM_MASK);  
+            /* uSaveInex % RX_QUEUE_ARRAY_SIZE */
+            uSaveInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 
+
+            TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: frame Sequence Number between winStart and winEnd.\n");
+            TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: uSaveInex = 0x%x(%d)",uSaveInex,uSaveInex);
+            
+			if (pTidDataBase->aPaketsQueue[uSaveInex].pPacket == NULL)
+			{
+                TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: Enter packet to Reorder Queue");
+                
+            /* save the packet in the queue */
+            pTidDataBase->aPaketsQueue[uSaveInex].tStatus = tStatus;
+            pTidDataBase->aPaketsQueue[uSaveInex].pPacket = (void *)pBuffer;
+            pTidDataBase->aPaketsQueue[uSaveInex].uFrameSn = uFrameSn;
+			}
+			else
+			{
+				 TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: frame Sequence has allready saved. uFrameSn = %d\n",uFrameSn);
+				 RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+				 return;
+			}
+            return;
+        }
+
+
+        /* 
+        frame Sequence Number higher then winEnd ? 
+        */
+        if ( BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn, (pTidDataBase->aTidExpectedSn + pTidDataBase->aTidWinSize - 1)) )
+        {
+            TI_UINT32 i;
+            TI_UINT16 uNewWinStartSn = (uFrameSn + SEQ_NUM_WRAP - pTidDataBase->aTidWinSize + 1) & SEQ_NUM_MASK;
+            TI_UINT16 uSaveInex;
+            
+            
+            TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: frame Sequence Number higher then winEnd. \n");
+            TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: uNewWinStartSn = 0x%x(%d)",uNewWinStartSn,uNewWinStartSn);
+
+            /* increase the ArrayInex to the next */
+            pTidDataBase->aWinStartArrayInex++;
+
+            /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */
+            pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK;
+
+            /* update the Expected SN since the current one is lost */
+            pTidDataBase->aTidExpectedSn++;
+            pTidDataBase->aTidExpectedSn &= 0xFFF;
+
+            /* pass all saved queue packets with SN lower then the new win start */
+            for (i = 0;
+                 BA_SESSION_IS_A_BIGGER_THAN_B(uNewWinStartSn,pTidDataBase->aTidExpectedSn) && 
+                  (i < RX_QUEUE_ARRAY_SIZE) && 
+                  (i < pTidDataBase->aTidWinSize);
+                 i++)
+            {
+                TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: aTidExpectedSn = 0x%x(%d)",pTidDataBase->aTidExpectedSn,pTidDataBase->aTidExpectedSn);
+                TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: aWinStartArrayInex = 0x%x(%d)",pTidDataBase->aWinStartArrayInex,pTidDataBase->aWinStartArrayInex);
+
+                if (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL)
+                {
+                    TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: Send Packet to Upper layer");
+                    RxQueue_PassPacket (pRxQueue, 
+                                        pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus,
+                                        pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket);
+
+                    pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL;
+                }
+
+                pTidDataBase->aWinStartArrayInex++;
+
+                /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */
+                pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK;
+
+                pTidDataBase->aTidExpectedSn++;
+                pTidDataBase->aTidExpectedSn &= 0xFFF;
+
+            }
+
+            TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: aTidExpectedSn = 0x%x(%d)",pTidDataBase->aTidExpectedSn,pTidDataBase->aTidExpectedSn);
+            TRACE1(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: i = %d",i);
+
+            /* Calculate the new Expected SN */
+            if (i == pTidDataBase->aTidWinSize)
+            {
+                TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: Set aTidExpectedSn to uNewWinStartSn");
+                pTidDataBase->aTidExpectedSn = uNewWinStartSn;
+            }
+            else
+            {
+                TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: Send all saved packets");
+                /* Incase the uWinStartDelta lower than aTidWinSize check if ther are packets stored in Array */
+                while (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL) {
+                    TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: Send packet with SN = 0x%x(%d)",pTidDataBase->aTidExpectedSn,pTidDataBase->aTidExpectedSn);
+                    RxQueue_PassPacket (pRxQueue, 
+                                            pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus,
+                                            pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket);
+    
+                    pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL;
+    
+                    pTidDataBase->aWinStartArrayInex++;
+    
+                    /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */
+                    pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK;
+    
+                    pTidDataBase->aTidExpectedSn++;
+                    pTidDataBase->aTidExpectedSn &= 0xFFF;
+                }
+            }
+
+            TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: aTidExpectedSn = 0x%x(%d)",pTidDataBase->aTidExpectedSn,pTidDataBase->aTidExpectedSn);
+
+            if(pTidDataBase->aTidExpectedSn == uFrameSn)
+            {
+                TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: Send current packet to uper layer");
+                /* pass the packet */
+                RxQueue_PassPacket (pRxQueue, tStatus, pBuffer);
+
+                pTidDataBase->aTidExpectedSn++;
+            }
+            else
+            {
+                uSaveInex = pTidDataBase->aWinStartArrayInex + (TI_UINT16)((uFrameSn + SEQ_NUM_WRAP - pTidDataBase->aTidExpectedSn) & SEQ_NUM_MASK);  
+
+                TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: Enter current packet to Reorder Queue");
+                TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: uSaveInex = 0x%x(%d)",uSaveInex,uSaveInex);
+
+            /* uSaveInex % RX_QUEUE_ARRAY_SIZE */
+            uSaveInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; 
+
+            /* save the packet in the last entry of the queue */
+            pTidDataBase->aPaketsQueue[uSaveInex].tStatus = tStatus;
+            pTidDataBase->aPaketsQueue[uSaveInex].pPacket = (void *)pBuffer;
+               pTidDataBase->aPaketsQueue[uSaveInex].pPacket = (void *)pBuffer;
+            }
+
+            /* aTidExpectedSn % 0xfff in order to tack care of wrap around */
+            pTidDataBase->aTidExpectedSn &= 0xfff; 
+
+            return;
+        }
+    }
+
+
+    /* 
+     * BA event ? 
+     */
+    if (pRxParams->packet_class_tag == TAG_CLASS_BA_EVENT)
+    {
+        TRxQueueTidDataBase *pTidDataBase;
+        TI_UINT8            *pDataFrameBody;
+        TI_UINT16           ufc;
+        TI_UINT8            uFrameTid;
+        TI_UINT16           uStartingSequenceNumber;
+        TI_UINT16           uWinStartDelta;
+        TI_UINT16           uBarControlField;
+        TI_UINT16           uBaStartingSequenceControlField;
+        TI_UINT16           uBAParameterField;         
+        TI_UINT32           i;
+
+        /* Get sub type from frame */
+        COPY_WLAN_WORD(&ufc, &pHdr->fc); /* copy with endianess handling. */
+
+        /* get the type to BA event */
+        switch ((dot11_Fc_Sub_Type_e)(ufc & DOT11_FC_SUB_MASK))
+        {
+        case DOT11_FC_SUB_BAR:
+            TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION , "RxQueue_ReceivePacket: BA event - BAR frame.\n");
+
+            /* get pointer to the frame body */
+            pDataFrameBody = pFrame + sizeof(dot11_BarFrameHeader_t);
+
+            /* Get TID from BAR frame */
+            COPY_WLAN_WORD (&uBarControlField, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */
+            uFrameTid = (uBarControlField & DOT11_BAR_CONTROL_FIELD_TID_BITS) >> 12;
+
+            /* TID illegal value ? */
+            if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS)
+            {
+                TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - BAR frame with TID value too big, TID = %d.\n",uFrameTid);
+
+                RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+                return;
+            }
+
+            /* set the SA Tid pointer */
+            pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]);
+
+            /* TID legal value */
+            /* packet TID BA not established ? */ 
+            if (pTidDataBase->aTidBaEstablished != TI_TRUE)
+            {
+                TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - BAR frame for TID not established, TID = %d.\n",uFrameTid);
+
+                RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+                return;
+            }
+
+            /* Get Starting Sequence number from BAR frame */
+            pDataFrameBody = pDataFrameBody + 2;
+            COPY_WLAN_WORD (&uBaStartingSequenceControlField, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */
+            uStartingSequenceNumber = (uBaStartingSequenceControlField & DOT11_SC_SEQ_NUM_MASK) >> 4;
+
+            /* Starting Sequence Number is higher then winStart ? */
+            if ( A_GREATER_THAN_B (uStartingSequenceNumber, pTidDataBase->aTidExpectedSn) )
+            {
+                uWinStartDelta = uStartingSequenceNumber - pTidDataBase->aTidExpectedSn;
+
+                /* pass all saved queue packets with SN lower then the new win start */
+                for (i = 0;
+                     ((i < uWinStartDelta) || (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL)) &&
+                      (i < RX_QUEUE_ARRAY_SIZE) && 
+                      (i < RX_QUEUE_WIN_SIZE);
+                     i++)
+                {
+                    if (pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket != NULL)
+                    {
+                        RxQueue_PassPacket (pRxQueue, 
+                                            pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].tStatus,
+                                            pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket);
+
+                        pTidDataBase->aPaketsQueue[pTidDataBase->aWinStartArrayInex].pPacket = NULL;
+                    }
+
+                    pTidDataBase->aWinStartArrayInex++;
+
+                    /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */
+                    pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK;
+                }
+
+                pTidDataBase->aTidExpectedSn = uStartingSequenceNumber;
+            }
+            break;
+
+
+        case DOT11_FC_SUB_ACTION:
+            /* get pointer to the frame body */
+            pDataFrameBody = pFrame + sizeof(dot11_mgmtHeader_t);
+
+            /* get Action field from BA action frame */
+            pDataFrameBody++;
+            switch(*pDataFrameBody)
+            {
+            case DOT11_BA_ACTION_ADDBA:
+
+                TRACE0( pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: BA event - ADDBA frame.\n");
+
+                /* get TID field and winSize from ADDBA action frame */
+                pDataFrameBody = pDataFrameBody + 2;
+                COPY_WLAN_WORD(&uBAParameterField, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */
+                uFrameTid = (uBAParameterField & DOT11_BA_PARAMETER_SET_FIELD_TID_BITS) >> 2;
+
+                /* TID illegal value ? */
+                if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS)
+                {
+                    TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - ADDBA frame with TID value too big, TID = %d.\n",uFrameTid);
+
+                    RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+                    return;
+                }
+
+                /*set the SA Tid pointer */
+                pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]);
+
+                /* TID legal value */
+                /* packet TID BA established ? */ 
+                if (pTidDataBase->aTidBaEstablished == TI_TRUE)
+                {
+                    TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - ADDBA frame for TID already established, TID = %d.\n",uFrameTid);
+
+                    RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+                    return;
+                }
+
+                /* get winSize from ADDBA action frame */
+                pTidDataBase->aTidWinSize = (uBAParameterField & DOT11_BA_PARAMETER_SET_FIELD_WINSIZE_BITS) >> 6; 
+
+                /* winSize illegal value ? */ 
+                if (pTidDataBase->aTidWinSize > RX_QUEUE_WIN_SIZE)
+                {
+                    /* In case the win Size is higher then 8 the driver and the FW set it to 8 and inform the AP in ADDBA respond */
+                    pTidDataBase->aTidWinSize = RX_QUEUE_WIN_SIZE;
+                }
+
+                /* packet TID BA not yet established and winSize legal */
+                /* establishe BA TID */
+                pTidDataBase->aTidBaEstablished = TI_TRUE;
+
+                /* get initial sequence number (ISN) from ADDBA action frame */
+                pDataFrameBody = pDataFrameBody + 4;
+                COPY_WLAN_WORD (&uStartingSequenceNumber, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */
+                pTidDataBase->aTidExpectedSn = (uStartingSequenceNumber & DOT11_SC_SEQ_NUM_MASK) >> 4;
+                pTidDataBase->aWinStartArrayInex = 0;
+                os_memoryZero (pRxQueue->hOs, pTidDataBase->aPaketsQueue, sizeof (TRxQueuePacketEntry) * RX_QUEUE_ARRAY_SIZE);
+                break;
+
+            case DOT11_BA_ACTION_DELBA:
+
+                TRACE0( pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: BA event - DELBA frame.\n");
+
+                /* get TID field and winSize from ADDBA action frame */
+                pDataFrameBody = pDataFrameBody + 2;
+                COPY_WLAN_WORD(&uBAParameterField, (TI_UINT16 *)pDataFrameBody); /* copy with endianess handling. */
+                uFrameTid = (uBAParameterField & DOT11_DELBA_PARAMETER_FIELD_TID_BITS) >> 12;
+
+                /* TID illegal value ? */
+                if (uFrameTid >= MAX_NUM_OF_802_1d_TAGS)
+                {
+                    TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - DELBA frame with TID value too big, TID = %d.\n",uFrameTid);
+
+                    RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+                    return;
+                }
+
+                /*set the SA Tid pointer */
+                pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[uFrameTid]);
+
+                /* TID legal value */
+                /* packet TID BA not established ? */ 
+                if (pTidDataBase->aTidBaEstablished != TI_TRUE)
+                {
+                    TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event - DELBA frame for TID not established, TID = %d.\n",uFrameTid);
+
+                    RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+                    return;
+                }
+
+                RxQueue_CloseBaSession(hRxQueue, uFrameTid);
+                break;
+
+            default:
+                TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event Action field from BA action frame illegal. action = 0x%x\n",*pDataFrameBody);
+
+                RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+                return;
+            }
+            break;
+
+        default:
+            TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR , "RxQueue_ReceivePacket: BA event with Subtype illegal. Subtype = 0x%x\n",((ufc & DOT11_FC_SUB_MASK) >> 4));
+
+            RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer);
+
+            return;
+        }
+    }
+
+    TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: unknow type tag. tag = %d\n", pRxParams->packet_class_tag);
+
+    RxQueue_PassPacket (pRxQueue, tStatus, pBuffer);
+
+    return;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Data_Service/txCtrlBlk.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,284 @@
+/*
+ * txCtrlBlk.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  txCtrlBlk.c
+ *   
+ *   PURPOSE: Maintains active packets Tx attributes table (including descriptor). 
+ * 
+ *	 DESCRIPTION:  
+ *   ============
+ *		This module allocates and frees table entry for each packet in the Tx
+ *		process (from sendPkt by upper driver until Tx-complete).
+ *
+ ****************************************************************************/
+#define __FILE_ID__  FILE_ID_99
+#include "osApi.h"
+#include "tidef.h"
+#include "report.h"
+#include "context.h"
+#include "TWDriver.h"
+#include "txCtrlBlk_api.h"
+
+
+/* The TxCtrlBlk module object - contains the control-block table. */
+typedef struct
+{
+	TI_HANDLE   hOs;
+	TI_HANDLE   hReport;
+	TI_HANDLE   hContext;
+
+	TTxCtrlBlk  aTxCtrlBlkTbl[CTRL_BLK_ENTRIES_NUM]; /* The table of control-block entries. */
+
+#ifdef TI_DBG  /* Just for debug. */
+	TI_UINT32	uNumUsedEntries;  
+#endif
+
+} TTxCtrlBlkObj;
+
+
+/****************************************************************************
+ *                      txCtrlBlk_Create()
+ ****************************************************************************
+ * DESCRIPTION:	Create the Tx control block table object 
+ * 
+ * INPUTS:	hOs
+ * 
+ * OUTPUT:	None
+ * 
+ * RETURNS:	The Created object
+ ****************************************************************************/
+TI_HANDLE txCtrlBlk_Create (TI_HANDLE hOs)
+{
+	TTxCtrlBlkObj *pTxCtrlBlk;
+
+	pTxCtrlBlk = os_memoryAlloc (hOs, sizeof(TTxCtrlBlkObj),MemoryNormal);
+	if (pTxCtrlBlk == NULL)
+		return NULL;
+
+	os_memoryZero (hOs, pTxCtrlBlk, sizeof(TTxCtrlBlkObj));
+
+	pTxCtrlBlk->hOs = hOs;
+
+	return( (TI_HANDLE)pTxCtrlBlk );
+}
+
+
+/****************************************************************************
+ *                      txCtrlBlk_Destroy()
+ ****************************************************************************
+ * DESCRIPTION:	Destroy the Tx control block table object 
+ * 
+ * INPUTS:	hTxCtrlBlk - The object to free
+ * 
+ * OUTPUT:	None
+ * 
+ * RETURNS:	TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS txCtrlBlk_Destroy (TI_HANDLE hTxCtrlBlk)
+{
+	TTxCtrlBlkObj *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk;
+
+	if (pTxCtrlBlk)
+		os_memoryFree(pTxCtrlBlk->hOs, pTxCtrlBlk, sizeof(TTxCtrlBlkObj));
+
+	return TI_OK;
+}
+
+
+/****************************************************************************
+ *               txCtrlBlk_Init()
+ ****************************************************************************
+   DESCRIPTION:	 Initialize the Tx control block module.
+ ****************************************************************************/
+TI_STATUS txCtrlBlk_Init (TI_HANDLE hTxCtrlBlk, TI_HANDLE hReport, TI_HANDLE hContext)
+{
+	TTxCtrlBlkObj *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk;
+	TI_UINT8 entry;
+	
+	pTxCtrlBlk->hReport  = hReport;
+	pTxCtrlBlk->hContext = hContext;
+	
+	/* For all entries, write the entry index in the descriptor and the next entry address
+		 in the next free entery pointer. Init also some other fields. */
+	for(entry = 0; entry < CTRL_BLK_ENTRIES_NUM; entry++)
+	{
+		pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.descID = entry;
+		pTxCtrlBlk->aTxCtrlBlkTbl[entry].pNextFreeEntry       = &(pTxCtrlBlk->aTxCtrlBlkTbl[entry + 1]);
+		pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.aid    = 1;  /* The value for infrastructure BSS */
+		pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.reserved  = 0;
+	}
+
+	/* Write null in the next-free index of the last entry. */
+	pTxCtrlBlk->aTxCtrlBlkTbl[CTRL_BLK_ENTRIES_NUM - 1].pNextFreeEntry = NULL;
+
+  #ifdef TI_DBG
+	pTxCtrlBlk->uNumUsedEntries = 0;
+  #endif
+
+	return TI_OK;
+}
+
+
+/****************************************************************************
+ *					txCtrlBlk_Alloc()
+ ****************************************************************************
+ * DESCRIPTION:	 
+	Allocate a free control-block entry for the current Tx packet's parameters
+	  (including the descriptor structure).
+	Note that entry 0 in the list is never allocated and points to the
+	  first free entry.
+ ****************************************************************************/
+TTxCtrlBlk *txCtrlBlk_Alloc (TI_HANDLE hTxCtrlBlk)
+{
+	TTxCtrlBlkObj   *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk;
+	TTxCtrlBlk      *pCurrentEntry; /* The pointer of the new entry allocated for the packet. */
+	TTxCtrlBlk      *pFirstFreeEntry; /* The first entry just points to the first free entry. */ 
+
+	pFirstFreeEntry = &(pTxCtrlBlk->aTxCtrlBlkTbl[0]); 
+
+    /* Protect block allocation from preemption (may be called from external context) */
+    CONTEXT_ENTER_CRITICAL_SECTION (pTxCtrlBlk->hContext);
+
+    pCurrentEntry = pFirstFreeEntry->pNextFreeEntry; /* Get free entry. */
+
+#ifdef TI_DBG
+	/* If no free entries, print error (not expected to happen) and return NULL. */
+	if (pCurrentEntry->pNextFreeEntry == NULL)
+	{
+TRACE1(pTxCtrlBlk->hReport, REPORT_SEVERITY_ERROR, "txCtrlBlk_alloc():  No free entry,  UsedEntries=%d\n", pTxCtrlBlk->uNumUsedEntries);
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTxCtrlBlk->hContext);
+		return NULL;
+	}
+	pTxCtrlBlk->uNumUsedEntries++;
+#endif
+
+	/* Link the first entry to the next free entry. */
+	pFirstFreeEntry->pNextFreeEntry = pCurrentEntry->pNextFreeEntry;
+
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTxCtrlBlk->hContext);
+	
+	/* Clear the next-free-entry index just as an indication that our entry is not free. */
+	pCurrentEntry->pNextFreeEntry = 0;
+
+    pCurrentEntry->tTxPktParams.uFlags = 0;
+    pCurrentEntry->tTxPktParams.uHeadroomSize = 0;
+
+	return pCurrentEntry;
+}
+
+
+/****************************************************************************
+ *					txCtrlBlk_Free()
+ ****************************************************************************
+ * DESCRIPTION:	
+	Link the freed entry after entry 0, so now it is the first free entry to
+	  be allocated.
+ ****************************************************************************/
+void txCtrlBlk_Free (TI_HANDLE hTxCtrlBlk, TTxCtrlBlk *pCurrentEntry)
+{
+	TTxCtrlBlkObj   *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk;
+	TTxCtrlBlk *pFirstFreeEntry = &(pTxCtrlBlk->aTxCtrlBlkTbl[0]);
+
+#ifdef TI_DBG
+	/* If the pointed entry is already free, print error and exit (not expected to happen). */
+	if (pCurrentEntry->pNextFreeEntry != 0)
+	{
+TRACE2(pTxCtrlBlk->hReport, REPORT_SEVERITY_ERROR, "txCtrlBlk_free(): Entry %d alredy free, UsedEntries=%d\n", 			pCurrentEntry->tTxDescriptor.descID, pTxCtrlBlk->uNumUsedEntries);
+		return;
+	}
+	pTxCtrlBlk->uNumUsedEntries--;
+#endif
+
+    /* Protect block freeing from preemption (may be called from external context) */
+    CONTEXT_ENTER_CRITICAL_SECTION (pTxCtrlBlk->hContext);
+
+	/* Link the freed entry between entry 0 and the next free entry. */
+	pCurrentEntry->pNextFreeEntry   = pFirstFreeEntry->pNextFreeEntry;
+	pFirstFreeEntry->pNextFreeEntry = pCurrentEntry;
+
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTxCtrlBlk->hContext);
+}
+
+
+/****************************************************************************
+ *					txCtrlBlk_GetPointer()
+ ****************************************************************************
+ * DESCRIPTION:	 
+	Return a pointer to the control block entry of the requested packet.
+	Used upon tx-complete to retrieve info after getting the descId from the FW.
+ ****************************************************************************/
+TTxCtrlBlk *txCtrlBlk_GetPointer (TI_HANDLE hTxCtrlBlk, TI_UINT8 descId)
+{
+	TTxCtrlBlkObj *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk;
+	return ( &(pTxCtrlBlk->aTxCtrlBlkTbl[descId]) );
+}
+
+
+/****************************************************************************
+ *                      txCtrlBlk_PrintTable()
+ ****************************************************************************
+ * DESCRIPTION:	 Print the txCtrlBlk table main fields.
+ ****************************************************************************/
+#ifdef TI_DBG
+void txCtrlBlk_PrintTable (TI_HANDLE hTxCtrlBlk)
+{
+	TTxCtrlBlkObj *pTxCtrlBlk = (TTxCtrlBlkObj *)hTxCtrlBlk;
+	TI_UINT8 entry;
+
+	WLAN_OS_REPORT((" Tx-Control-Block Information,  UsedEntries=%d\n", pTxCtrlBlk->uNumUsedEntries));
+	WLAN_OS_REPORT(("==============================================\n"));
+	
+	for(entry = 0; entry < CTRL_BLK_ENTRIES_NUM; entry++)
+	{
+		WLAN_OS_REPORT(("Entry %d: DescID=%d, Next=0x%x, Len=%d, StartTime=%d, TID=%d, ExtraBlks=%d, TotalBlks=%d, Flags=0x%x\n", 
+			entry, 
+			pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.descID,
+			pTxCtrlBlk->aTxCtrlBlkTbl[entry].pNextFreeEntry,
+			ENDIAN_HANDLE_WORD(pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.length),
+			ENDIAN_HANDLE_LONG(pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.startTime),
+            pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.tid,
+			pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.extraMemBlks,
+            pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxDescriptor.totalMemBlks,
+            pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxPktParams.uFlags));
+	}
+}
+#endif /* TI_DBG */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/Data_Service/txHwQueue.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,716 @@
+/*
+ * txHwQueue.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  txHwQueue.c
+ *   
+ *   PURPOSE: manage the wlan hardware Tx memory blocks allocation per queue. 
+ * 
+ *   DESCRIPTION:  
+ *   ============
+ *      This module is responsible for the HW Tx data-blocks and descriptors allocation.
+ *      The HW Tx blocks are allocated in the driver by rough calculations without 
+ *        accessing the FW. 
+ *      They are freed according to FW counters that are provided by the FwEvent module
+ *          on every FW interrupt.
+ ****************************************************************************/
+#define __FILE_ID__  FILE_ID_100
+#include "osApi.h"
+#include "report.h"
+#include "TWDriver.h"
+#include "txCtrlBlk_api.h"
+#include "txHwQueue_api.h"
+
+
+/* Translate input TID to AC */            
+/* Note: This structure is shared with other modules */
+const EAcTrfcType WMEQosTagToACTable[MAX_NUM_OF_802_1d_TAGS] = 
+	{QOS_AC_BE, QOS_AC_BK, QOS_AC_BK, QOS_AC_BE, QOS_AC_VI, QOS_AC_VI, QOS_AC_VO, QOS_AC_VO};
+
+/* 
+ *  Local definitions:
+ */
+
+/* Spare blocks written in extraMemBlks field in TxDescriptor for HW use */
+#define BLKS_HW_ALLOC_SPARE             3
+
+/* Set queue's backpressure bit (indicates queue state changed from ready to busy or inversely). */
+#define SET_QUEUE_BACKPRESSURE(pBackpressure, uQueueId)   (*pBackpressure |= (1 << uQueueId)) 
+
+/* Callback function definition for UpdateBusyMap */
+typedef void (* tUpdateBusyMapCb)(TI_HANDLE hCbHndl, TI_UINT32 uBackpressure);
+
+/* Per Queue HW blocks accounting data: */
+typedef struct
+{
+    TI_UINT32  uNumBlksThresh;          /* Minimum HW blocks that must be reserved for this Queue. */
+    TI_UINT32  uNumBlksUsed;            /* Number of HW blocks that are currently allocated for this Queue. */
+    TI_UINT32  uNumBlksReserved;        /* Number of HW blocks currently reserved for this Queue (to guarentee the low threshold). */
+    TI_UINT32  uAllocatedBlksCntr;      /* Accumulates allocated blocks for FW freed-blocks counter coordination. */ 
+    TI_UINT32  uFwFreedBlksCntr;        /* Accumulated freed blocks in FW. */ 
+    TI_UINT32  uNumBlksCausedBusy;      /* Number of HW blocks that caused queue busy state. */
+    TI_BOOL    bQueueBusy;              /* If TI_TRUE, this queue is currently stopped. */
+    TI_UINT16  uPercentOfBlkLowThresh;  /* Configured percentage of blocks to use as the queue's low allocation threshold */
+    TI_UINT16  uPercentOfBlkHighThresh; /* Configured percentage of blocks to use as the queue's high allocation threshold */
+
+} TTxHwQueueInfo; 
+
+typedef struct
+{
+    TI_HANDLE  hOs;
+    TI_HANDLE  hReport;
+    
+    tUpdateBusyMapCb fUpdateBusyMapCb;  /* The upper layers UpdateBusyMap callback */
+    TI_HANDLE        hUpdateBusyMapHndl;/* The handle for the fUpdateBusyMapCb */
+
+    TI_UINT32  uNumTotalBlks;           /* The total number of Tx blocks        */
+    TI_UINT32  uNumTotalBlksFree;       /* Total number of free HW blocks       */    
+    TI_UINT32  uNumTotalBlksReserved;   /* Total number of free but reserved HW blocks */
+    TI_UINT32  uNumUsedDescriptors;     /* Total number of packets in the FW. */
+    TI_UINT8   uFwTxResultsCntr;        /* Accumulated freed descriptors in FW. */
+    TI_UINT8   uDrvTxPacketsCntr;       /* Accumulated allocated descriptors in driver. */
+    
+    TTxHwQueueInfo  aTxHwQueueInfo[MAX_NUM_OF_AC]; /* The per queue variables */
+
+} TTxHwQueue;
+
+
+static void      txHwQueue_UpdateFreeBlocks (TTxHwQueue *pTxHwQueue, TI_UINT32 uQueueId, TI_UINT32 uFreeBlocks);
+static TI_UINT32 txHwQueue_CheckResources (TTxHwQueue *pTxHwQueue, TTxHwQueueInfo *pQueueInfo);
+
+
+
+/****************************************************************************
+ *                      txHwQueue_Create()
+ ****************************************************************************
+ * DESCRIPTION: Create the Tx buffers pool object 
+ * 
+ * INPUTS:  None
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: The Created object
+ ****************************************************************************/
+TI_HANDLE txHwQueue_Create (TI_HANDLE hOs)
+{
+    TTxHwQueue *pTxHwQueue;
+
+    pTxHwQueue = os_memoryAlloc(hOs, sizeof(TTxHwQueue),MemoryNormal);
+    if (pTxHwQueue == NULL)
+    {
+        return NULL;
+    }
+
+    os_memoryZero(hOs, pTxHwQueue, sizeof(TTxHwQueue));
+
+    pTxHwQueue->hOs = hOs;
+
+    return (TI_HANDLE)pTxHwQueue;
+}
+
+/****************************************************************************
+ *                      txHwQueue_Destroy()
+ ****************************************************************************
+ * DESCRIPTION: Destroy the Tx buffers pool object 
+ * 
+ * INPUTS:  hTxHwQueue - The object to free
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS txHwQueue_Destroy (TI_HANDLE hTxHwQueue)
+{
+    TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+
+    if (pTxHwQueue)
+    {
+        os_memoryFree(pTxHwQueue->hOs, pTxHwQueue, sizeof(TTxHwQueue));
+    }
+    return TI_OK;
+}
+
+
+
+
+/****************************************************************************
+ *               txHwQueue_Init()
+ ****************************************************************************
+
+  DESCRIPTION:  Initialize module handles.
+
+ ****************************************************************************/
+TI_STATUS txHwQueue_Init (TI_HANDLE hTxHwQueue, TI_HANDLE hReport)
+{
+    TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+    
+    pTxHwQueue->hReport = hReport;
+
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *                      txHwQueue_Config()
+ ****************************************************************************
+ * DESCRIPTION: Configure the Tx buffers pool object 
+ * 
+ * INPUTS:  None
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+TI_STATUS txHwQueue_Config (TI_HANDLE hTxHwQueue, TTwdInitParams *pInitParams)
+{
+    TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+    TI_UINT32   TxQid;
+    
+    /* Configure queue parameters to Tx-HW queue module */
+    for (TxQid = 0; TxQid < MAX_NUM_OF_AC; TxQid++)
+    {
+        pTxHwQueue->aTxHwQueueInfo[TxQid].uNumBlksThresh = pInitParams->tGeneral.TxBlocksThresholdPerAc[TxQid];
+    }
+    
+    return TI_OK;
+}
+
+
+
+/****************************************************************************
+ *                  txHwQueue_SetHwInfo()
+ ****************************************************************************
+
+  DESCRIPTION:  
+  
+    Called after the HW configuration in the driver init or recovery process.
+    Configure Tx HW information, including Tx-HW-blocks number, and per queue
+      Tx-descriptors number. Than, restart the module variables.
+
+    Two thresholds are defined per queue:
+    a)  TxBlocksLowPercentPerQueue[queue] - The lower threshold is the minimal number of 
+        Tx blocks guaranteed for each queue.
+        The sum of all low thresholds should be less than 100%.
+    b)  TxBlocksHighPercentPerQueue[queue] - The higher threshold is the maximal number of
+        Tx blocks that may be allocated to the queue.
+        The extra blocks above the low threshold can be allocated when needed only 
+        if they are currently available and are not needed in order to guarantee
+        the other queues low threshold.
+        The sum of all high thresholds should be more than 100%.
+ ****************************************************************************/
+TI_STATUS txHwQueue_SetHwInfo (TI_HANDLE hTxHwQueue, TDmaParams *pDmaParams) 
+{
+    TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+    
+    pTxHwQueue->uNumTotalBlks = pDmaParams->NumTxBlocks - 1; /* One block must be always free for FW use. */
+    
+    /* Restart the module variables. */
+    txHwQueue_Restart (hTxHwQueue);
+
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *               txHwQueue_Restart()
+ ****************************************************************************
+   DESCRIPTION:  
+   ============
+     Called after the HW configuration in the driver init or recovery process.
+     Restarts the Tx-HW-Queue module.
+ ****************************************************************************/
+TI_STATUS txHwQueue_Restart (TI_HANDLE hTxHwQueue)
+{
+    TTxHwQueue     *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+    TTxHwQueueInfo *pQueueInfo;
+    TI_UINT32       TxQid;
+    
+
+    /* 
+     * All blocks are free at restart.
+     * Note that free means all blocks that are currently not in use, while reserved are 
+     *   a part of the free blocks that are the summary of all queues reserved blocks.
+     * Each queue may take from the reserved part only up to its own reservation (according to
+     *   its low threshold). 
+     */
+    pTxHwQueue->uNumTotalBlksFree = pTxHwQueue->uNumTotalBlks;
+    pTxHwQueue->uNumTotalBlksReserved = 0;
+    pTxHwQueue->uNumUsedDescriptors = 0;
+    pTxHwQueue->uFwTxResultsCntr = 0;
+    pTxHwQueue->uDrvTxPacketsCntr = 0;
+
+    for (TxQid = 0; TxQid < MAX_NUM_OF_AC; TxQid++)
+    {
+        pQueueInfo = &pTxHwQueue->aTxHwQueueInfo[TxQid];
+
+        pQueueInfo->uNumBlksUsed = 0;
+        pQueueInfo->uAllocatedBlksCntr = 0; 
+        pQueueInfo->uFwFreedBlksCntr = 0;
+        pQueueInfo->uNumBlksCausedBusy = 0;
+        pQueueInfo->bQueueBusy = TI_FALSE;
+
+        /* Since no blocks are used yet, reserved blocks number equals to the low threshold. */
+        pQueueInfo->uNumBlksReserved = pQueueInfo->uNumBlksThresh;
+
+        /* Accumulate total reserved blocks. */
+        pTxHwQueue->uNumTotalBlksReserved += pQueueInfo->uNumBlksReserved;
+    }
+
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *                  txHwQueue_AllocResources()
+ ****************************************************************************
+ * DESCRIPTION: 
+   ============
+    1.  Estimate required HW-blocks number.
+    2.  If the required blocks are not available or no free descriptor, 
+            return  STOP_CURRENT  (to stop current queue and requeue the packet).
+    3.  Resources are available so update allocated blocks and descriptors counters.
+    4.  If no resources for another similar packet, return STOP_NEXT (to stop current queue).
+        Else, return SUCCESS
+ ****************************************************************************/
+ETxHwQueStatus txHwQueue_AllocResources (TI_HANDLE hTxHwQueue, TTxCtrlBlk *pTxCtrlBlk)
+{
+    TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+    TI_UINT32 uNumBlksToAlloc; /* The number of blocks required for the current packet. */
+    TI_UINT32 uExcludedLength; /* The data length not included in the rough blocks calculation */
+    TI_UINT32 uAvailableBlks; /* Max blocks that are currently available for this queue. */
+    TI_UINT32 uReservedBlks; /* How many blocks are reserved for this queue before this allocation. */
+    TI_UINT32 uQueueId = WMEQosTagToACTable[pTxCtrlBlk->tTxDescriptor.tid];
+    TTxHwQueueInfo *pQueueInfo = &(pTxHwQueue->aTxHwQueueInfo[uQueueId]);
+
+
+    /***********************************************************************/
+    /*  Calculate packet required HW blocks.                               */
+    /***********************************************************************/
+
+    /* Divide length by 256 instead of 252 (block size) to save CPU */
+    uNumBlksToAlloc = pTxCtrlBlk->tTxDescriptor.length >> 8;
+
+    /* The length not yet included in the uNumBlksToAlloc is the sum of:
+        1) 4 bytes per block as a result of using 256 instead of 252 block size.
+        2) The remainder of the division by 256. 
+        3) Overhead due to header translation, security and LLC header (subtracting ethernet header).
+    */
+    uExcludedLength = (uNumBlksToAlloc << 2) + (pTxCtrlBlk->tTxDescriptor.length & 0xFF) + MAX_HEADER_SIZE - 14;
+
+    /* Add 1 or 2 blocks for the excluded length, according to its size */
+    uNumBlksToAlloc += (uExcludedLength > 252) ? 2 : 1;
+
+    /* Add extra blocks needed in case of fragmentation */
+    uNumBlksToAlloc += BLKS_HW_ALLOC_SPARE;
+
+    /***********************************************************************/
+    /*            Check if the required resources are available            */
+    /***********************************************************************/
+
+    /* Find max available blocks for this queue (0 could indicate no descriptors). */
+    uAvailableBlks = txHwQueue_CheckResources (pTxHwQueue, pQueueInfo);
+    
+    /* If we need more blocks than available, return  STOP_CURRENT (stop current queue and requeue packet). */
+    if (uNumBlksToAlloc > uAvailableBlks)
+    {
+        TRACE6(pTxHwQueue->hReport, REPORT_SEVERITY_INFORMATION, ": No resources, Queue=%d, ReqBlks=%d, FreeBlks=%d, UsedBlks=%d, AvailBlks=%d, UsedPkts=%d\n", uQueueId, uNumBlksToAlloc, pTxHwQueue->uNumTotalBlksFree, pQueueInfo->uNumBlksUsed, uAvailableBlks, pTxHwQueue->uNumUsedDescriptors);
+        pQueueInfo->uNumBlksCausedBusy = uNumBlksToAlloc;
+        pQueueInfo->bQueueBusy = TI_TRUE;
+
+        return TX_HW_QUE_STATUS_STOP_CURRENT;  /**** Exit! (we should stop queue and requeue packet) ****/
+    }
+
+    /***********************************************************************/
+    /*                    Allocate required resources                      */
+    /***********************************************************************/
+
+    /* Update blocks numbers in Tx descriptor */
+    pTxCtrlBlk->tTxDescriptor.extraMemBlks = BLKS_HW_ALLOC_SPARE;
+    pTxCtrlBlk->tTxDescriptor.totalMemBlks = uNumBlksToAlloc;
+
+    /* Update packet allocation info:  */
+    pTxHwQueue->uNumUsedDescriptors++; /* Update number of packets in FW (for descriptors allocation check). */
+    pTxHwQueue->uDrvTxPacketsCntr++;
+    pQueueInfo->uAllocatedBlksCntr += uNumBlksToAlloc; /* For FW counter coordination. */
+    uReservedBlks = pQueueInfo->uNumBlksReserved;
+
+    /* If we are currently using less than the low threshold (i.e. we have some reserved blocks), 
+        blocks allocation should reduce the reserved blocks number as follows:
+    */
+    if (uReservedBlks)
+    {
+
+        /* If adding the allocated blocks to the used blocks will pass the low-threshold,
+            only the part up to the low-threshold is subtracted from the reserved blocks.
+            This is because blocks are reserved for the Queue only up to its low-threshold. 
+            
+              0   old used                    low      new used       high
+              |######|                         |          |            |
+              |######|                         |          |            |
+                      <------------ allocated ----------->
+                      <----- old reserved ---->
+                             new reserved = 0     (we passed the low threshold)
+        */
+        if (uNumBlksToAlloc > uReservedBlks)
+        {
+            pQueueInfo->uNumBlksReserved = 0;
+            pTxHwQueue->uNumTotalBlksReserved -= uReservedBlks; /* reduce change from total reserved.*/
+        }
+
+
+        /* Else, if allocating less than reserved,
+            the allocated blocks are subtracted from the reserved blocks:
+            
+              0   old used       new used               low      high
+              |######|               |                   |        |
+              |######|               |                   |        |
+                      <- allocated ->
+                      <--------- old reserved ---------->
+                                     <-- new reserved -->
+        */
+        else
+        {
+            pQueueInfo->uNumBlksReserved -= uNumBlksToAlloc;
+            pTxHwQueue->uNumTotalBlksReserved -= uNumBlksToAlloc; /* reduce change from total reserved.*/
+        }
+    }
+
+
+    /* Update total free blocks and Queue used blocks with the allocated blocks number. */
+    pTxHwQueue->uNumTotalBlksFree -= uNumBlksToAlloc;
+    pQueueInfo->uNumBlksUsed += uNumBlksToAlloc;
+
+    TRACE6(pTxHwQueue->hReport, REPORT_SEVERITY_INFORMATION, ": SUCCESS,  Queue=%d, Req-blks=%d , Free=%d, Used=%d, Reserved=%d, Accumulated=%d\n", uQueueId, uNumBlksToAlloc, pTxHwQueue->uNumTotalBlksFree, pQueueInfo->uNumBlksUsed, pQueueInfo->uNumBlksReserved, pQueueInfo->uAllocatedBlksCntr);
+
+    /* If no resources for another similar packet, return STOP_NEXT (to stop current queue). */
+    /* Note: Current packet transmission is continued */
+    if ( (uNumBlksToAlloc << 1) > uAvailableBlks )
+    {
+        TRACE6(pTxHwQueue->hReport, REPORT_SEVERITY_INFORMATION, ": No resources for next pkt, Queue=%d, ReqBlks=%d, FreeBlks=%d, UsedBlks=%d, AvailBlks=%d, UsedPkts=%d\n", uQueueId, uNumBlksToAlloc, pTxHwQueue->uNumTotalBlksFree, pQueueInfo->uNumBlksUsed, uAvailableBlks, pTxHwQueue->uNumUsedDescriptors);
+        pQueueInfo->uNumBlksCausedBusy = uNumBlksToAlloc;
+        pQueueInfo->bQueueBusy = TI_TRUE;
+        return TX_HW_QUE_STATUS_STOP_NEXT;
+    }
+
+    /* Return SUCCESS (resources are available). */
+    return TX_HW_QUE_STATUS_SUCCESS;
+}
+
+
+/****************************************************************************
+ *                  txHwQueue_UpdateFreeBlocks()
+ ****************************************************************************
+ * DESCRIPTION: 
+   ===========
+    This function is called per queue after reading the freed blocks counters from the FwStatus.
+    It updates the queue's blocks status according to the freed blocks.
+ ****************************************************************************/
+static void txHwQueue_UpdateFreeBlocks (TTxHwQueue *pTxHwQueue, TI_UINT32 uQueueId, TI_UINT32 uFreeBlocks)
+{
+    TTxHwQueueInfo *pQueueInfo = &(pTxHwQueue->aTxHwQueueInfo[uQueueId]);
+    TI_UINT32 lowThreshold;  /* Minimum blocks that are guaranteed for this Queue. */
+    TI_UINT32 newUsedBlks;   /* Blocks that are used by this Queue after updating free blocks. */
+    TI_UINT32 newReserved;   /* How many blocks are reserved to this Queue after freeing. */
+    TI_UINT32 numBlksToFree; /* The number of blocks freed in the current queue. */
+
+    /* If the FW free blocks counter didn't change, exit */
+    uFreeBlocks = ENDIAN_HANDLE_LONG(uFreeBlocks);
+    if (uFreeBlocks == pQueueInfo->uFwFreedBlksCntr) 
+    {
+        return;
+    }
+
+    pQueueInfo->uFwFreedBlksCntr = uFreeBlocks;
+
+    /* The uFreeBlocks is the accumulated number of blocks freed by the FW for the uQueueId.
+     * Subtracting it from the accumulated number of blocks allocated by the driver should
+     *   give the current number of used blocks in this queue.
+     * Since the difference is always a small positive number, a simple subtraction should work
+     *   also for wrap around.
+     */
+    newUsedBlks = pQueueInfo->uAllocatedBlksCntr - uFreeBlocks;
+
+    numBlksToFree = pQueueInfo->uNumBlksUsed - newUsedBlks;
+
+#ifdef TI_DBG   /* Sanity check: make sure we don't free more than is allocated. */
+    if (numBlksToFree > pQueueInfo->uNumBlksUsed)
+    {
+        TRACE5(pTxHwQueue->hReport, REPORT_SEVERITY_ERROR, ":  Try to free more blks than used: Queue %d, ToFree %d, Used %d, HostAlloc=0x%x, FwFree=0x%x\n", uQueueId, numBlksToFree, pQueueInfo->uNumBlksUsed, pQueueInfo->uAllocatedBlksCntr, uFreeBlocks);
+    }
+#endif
+
+    /* Update total free blocks and Queue used blocks with the freed blocks number. */
+    pTxHwQueue->uNumTotalBlksFree += numBlksToFree;
+    pQueueInfo->uNumBlksUsed = newUsedBlks;
+
+    lowThreshold = pQueueInfo->uNumBlksThresh;
+    
+    /* If after freeing the blocks we are using less than the low threshold, 
+        update total reserved blocks number as follows:
+       (note: if we are above the low threshold after freeing the blocks we still have no reservation.)
+    */
+    if (newUsedBlks < lowThreshold)
+    {
+        newReserved = lowThreshold - newUsedBlks;
+        pQueueInfo->uNumBlksReserved = newReserved;
+
+        
+        /* If freeing the blocks reduces the used blocks from above to below the low-threshold,
+            only the part from the low-threshold to the new used number is added to the 
+            reserved blocks (because blocks are reserved for the Queue only up to its low-threshold):
+            
+              0        new used               low            old used         high
+              |###########|####################|################|             |
+              |###########|####################|################|             |
+                           <-------------- freed -------------->
+                           <-- new reserved -->
+                             old reserved = 0
+        */
+        if (numBlksToFree > newReserved)
+            pTxHwQueue->uNumTotalBlksReserved += newReserved; /* Add change to total reserved.*/
+
+
+        /* Else, if we were under the low-threshold before freeing these blocks,
+            all freed blocks are added to the reserved blocks: 
+            
+              0             new used          old used             low               high
+              |################|#################|                  |                  |
+              |################|#################|                  |                  |
+                                <---- freed ---->
+                                                  <- old reserved ->
+                                <---------- new reserved ---------->
+        */
+        else
+            pTxHwQueue->uNumTotalBlksReserved += numBlksToFree; /* Add change to total reserved.*/
+    }
+
+    TRACE5(pTxHwQueue->hReport, REPORT_SEVERITY_INFORMATION, ":  Queue %d, ToFree %d, Used %d, HostAlloc=0x%x, FwFree=0x%x\n", uQueueId, numBlksToFree, pQueueInfo->uNumBlksUsed, pQueueInfo->uAllocatedBlksCntr, uFreeBlocks);
+}
+
+
+/****************************************************************************
+ *                  txHwQueue_UpdateFreeResources()
+ ****************************************************************************
+ * DESCRIPTION: 
+   ===========
+   Called by FwEvent upon Data interrupt to update freed HW-Queue resources as follows:
+    1) For all queues, update blocks and descriptors numbers according to FwStatus information.
+    2) For each busy queue, if now available indicate it in the backpressure bitmap.
+ ****************************************************************************/
+void txHwQueue_UpdateFreeResources (TI_HANDLE hTxHwQueue, FwStatus_t *pFwStatus)
+{
+    TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+    TTxHwQueueInfo *pQueueInfo;
+    TI_UINT32 uQueueId;
+    TI_UINT32 uAvailableBlks; /* Max blocks available for current queue. */
+    TI_UINT32 uNewNumUsedDescriptors;
+    TI_UINT32 uBackpressure = 0;
+    TI_UINT32 *pFreeBlocks = (TI_UINT32 *)pFwStatus->txReleasedBlks;
+    TI_UINT32 uTempFwCounters;
+    FwStatCntrs_t *pFwStatusCounters;
+
+    /* 
+     * If TxResults counter changed in FwStatus, update descriptors number according to  information 
+     */
+    uTempFwCounters = (ENDIAN_HANDLE_LONG(pFwStatus->counters));
+    pFwStatusCounters = (FwStatCntrs_t *)&uTempFwCounters;
+    if (pFwStatusCounters->txResultsCntr != pTxHwQueue->uFwTxResultsCntr) 
+    {
+        pTxHwQueue->uFwTxResultsCntr = pFwStatusCounters->txResultsCntr; 
+
+        /* Calculate new number of used descriptors (the else is for wrap around case) */
+        if (pTxHwQueue->uFwTxResultsCntr <= pTxHwQueue->uDrvTxPacketsCntr) 
+        {
+            uNewNumUsedDescriptors = (TI_UINT32)(pTxHwQueue->uDrvTxPacketsCntr - pTxHwQueue->uFwTxResultsCntr);
+        }
+        else 
+        {
+            uNewNumUsedDescriptors = 0x100 - (TI_UINT32)(pTxHwQueue->uFwTxResultsCntr - pTxHwQueue->uDrvTxPacketsCntr);
+        }
+    
+#ifdef TI_DBG   /* Sanity check: make sure we don't free more descriptors than allocated. */
+        if (uNewNumUsedDescriptors >= pTxHwQueue->uNumUsedDescriptors)
+        {
+            TRACE2(pTxHwQueue->hReport, REPORT_SEVERITY_ERROR, ":  Used descriptors number should decrease: UsedDesc %d, NewUsedDesc %d\n", pTxHwQueue->uNumUsedDescriptors, uNewNumUsedDescriptors);
+        }
+#endif
+    
+        /* Update number of packets left in FW (for descriptors allocation check). */
+        pTxHwQueue->uNumUsedDescriptors = uNewNumUsedDescriptors;
+    }
+
+    /* 
+     * For all queues, update blocks numbers according to FwStatus information 
+     */
+    for (uQueueId = 0; uQueueId < MAX_NUM_OF_AC; uQueueId++)
+    {
+        pQueueInfo = &(pTxHwQueue->aTxHwQueueInfo[uQueueId]);
+
+        /* Update per queue number of used, free and reserved blocks. */
+        txHwQueue_UpdateFreeBlocks (pTxHwQueue, uQueueId, pFreeBlocks[uQueueId]);
+    }
+
+    /* 
+     * For each busy queue, if now available indicate it in the backpressure bitmap 
+     */
+    for (uQueueId = 0; uQueueId < MAX_NUM_OF_AC; uQueueId++)
+    {
+        pQueueInfo = &(pTxHwQueue->aTxHwQueueInfo[uQueueId]);
+
+        /* If the queue was stopped */
+        if (pQueueInfo->bQueueBusy) 
+        {
+            /* Find max available blocks for this queue (0 could indicate no descriptors). */
+            uAvailableBlks = txHwQueue_CheckResources (pTxHwQueue, pQueueInfo);
+
+            /* If the required blocks and a descriptor are available, 
+                 set the queue's backpressure bit to indicate NOT-busy! */
+            if (pQueueInfo->uNumBlksCausedBusy <= uAvailableBlks)
+            {
+                TRACE6(pTxHwQueue->hReport, REPORT_SEVERITY_INFORMATION, ": Queue Available, Queue=%d, ReqBlks=%d, FreeBlks=%d, UsedBlks=%d, AvailBlks=%d, UsedPkts=%d\n", uQueueId, pQueueInfo->uNumBlksCausedBusy, pTxHwQueue->uNumTotalBlksFree, pQueueInfo->uNumBlksUsed, uAvailableBlks, pTxHwQueue->uNumUsedDescriptors);
+                SET_QUEUE_BACKPRESSURE(&uBackpressure, uQueueId); /* Start queue. */
+                pQueueInfo->bQueueBusy = TI_FALSE;
+            }
+        }
+    }
+
+    /* If released queues map is not 0, send it to the upper layers (if CB available) */
+    if ((uBackpressure > 0) && (pTxHwQueue->fUpdateBusyMapCb != NULL))
+    {
+        pTxHwQueue->fUpdateBusyMapCb (pTxHwQueue->hUpdateBusyMapHndl, uBackpressure);
+    }
+}
+
+
+/****************************************************************************
+ *                  txHwQueue_CheckResources()
+ ****************************************************************************
+ * DESCRIPTION: 
+   ============
+    Return the given queue's available blocks.
+    If no descriptors available, return 0.
+ ****************************************************************************/
+static TI_UINT32 txHwQueue_CheckResources (TTxHwQueue *pTxHwQueue, TTxHwQueueInfo *pQueueInfo)
+{
+    /* If descriptors are available: */
+    if (pTxHwQueue->uNumUsedDescriptors < NUM_TX_DESCRIPTORS)
+    {
+        /* Calculate how many buffers are available for this Queue: the total free buffers minus the buffers
+             that are reserved for other Queues (all reserved minus this Queue's reserved). */
+        return (pTxHwQueue->uNumTotalBlksFree - (pTxHwQueue->uNumTotalBlksReserved - pQueueInfo->uNumBlksReserved));
+    }
+
+    /* If no descriptors are available, return 0 (can't transmit anything). */
+    else
+    {
+        return 0;
+    }
+}
+
+
+/****************************************************************************
+ *                      txHwQueue_RegisterCb()
+ ****************************************************************************
+ * DESCRIPTION:  Register the upper driver TxHwQueue callback functions.
+ ****************************************************************************/
+void txHwQueue_RegisterCb (TI_HANDLE hTxHwQueue, TI_UINT32 uCallBackId, void *fCbFunc, TI_HANDLE hCbHndl)
+{
+    TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+
+    switch (uCallBackId)
+    {
+        case TWD_INT_UPDATE_BUSY_MAP:
+            pTxHwQueue->fUpdateBusyMapCb   = (tUpdateBusyMapCb)fCbFunc;
+            pTxHwQueue->hUpdateBusyMapHndl = hCbHndl;
+            break;
+
+        default:
+            TRACE1(pTxHwQueue->hReport, REPORT_SEVERITY_ERROR, " - Illegal parameter = %d\n", uCallBackId);
+            return;
+    }
+}
+
+
+/****************************************************************************
+ *                      txHwQueue_PrintInfo()
+ ****************************************************************************
+ * DESCRIPTION: Print the Hw Queue module current information
+ ****************************************************************************/
+#ifdef TI_DBG
+void txHwQueue_PrintInfo (TI_HANDLE hTxHwQueue)
+{
+    TTxHwQueue *pTxHwQueue = (TTxHwQueue *)hTxHwQueue;
+    TI_INT32 TxQid;
+
+    /* Print the Tx-HW-Queue information: */
+    WLAN_OS_REPORT(("Hw-Queues Information:\n"));
+    WLAN_OS_REPORT(("======================\n"));
+    WLAN_OS_REPORT(("Total Blocks:           %d\n", pTxHwQueue->uNumTotalBlks));
+    WLAN_OS_REPORT(("Total Free Blocks:      %d\n", pTxHwQueue->uNumTotalBlksFree));
+    WLAN_OS_REPORT(("Total Reserved Blocks:  %d\n", pTxHwQueue->uNumTotalBlksReserved));
+    WLAN_OS_REPORT(("Total Used Descriptors: %d\n", pTxHwQueue->uNumUsedDescriptors));
+    WLAN_OS_REPORT(("FwTxResultsCntr:        %d\n", pTxHwQueue->uFwTxResultsCntr));
+    WLAN_OS_REPORT(("DrvTxPacketsCntr:       %d\n", pTxHwQueue->uDrvTxPacketsCntr));
+
+    for(TxQid = 0; TxQid < MAX_NUM_OF_AC; TxQid++)
+    {
+        WLAN_OS_REPORT(("Q=%d: Used=%d, Reserve=%d, Threshold=%d\n", 
+            TxQid,
+            pTxHwQueue->aTxHwQueueInfo[TxQid].uNumBlksUsed,
+            pTxHwQueue->aTxHwQueueInfo[TxQid].uNumBlksReserved,
+            pTxHwQueue->aTxHwQueueInfo[TxQid].uNumBlksThresh));
+    }
+
+    WLAN_OS_REPORT(("\n"));
+
+    for(TxQid = 0; TxQid < MAX_NUM_OF_AC; TxQid++)
+    {
+        WLAN_OS_REPORT(("Queue=%d: HostAllocCount=0x%x, FwFreeCount=0x%x, BusyBlks=%d, Busy=%d\n", 
+            TxQid,
+            pTxHwQueue->aTxHwQueueInfo[TxQid].uAllocatedBlksCntr,
+            pTxHwQueue->aTxHwQueueInfo[TxQid].uFwFreedBlksCntr,
+            pTxHwQueue->aTxHwQueueInfo[TxQid].uNumBlksCausedBusy,
+            pTxHwQueue->aTxHwQueueInfo[TxQid].bQueueBusy));
+    }
+}
+
+
+#endif /* TI_DBG */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/CmdMBox.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,552 @@
+/*
+ * CmdMBox.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  CmdMBox.c
+ *  \brief Handle the wlan hardware command mailbox
+ *
+ *  \see CmdMBox.h, CmdMBox_api.h, CmdQueue.c
+ */
+
+#define __FILE_ID__  FILE_ID_101
+#include "tidef.h"
+#include "osApi.h"
+#include "timer.h"
+#include "report.h"
+#include "FwEvent_api.h"
+#include "CmdMBox_api.h"
+#include "CmdMBox.h"
+#include "CmdQueue_api.h"
+#include "TWDriverInternal.h"
+#include "TwIf.h"
+
+/*****************************************************************************
+ **         Internal functions definitions                                  **
+ *****************************************************************************/
+
+/*
+ * \brief	Handle cmdMbox timeout.
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK
+ * 
+ * \par Description
+ * Call fErrorCb() to handle the error.
+ * 
+ * \sa cmdMbox_SendCommand
+ */
+static void cmdMbox_TimeOut (TI_HANDLE hCmdMbox, TI_BOOL bTwdInitOccured);
+static void cmdMbox_ConfigHwCb (TI_HANDLE hCmdMbox, TTxnStruct *pTxn);
+
+/*
+ * \brief	Create the mailbox object
+ * 
+ * \param  hOs  - OS module object handle
+ * \return Handle to the created object
+ * 
+ * \par Description
+ * Calling this function creates a CmdMbox object
+ * 
+ * \sa cmdMbox_Destroy
+ */
+TI_HANDLE cmdMbox_Create (TI_HANDLE hOs)
+{
+    TCmdMbox   *pCmdMbox;
+    TI_UINT8 CMD;
+
+    pCmdMbox = os_memoryAlloc (hOs, sizeof (TCmdMbox),MemoryNormal);
+    if (pCmdMbox == NULL)
+    {
+        WLAN_OS_REPORT (("FATAL ERROR: cmdMbox_Create(): Error Creating CmdMbox - Aborting\n"));
+        return NULL;
+    }
+
+    /* reset control module control block */
+    os_memoryZero (hOs, pCmdMbox, sizeof (TCmdMbox));
+    pCmdMbox->hOs = hOs;
+
+    /* Allocate the CMD Mbox buffers and Registers buffers */
+    for (CMD = 0; CMD < CMD_NUM; CMD++) 
+    {
+        /* MBOX */
+        pCmdMbox->aCmdTxn[CMD].pCmdMbox = os_memoryAlloc (hOs, sizeof (Command_t) + WSPI_PAD_LEN_READ,MemoryDMA);
+        if (pCmdMbox->aCmdTxn[CMD].pCmdMbox == NULL) 
+        {
+            return NULL;
+        }
+        os_memoryZero (hOs, pCmdMbox->aCmdTxn[CMD].pCmdMbox, sizeof (Command_t) + WSPI_PAD_LEN_READ);
+        pCmdMbox->aCmdTxn[CMD].pCmdMbox += WSPI_PAD_LEN_READ;
+        /* Register */
+        pCmdMbox->aRegTxn[CMD].pRegister = os_memoryAlloc (hOs, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ,MemoryDMA);
+        if (pCmdMbox->aRegTxn[CMD].pRegister == NULL) 
+        {
+            return NULL;
+        }
+        os_memoryZero (hOs, pCmdMbox->aRegTxn[CMD].pRegister, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ);
+        pCmdMbox->aRegTxn[CMD].pRegister += WSPI_PAD_LEN_READ;
+    }
+
+
+    return pCmdMbox;
+}
+
+
+/*
+ * \brief	Destroys the mailbox object
+ * 
+ * \param  hCmdMbox  - The object to free
+ * \return TI_OK
+ * 
+ * \par Description
+ * Calling this function destroys a CmdMbox object
+ * 
+ * \sa cmdMbox_Create
+ */
+TI_STATUS cmdMbox_Destroy (TI_HANDLE hCmdMbox)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+    TI_UINT8 CMD;
+
+    /* free timer */
+    if (pCmdMbox->hCmdMboxTimer)
+    {
+        tmr_DestroyTimer (pCmdMbox->hCmdMboxTimer);
+    }
+
+    /* Free MBOX and Registers buffers */
+    for (CMD = 0; CMD < CMD_NUM; CMD++) 
+    {
+        if (pCmdMbox->aCmdTxn[CMD].pCmdMbox) 
+        {
+            os_memoryFree (pCmdMbox->hOs, ((TI_UINT8*)(pCmdMbox->aCmdTxn[CMD].pCmdMbox)) - WSPI_PAD_LEN_READ, sizeof (Command_t) + WSPI_PAD_LEN_READ);
+        }
+        if (pCmdMbox->aRegTxn[CMD].pRegister)
+        {
+            os_memoryFree (pCmdMbox->hOs, pCmdMbox->aRegTxn[CMD].pRegister - WSPI_PAD_LEN_READ, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ);
+        }
+    }
+
+    /* free context */
+    os_memoryFree (pCmdMbox->hOs, pCmdMbox, sizeof (TCmdMbox));
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Configure the CmdMbox object
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  hReport  - Handle to report module
+ * \param  hTwIf  - Handle to TwIf
+ * \param  hTimer  - Handle to os timer
+ * \param  hCmdQueue  - Handle to CmdQueue
+ * \param  fErrorCb  - Handle to error handling function
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdMbox_Init (TI_HANDLE hCmdMbox,
+                          TI_HANDLE             hReport, 
+                        TI_HANDLE hTwIf,
+                          TI_HANDLE             hTimer, 
+                        TI_HANDLE hCmdQueue,
+                          TCmdMboxErrorCb       fErrorCb)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+
+    pCmdMbox->hCmdQueue = hCmdQueue;
+    pCmdMbox->hTwIf = hTwIf;
+    pCmdMbox->hReport = hReport;
+    pCmdMbox->hCmdMboxTimer = hTimer;
+
+    pCmdMbox->uFwAddr = 0;
+    pCmdMbox->uReadLen = 0;
+    pCmdMbox->uWriteLen = 0;
+    pCmdMbox->bCmdInProgress = TI_FALSE;
+    pCmdMbox->fErrorCb = fErrorCb;
+
+	/* allocate OS timer memory */
+    pCmdMbox->hCmdMboxTimer = tmr_CreateTimer (hTimer);
+	if (pCmdMbox->hCmdMboxTimer == NULL)
+	{
+        TRACE0(pCmdMbox->hReport, REPORT_SEVERITY_ERROR, "cmdMbox_Init(): Failed to create hCmdMboxTimer!\n");
+		return TI_NOK;
+	}
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Send the Command to the Mailbox
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  cmdType  - 
+ * \param  pParamsBuf  - The buffer that will be written to the mailbox
+ * \param  uWriteLen  - Length of data to write to the mailbox
+ * \param  uReadLen  - Length of data to read from the mailbox (when the result is received)
+ * \return TI_PENDING
+ * 
+ * \par Description
+ * Copy the buffer given to a local struct, update the write & read lengths
+ * and send to the FW's mailbox.
+ *             
+ *       ------------------------------------------------------
+ *      | CmdMbox Header | Cmd Header    | Command parameters |
+ *      ------------------------------------------------------
+ *      | ID   | Status  | Type | Length | Command parameters |
+ *      ------------------------------------------------------
+ *       16bit   16bit    16bit   16bit     
+ *
+ * \sa cmdMbox_CommandComplete
+ */
+TI_STATUS cmdMbox_SendCommand       (TI_HANDLE hCmdMbox, Command_e cmdType, TI_UINT8* pParamsBuf, TI_UINT32 uWriteLen, TI_UINT32 uReadLen)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+    TTxnStruct *pCmdTxn = (TTxnStruct*)&pCmdMbox->aCmdTxn[0].tTxnStruct;
+    TTxnStruct *pRegTxn = (TTxnStruct*)&pCmdMbox->aRegTxn[0].tTxnStruct;
+    Command_t  *pCmd = ((Command_t *)(pCmdMbox->aCmdTxn[0].pCmdMbox));
+    
+
+    if (pCmdMbox->bCmdInProgress)
+    {
+        TRACE0(pCmdMbox->hReport, REPORT_SEVERITY_ERROR, "cmdMbox_SendCommand(): Trying to send Cmd while other Cmd is still in progres!\n");
+        return TI_NOK;
+    }
+
+    /* Add the CMDMBOX_HEADER_LEN to the read length, used when reading the result later on */
+    pCmdMbox->uReadLen = uReadLen + CMDMBOX_HEADER_LEN;
+    /* Prepare the Cmd Hw template */
+    pCmd->cmdID = cmdType;
+    pCmd->cmdStatus = TI_OK;
+    os_memoryCopy (pCmdMbox->hOs, (void *)pCmd->parameters, (void *)pParamsBuf, uWriteLen);
+
+    /* Add the CMDMBOX_HEADER_LEN to the write length */
+    pCmdMbox->uWriteLen = uWriteLen + CMDMBOX_HEADER_LEN;
+
+    /* Must make sure that the length is multiple of 32 bit */
+    if (pCmdMbox->uWriteLen & 0x3)
+    {
+        TRACE1(pCmdMbox->hReport, REPORT_SEVERITY_WARNING, "cmdMbox_SendCommand(): Command length isn't 32bit aligned! CmdId=%d\n", pCmd->cmdID);
+        pCmdMbox->uWriteLen = (pCmdMbox->uWriteLen + 4) & 0xFFFFFFFC;
+    }
+
+    /* no other command can start the send process  till bCmdInProgress will return to TI_FALSE*/
+    pCmdMbox->bCmdInProgress = TI_TRUE;
+
+    /* Build the command TxnStruct */
+    TXN_PARAM_SET(pCmdTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pCmdTxn, pCmdMbox->uFwAddr, pCmd, pCmdMbox->uWriteLen, NULL, NULL)
+    /* Send the command */
+    twIf_Transact(pCmdMbox->hTwIf, pCmdTxn);
+
+    /* Build the trig TxnStruct */
+    *((TI_UINT32*)(pCmdMbox->aRegTxn[0].pRegister)) = INTR_TRIG_CMD;
+    TXN_PARAM_SET(pRegTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pRegTxn, ACX_REG_INTERRUPT_TRIG, pCmdMbox->aRegTxn[0].pRegister, REGISTER_SIZE, NULL, NULL)
+
+    /* start the CmdMbox timer */
+    tmr_StartTimer (pCmdMbox->hCmdMboxTimer, cmdMbox_TimeOut, hCmdMbox, CMDMBOX_WAIT_TIMEOUT, TI_FALSE);
+
+    /* Send the FW trigger */
+    twIf_Transact(pCmdMbox->hTwIf, pRegTxn);
+
+
+    return TXN_STATUS_PENDING;
+}
+
+
+/*
+ * \brief	Read the command's result
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return void
+ * 
+ * \par Description
+ * This function is called from FwEvent module uppon receiving command complete interrupt.
+ * It issues a read transaction from the mailbox with a CB.
+ * 
+ * \sa cmdMbox_SendCommand, cmdMbox_TransferComplete
+ */
+void cmdMbox_CommandComplete (TI_HANDLE hCmdMbox)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+    TTxnStruct *pCmdTxn = (TTxnStruct*)&pCmdMbox->aCmdTxn[1].tTxnStruct;
+    Command_t  *pCmd = ((Command_t *)(pCmdMbox->aCmdTxn[1].pCmdMbox));
+    ETxnStatus  rc;
+
+    /* stop the CmdMbox timer */
+    tmr_StopTimer(pCmdMbox->hCmdMboxTimer);
+
+    /* Build the command TxnStruct */
+    TXN_PARAM_SET(pCmdTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+    /* Applying a CB in case of an async read */
+    BUILD_TTxnStruct(pCmdTxn, pCmdMbox->uFwAddr, pCmd, pCmdMbox->uReadLen,(TTxnDoneCb)cmdMbox_TransferComplete, hCmdMbox)
+    /* Send the command */
+    rc = twIf_Transact(pCmdMbox->hTwIf, pCmdTxn);
+
+    /* In case of a sync read, call the CB directly */
+    if (rc == TXN_STATUS_COMPLETE)
+    {
+        cmdMbox_TransferComplete(hCmdMbox);
+    }
+}
+
+
+/*
+ * \brief	Calls the cmdQueue_ResultReceived.
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK
+ * 
+ * \par Description
+ * This function is called from cmdMbox_CommandComplete on a sync read, or from TwIf as a CB on an async read.
+ * It calls cmdQueue_ResultReceived to continue the result handling procces & switch the bCmdInProgress flag to TI_FALSE, 
+ * meaning other commands can be sent to the FW.
+ * 
+ * \sa cmdMbox_SendCommand, cmdMbox_TransferComplete
+ */
+TI_STATUS cmdMbox_TransferComplete(TI_HANDLE hCmdMbox)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+
+    /* Other commands can be sent to the FW */
+    pCmdMbox->bCmdInProgress = TI_FALSE;
+
+    cmdQueue_ResultReceived(pCmdMbox->hCmdQueue);
+    
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Handle cmdMbox timeout.
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK
+ * 
+ * \par Description
+ * Call fErrorCb() to handle the error.
+ * 
+ * \sa cmdMbox_SendCommand
+ */
+static void cmdMbox_TimeOut (TI_HANDLE hCmdMbox, TI_BOOL bTwdInitOccured)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+    Command_t  *pCmd = ((Command_t *)(pCmdMbox->aCmdTxn[0].pCmdMbox));
+
+    TRACE0(pCmdMbox->hReport, REPORT_SEVERITY_ERROR , "cmdMbox_TimeOut: Timeout occured in CmdMbox\n");
+
+    /* Call error CB */
+    if (pCmdMbox->fErrorCb != NULL)
+    {
+        pCmdMbox->fErrorCb (pCmdMbox->hCmdQueue, 
+                            (TI_UINT32)pCmd->cmdID, 
+                            CMD_STATUS_TIMEOUT, 
+                            (void *)pCmd->parameters);
+    }
+}
+
+
+/*
+ * \brief	configure the mailbox address.
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  fCb  - Pointer to the CB
+ * \param  hCb  - Cb's handle
+ * \return TI_OK or TI_PENDING
+ * 
+ * \par Description
+ * Called from HwInit to read the command mailbox address.
+ * 
+ * \sa
+ */
+TI_STATUS cmdMbox_ConfigHw (TI_HANDLE hCmdMbox, fnotify_t fCb, TI_HANDLE hCb)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+    TTxnStruct *pRegTxn = (TTxnStruct*)&pCmdMbox->aRegTxn[1].tTxnStruct;
+    TI_STATUS   rc;
+
+    pCmdMbox->fCb = fCb;
+    pCmdMbox->hCb = hCb;
+    /* Build the command TxnStruct */
+    TXN_PARAM_SET(pRegTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pRegTxn, REG_COMMAND_MAILBOX_PTR, pCmdMbox->aRegTxn[1].pRegister, REGISTER_SIZE,(TTxnDoneCb)cmdMbox_ConfigHwCb, hCmdMbox)
+    /* Get the command mailbox address */
+    rc = twIf_Transact(pCmdMbox->hTwIf, pRegTxn);
+    if (rc == TXN_STATUS_COMPLETE)
+    {
+        pCmdMbox->uFwAddr = *((TI_UINT32 *)(pCmdMbox->aRegTxn[1].pRegister));
+    }
+
+    return rc;
+}
+
+
+/*
+ * \brief	Cb to cmdMbox_ConfigHw
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+static void cmdMbox_ConfigHwCb (TI_HANDLE hCmdMbox, TTxnStruct *pTxn)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+
+    pCmdMbox->uFwAddr = *((TI_UINT32 *)(pCmdMbox->aRegTxn[1].pRegister));
+
+    /* Call back the original State Machine */
+    pCmdMbox->fCb(pCmdMbox->hCb, TI_OK);
+}
+
+
+/*
+ * \brief	Restart the module upon driver stop or restart
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdMbox_Restart (TI_HANDLE hCmdMbox)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+
+    /* Stop the timeout timer if running and reset the state */
+    tmr_StopTimer (pCmdMbox->hCmdMboxTimer);
+    pCmdMbox->bCmdInProgress = TI_FALSE;
+    pCmdMbox->uReadLen       = 0;
+    pCmdMbox->uWriteLen      = 0;
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Return the latest command status
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK or TI_NOK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdMbox_GetStatus (TI_HANDLE hCmdMbox)
+{
+    TCmdMbox   *pCmdMbox = (TCmdMbox *)hCmdMbox;
+    Command_t  *pCmd = ((Command_t *)(pCmdMbox->aCmdTxn[1].pCmdMbox));
+    TI_STATUS   status;
+
+    status = (pCmd->cmdStatus == CMD_STATUS_SUCCESS) ? TI_OK : TI_NOK;
+    TRACE2(pCmdMbox->hReport, REPORT_SEVERITY_INFORMATION , "cmdMbox_GetStatus: TI_STATUS = (%d) <= pCmdMbox->pCmdMbox.cmdStatus = %d\n", status, pCmd->cmdStatus);
+    return status;
+}
+
+
+/*
+ * \brief	Return the MBox address
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return MBox address
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_UINT32 cmdMbox_GetMboxAddress (TI_HANDLE hCmdMbox)
+{
+    TCmdMbox *pCmdMbox = (TCmdMbox *)hCmdMbox;
+
+    return pCmdMbox->uFwAddr;
+}
+
+
+/*
+ * \brief	Return the Command parameters buffer
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  pParamBuf  - Holds the returned buffer
+ * \return
+ * 
+ * \par Description
+ * Copying the command's data to pParamBuf
+ * 
+ * \sa
+ */
+void cmdMbox_GetCmdParams (TI_HANDLE hCmdMbox, TI_UINT8* pParamBuf)
+{
+    TCmdMbox *pCmdMbox = (TCmdMbox *)hCmdMbox;
+    Command_t  *pCmd = ((Command_t *)(pCmdMbox->aCmdTxn[1].pCmdMbox));
+
+    /* 
+     * Copy the results to the caller buffer:
+     * We need to copy only the data without the cmdMbox header, 
+     * otherwise we will overflow the pParambuf 
+     */
+    os_memoryCopy (pCmdMbox->hOs,
+                   (void *)pParamBuf,
+                   (void *)pCmd->parameters,
+                   pCmdMbox->uReadLen - CMDMBOX_HEADER_LEN);
+
+}
+
+
+#ifdef TI_DBG
+
+void cmdMbox_PrintInfo(TI_HANDLE hCmdMbox)
+{
+    TCmdMbox *pCmdMbox = (TCmdMbox *)hCmdMbox;
+
+    WLAN_OS_REPORT(("Print cmdMbox module info\n"));
+    WLAN_OS_REPORT(("=========================\n"));
+    WLAN_OS_REPORT(("bCmdInProgress = %d\n", pCmdMbox->bCmdInProgress));
+}
+
+#endif  /* TI_DBG */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/CmdMBox.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,115 @@
+/*
+ * CmdMBox.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 CmdMBox.h
+ *  \brief CmdMbox internal defenitions
+ *
+ *  \see CmdMBox.c
+ */
+
+#ifndef _CMDMBOX_H_
+#define _CMDMBOX_H_
+
+#include "TwIf.h"
+
+/*****************************************************************************
+ **          Defines                                                        **
+ *****************************************************************************/
+ /* wait for a Mail box command to complete, ms */
+#define CMDMBOX_WAIT_TIMEOUT            15000
+#define CMDMBOX_HEADER_LEN              4
+#define MAX_CMD_MBOX_CONSECUTIVE_TXN    5
+#define CMD_NUM                         2
+
+
+
+typedef struct
+{   
+    TTxnStruct          tTxnStruct;
+    TI_UINT8            *pCmdMbox;
+}TCmdTxn;
+
+typedef struct
+{   
+    TTxnStruct          tTxnStruct;
+    TI_UINT8            *pRegister;
+}TRegTxn;
+
+
+/*****************************************************************************
+ **         Structures                                                      **
+ *****************************************************************************/
+
+/** \struct TCmdMbox
+ * \brief CmdMbox structure
+ * 
+ * \par Description
+ * 
+ * \sa	
+ */ 
+typedef struct
+{   
+    /* handles */
+    TI_HANDLE           hOs;
+    TI_HANDLE           hReport;
+    TI_HANDLE           hTwIf;
+    TI_HANDLE           hTimer; 
+    TI_HANDLE           hCmdQueue;
+    TI_HANDLE           hCmdMboxTimer;
+    fnotify_t           fCb;
+    TI_HANDLE           hCb;
+    TCmdMboxErrorCb     fErrorCb;
+    
+    /* HW params */
+    /* use a struct to read buffers from the bus - used for extra bytes reserving */
+
+    TCmdTxn             aCmdTxn[CMD_NUM];
+    TRegTxn             aRegTxn[CMD_NUM];
+
+    /* Holds the module state */
+    TI_BOOL             bCmdInProgress;
+    TI_UINT32           uFwAddr;
+    TI_UINT32           uWriteLen;
+    TI_UINT32           uReadLen;
+
+} TCmdMbox;
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/Export_Inc/CmdMBox_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,245 @@
+/*
+ * CmdMBox_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 CmdMBox_api.h
+ *  \brief CmdMbox api
+ *
+ *  \see CmdMBox.c
+ */
+
+#ifndef _CMDMBOX_API_H_
+#define _CMDMBOX_API_H_
+
+#include "TWDriverInternal.h"
+
+
+/*****************************************************************************
+ **              Types                                                      **
+ *****************************************************************************/
+typedef TI_STATUS (*TCmdMboxErrorCb)     (TI_HANDLE hCmdQueue, TI_UINT32 command, TI_UINT32 status, void *param);
+
+
+/*****************************************************************************
+ **         API functions definitions                                  **
+ *****************************************************************************/
+
+/*
+ * \brief	Create the mailbox object
+ * 
+ * \param  hOs  - OS module object handle
+ * \return Handle to the created object
+ * 
+ * \par Description
+ * Calling this function creates a CmdMbox object
+ * 
+ * \sa cmdMbox_Destroy
+ */
+TI_HANDLE cmdMbox_Create            (TI_HANDLE hOs);
+
+
+/*
+ * \brief	Destroys the mailbox object
+ * 
+ * \param  hCmdMbox  - The object to free
+ * \return TI_OK
+ * 
+ * \par Description
+ * Calling this function destroys a CmdMbox object
+ * 
+ * \sa cmdMbox_Create
+ */
+TI_STATUS cmdMbox_Destroy           (TI_HANDLE hCmdMbox);
+
+
+/*
+ * \brief	Configure the CmdMbox object
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  hReport  - Handle to report module
+ * \param  hTwIf  - Handle to TwIf
+ * \param  hTimer  - Handle to os timer
+ * \param  hCmdQueue  - Handle to CmdQueue
+ * \param  fErrorCb  - Handle to error handling function
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdMbox_Init              (TI_HANDLE hCmdMbox,
+                                     TI_HANDLE hReport,
+                                     TI_HANDLE hTwIf,
+                                     TI_HANDLE hTimer,
+                                     TI_HANDLE hCmdQueue,
+                                     TCmdMboxErrorCb fErrorCb);
+
+
+/*
+ * \brief	configure the mailbox address.
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  fCb  - Pointer to the CB
+ * \param  hCb  - Cb's handle
+ * \return TI_OK or TI_PENDING
+ * 
+ * \par Description
+ * Called from HwInit to read the command mailbox address.
+ * 
+ * \sa
+ */
+TI_STATUS cmdMbox_ConfigHw          (TI_HANDLE hCmdMbox, fnotify_t fCb, TI_HANDLE hCb);
+
+
+/*
+ * \brief	Send the Command to the Mailbox
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  cmdType  - 
+ * \param  pParamsBuf  - The buffer that will be written to the mailbox
+ * \param  uWriteLen  - Length of data to write to the mailbox
+ * \param  uReadLen  - Length of data to read from the mailbox (when the result is received)
+ * \return TI_PENDING
+ * 
+ * \par Description
+ * Copy the buffer given to a local struct, update the write & read lengths
+ * and send to the FW's mailbox.
+ *             
+ *       ------------------------------------------------------
+ *      | CmdMbox Header | Cmd Header    | Command parameters |
+ *      ------------------------------------------------------
+ *      | ID   | Status  | Type | Length | Command parameters |
+ *      ------------------------------------------------------
+ *       16bit   16bit    16bit   16bit     
+ *
+ * \sa cmdMbox_CommandComplete
+ */
+TI_STATUS cmdMbox_SendCommand       (TI_HANDLE hCmdMbox, Command_e cmdType, TI_UINT8* pParamsBuf, TI_UINT32 uWriteLen, TI_UINT32 uReadLen);
+
+
+/*
+ * \brief	Read the command's result
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return void
+ * 
+ * \par Description
+ * This function is called for FwEvent module uppon receiving command complete interrupt.
+ * It issues a read transaction from the mailbox with a CB.
+ * 
+ * \sa cmdMbox_SendCommand, cmdMbox_TransferComplete
+ */
+void cmdMbox_CommandComplete (TI_HANDLE hCmdMbox);
+
+
+/*
+ * \brief	Calls the cmdQueue_ResultReceived.
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK
+ * 
+ * \par Description
+ * This function is called from cmdMbox_CommandComplete on a sync read, or from TwIf as a CB on an async read.
+ * It calls cmdQueue_ResultReceived to continue the result handling procces & switch the bCmdInProgress flag to TI_FALSE, 
+ * meaning other commands can be sent to the FW.
+ * 
+ * \sa cmdMbox_SendCommand, cmdMbox_TransferComplete
+ */
+TI_STATUS cmdMbox_TransferComplete  (TI_HANDLE hCmdMbox);
+
+
+/*
+ * \brief	Restart the module upon driver stop or restart
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdMbox_Restart           (TI_HANDLE hCmdMbox);
+
+
+/*
+ * \brief	Return the latest command status
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return TI_OK or TI_NOK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS cmdMbox_GetStatus         (TI_HANDLE hCmdMbox);
+
+
+/*
+ * \brief	Return the MBox address
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \return MBox address
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_UINT32 cmdMbox_GetMboxAddress    (TI_HANDLE hCmdMbox);
+
+
+/*
+ * \brief	Return the Command parameters buffer
+ * 
+ * \param  hCmdMbox  - Handle to CmdMbox
+ * \param  pParamBuf  - Holds the returned buffer
+ * \return
+ * 
+ * \par Description
+ * Copying the command's data to pParamBuf
+ * 
+ * \sa
+ */
+void      cmdMbox_GetCmdParams           (TI_HANDLE hCmdMbox, TI_UINT8* pParamBuf);
+
+
+#ifdef TI_DBG
+void      cmdMbox_PrintInfo              (TI_HANDLE hCmdMbox);
+#endif
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/Export_Inc/FwEvent_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,260 @@
+/*
+ * FwEvent_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 FwEvent.h
+ *  \brief FwEvent api
+ *
+ *  \see FwEvent.c
+ */
+
+
+#ifndef _FW_EVENT_API_H
+#define _FW_EVENT_API_H
+
+/* Public Function Definitions */
+
+/*
+ * \brief	Create the FwEvent module object
+ * 
+ * \param  hOs  - OS module object handle
+ * \return Handle to the created object
+ * 
+ * \par Description
+ * Calling this function creates a FwEvent object
+ * 
+ * \sa fwEvent_Destroy
+ */
+TI_HANDLE       fwEvent_Create              (TI_HANDLE hOs);
+
+
+/*
+ * \brief	Destroys the FwEvent object
+ * 
+ * \param  hFwEvent  - The object to free
+ * \return TI_OK
+ * 
+ * \par Description
+ * Calling this function destroys a FwEvent object
+ * 
+ * \sa fwEvent_Create
+ */
+TI_STATUS       fwEvent_Destroy             (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Requests the context engine to schedule the driver task
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * Called by the FW-Interrupt ISR.
+ * Requests the context engine to schedule the driver task 
+ * for handling the FW-Events (FwEvent callback).
+ * 
+ * \sa
+ */
+void            fwEvent_InterruptRequest    (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Handle the FW interrupts
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * Called from context module upon receiving FW interrupt
+ * The function mask the interrupts and reads the FW status
+ * 
+ * \sa
+ */
+void            fwEvent_Handle              (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Handle the Fw Status information 
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * This function is called from fwEvent_Handle on a sync read, or from TwIf as a CB on an async read.
+ * It calls fwEvent_CallHandler to handle the triggered interrupts.
+ * 
+ * \sa fwEvent_Handle
+ */
+void            fwEvent_ReadCompleteCb      (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Config the FwEvent module object
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \param  hTWD  - Handle to TWD module
+ * \return TI_OK
+ * 
+ * \par Description
+ * From hTWD we extract : hOs, hReport, hTwIf, hContext,
+ *      hHealthMonitor, hEventMbox, hCmdMbox, hRxXfer, 
+ *      hTxHwQueue, hTxResult
+ * In this function we also register the FwEvent to the context engine
+ * 
+ * \sa
+ */
+TI_STATUS       fwEvent_Init                (TI_HANDLE hFwEvent, TI_HANDLE hTWD);
+
+
+/*
+ * \brief	Stop & reset FwEvent (called by the driver stop process)
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return TI_OK
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS       fwEvent_Stop                (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Translate host to FW time (Usec)
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \param  uHostTime - The host time in MS to translate
+ *
+ * \return FW Time in Usec
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_UINT32       fwEvent_TranslateToFwTime (TI_HANDLE hFwEvent, TI_UINT32 uHostTime);
+
+
+/*
+ * \brief	Disable the FwEvent client of the context thread handler
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+void            fwEvent_DisableInterrupts   (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Enable the FwEvent client of the context thread handler
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+void            fwEvent_EnableInterrupts    (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * Called when driver Start or recovery process is completed.
+ * Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle 
+ * (in case we missed an Rx interrupt in a recovery process).
+ *
+ * \sa
+ */
+void            fwEvent_EnableExternalEvents(TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Unmask only cmd-cmplt and events interrupts (needed for init phase)
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return Event mask
+ * 
+ * \par Description
+ * Unmask only cmd-cmplt and events interrupts (needed for init phase)
+ * and return interrupt enabled bit mask.
+ *
+ * \sa
+ */
+TI_UINT32       fwEvent_GetInitMask         (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Issue a FW status read (Not in response to any FW interrupt)
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * Issue a FW status read (Not in response to any FW interrupt)
+ * Called also from fwEvent_EnableExternalEvents after recovery.
+ * 
+ * \sa fwEvent_EnableExternalEvents
+ */
+void            fwEvent_GetFwStatus         (TI_HANDLE hFwEvent);
+
+
+
+#ifdef TI_DBG
+
+void            fwEvent_PrintStat           (TI_HANDLE hFwEvent);
+
+#endif  /* TI_DBG */
+
+
+
+#endif /* _FW_EVENT_API_H */
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/Export_Inc/HwInit_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,84 @@
+/*
+ * HwInit_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:   HwInit_api.h                                               */
+/*    PURPOSE:  HwInit module Header file                             	   */
+/*                                                                         */
+/***************************************************************************/
+#ifndef _HW_INIT_API_H_
+#define _HW_INIT_API_H_
+
+#include "TWDriver.h"
+
+typedef TI_STATUS (*TFinalizeCb) (TI_HANDLE);
+
+typedef struct
+{
+    TI_UINT8   MacClock;
+    TI_UINT8   ArmClock;
+    TI_BOOL    FirmwareDebug;
+
+} TBootAttr;
+
+
+/* Callback function definition for EndOfRecovery */
+typedef void (* TEndOfHwInitCb) (TI_HANDLE handle);
+
+
+TI_HANDLE hwInit_Create (TI_HANDLE hOs);
+TI_STATUS hwInit_Init   (TI_HANDLE hHwInit,
+                         TI_HANDLE hReport, 
+                         TI_HANDLE hTWD, 
+                         TI_HANDLE hFinalizeDownload, 
+                         TFinalizeCb fFinalizeDownload, 
+                         TEndOfHwInitCb fInitHwCb);
+TI_STATUS hwInit_SetNvsImage (TI_HANDLE hHwInit, TI_UINT8 *pbuf, TI_UINT32 length);
+TI_STATUS hwInit_SetFwImage (TI_HANDLE hHwInit, TFileInfo *pFileInfo);
+TI_STATUS hwInit_Destroy (TI_HANDLE hHwInit);
+TI_STATUS hwInit_Boot (TI_HANDLE hHwInit);
+TI_STATUS hwInit_LoadFw (TI_HANDLE hHwInit);
+TI_STATUS hwInit_ReadRadioParamsSm (TI_HANDLE hHwInit);
+TI_STATUS hwInit_ReadRadioParams (TI_HANDLE hHwInit);
+TI_STATUS hwInit_WriteIRQPolarity(TI_HANDLE hHwInit);
+TI_STATUS hwInit_InitPolarity(TI_HANDLE hHwInit);
+
+
+#endif /* _HW_INIT_API_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/Export_Inc/eventMbox_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,97 @@
+/*
+ * eventMbox_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  eventMbox_api.h : event Mail Box API
+ *   PURPOSE: Notify EventMbox in case of an incoming event from the FW
+ *
+ ****************************************************************************/
+#ifndef _EVENT_MBOX_API_H
+#define _EVENT_MBOX_API_H
+
+
+#include "TWDriverInternal.h"
+#include "FwEvent.h"
+
+
+/*
+ *  TEventMboxDataCb : This Call back is for EventMbox Client 
+ *                     that expect an event with Data associated  
+ *                     str:    The Data String
+ *                     strLen : The Length of the Data
+ */
+typedef void (*TEventMboxDataCb)(TI_HANDLE hCb, TI_CHAR* str, TI_UINT32 strLen);
+
+/*
+ *  TEventMboxEvCb : This Call back is for EventMbox Client 
+ *                   that expect an event without any Data
+ */
+typedef void (*TEventMboxEvCb)(TI_HANDLE hCb);
+
+
+/*****************************************************************************
+ **         API                                                            **
+ *****************************************************************************/
+
+TI_HANDLE eventMbox_Create          (TI_HANDLE hOs);
+void      eventMbox_Destroy			(TI_HANDLE hEventMbox);
+void      eventMbox_Stop			(TI_HANDLE hEventMbox);
+void      eventMbox_Config			(TI_HANDLE hEventMbox,
+									 TI_HANDLE hTwif,
+									 TI_HANDLE hReport,
+									 TI_HANDLE hFwEvent,
+									 TI_HANDLE hCmdBld);
+TI_STATUS eventMbox_InitMboxAddr	(TI_HANDLE hEventMbox, fnotify_t fCb, TI_HANDLE hCb);
+void      eventMbox_InitComplete	(TI_HANDLE hEventMbox);
+TI_STATUS eventMbox_RegisterEvent	(TI_HANDLE hEventMbox, TI_UINT32 EvID, void *fCb, TI_HANDLE hCb);
+TI_STATUS eventMbox_ReplaceEvent	(TI_HANDLE hEventMbox,
+                                     TI_UINT32   EvID, 
+                                     void       *fNewCb, 
+                                     TI_HANDLE   hNewCb,                                    
+                                     void      **pPrevCb, 
+                                     TI_HANDLE  *pPrevHndl);                                
+TI_STATUS eventMbox_UnMaskEvent		(TI_HANDLE hEventMbox, TI_UINT32 EvID, void *fCb, TI_HANDLE hCb);
+TI_STATUS eventMbox_MaskEvent		(TI_HANDLE hEventMbox, TI_UINT32 EvID, void *fCb, TI_HANDLE hCb);
+void      eventMbox_Handle		   	(TI_HANDLE hEventMbox, FwStatus_t *pFwStatus);
+#ifdef TI_DBG
+TI_STATUS eventMbox_Print           (TI_HANDLE hEventMbox);
+#endif
+
+#endif /* _EVENT_MBOX_API_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/Export_Inc/fwDebug_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,126 @@
+/*
+ * fwDebug_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  fwDebug_api.h
+ *
+ *   PURPOSE: FW-Debug module API.
+ * 
+ ****************************************************************************/
+
+#ifndef _FW_DEBUG_API_H
+#define _FW_DEBUG_API_H
+
+
+#define FW_DEBUG_MAX_BUF		256
+#define FW_DBG_CMD_MAX_PARAMS	2
+
+
+/* FW Debug commands. */
+typedef enum
+{
+	FW_DBG_CMD_READ_MEM,
+	FW_DBG_CMD_WRITE_MEM
+}fwDbg_dbgCmd_e;
+
+typedef struct
+{
+	TI_UINT32	addr;
+	TI_UINT32 	length;
+	union
+	{
+		TI_UINT8	buf8[FW_DEBUG_MAX_BUF];
+		TI_UINT32	buf32[FW_DEBUG_MAX_BUF/4];
+	} UBuf;
+}TFwDebugParams;
+
+/* for TWD Debug */
+typedef struct
+{
+	TI_UINT32		func_id;
+	union
+	{
+		TI_UINT32		opt_param;
+		TFwDebugParams	mem_debug;
+	}debug_data;
+} TTwdDebug;
+
+typedef void(*TFwDubCallback)(TI_HANDLE hCb);
+
+
+/* Public Function Definitions */
+
+
+TI_HANDLE fwDbg_Create      (TI_HANDLE hOs);
+
+void      fwDbg_Destroy     (TI_HANDLE hFwDebug);
+
+void      fwDbg_Init	    (TI_HANDLE hFwDebug,
+                             TI_HANDLE hReport,
+                             TI_HANDLE hTwif);
+
+TI_STATUS fwDbg_WriteAddr   (TI_HANDLE hFwDebug,
+                             TI_UINT32 Address,
+                             TI_UINT32 Length,
+                             TI_UINT8* Buffer,
+                             TFwDubCallback fCb,
+                             TI_HANDLE hCb);
+
+TI_STATUS fwDbg_ReadAddr    (TI_HANDLE hFwDebug,
+                             TI_UINT32 Address,
+                             TI_UINT32 Length,
+                             TI_UINT8* Buffer,
+                             TFwDubCallback fCb,
+						     TI_HANDLE hCb);
+
+TI_BOOL fwDbg_isValidMemoryAddr    (TI_HANDLE hFwDebug,
+                             TI_UINT32 Address,
+                             TI_UINT32 Length);
+
+TI_BOOL fwDbg_isValidRegAddr    (TI_HANDLE hFwDebug,
+                             TI_UINT32 Address,
+                             TI_UINT32 Length);
+
+
+#endif /* _FW_DEBUG_API_H */
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/Export_Inc/rxXfer_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,92 @@
+/*
+ * rxXfer_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  rxXfer_api.h
+ *
+ *   PURPOSE: Rx Xfer module API.
+ * 
+ ****************************************************************************/
+
+#ifndef _RX_XFER_API_H
+#define _RX_XFER_API_H
+
+
+#include "TWDriverInternal.h"
+
+/* Public Function Definitions */
+
+
+TI_HANDLE			rxXfer_Create(TI_HANDLE hOs);
+
+void				rxXfer_Destroy(TI_HANDLE hRxXfer);
+
+void				rxXfer_Init( TI_HANDLE hRxXfer,
+								   TI_HANDLE hFwEvent, 
+								   TI_HANDLE hReport,
+                                   TI_HANDLE hTwIf,
+                                   TI_HANDLE hRxQueue);
+
+TI_STATUS           rxXfer_RxEvent (TI_HANDLE hRxXfer, FwStatus_t* pFwStatus);
+
+void				rxXfer_Register_CB(TI_HANDLE hRxXfer,TI_UINT32 CallBackID,void *CBFunc,TI_HANDLE CBObj);
+
+void                rxXfer_SetRxDirectAccessParams (TI_HANDLE hRxXfer, TDmaParams *pDmaParams);
+                    
+TI_STATUS           rxXfer_Handle(TI_HANDLE hRxXfer); 
+
+/*void				rxXfer_SetRxCBufferAddr(TI_HANDLE hRxXfer, TDmaParams *pDmaParams);*/
+
+#ifdef TI_DBG
+
+void rxXfer_ClearStats( TI_HANDLE hRxXfer );
+
+void rxXfer_PrintStats( TI_HANDLE hRxXfer );
+
+
+#endif /* TI_DBG */
+
+void RxXfer_ReStart(TI_HANDLE hRxXfer);
+
+#endif /* _RX_XFER_API_H */
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/Export_Inc/txResult_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,71 @@
+/*
+ * txResult_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  txResult_api.h
+ *
+ *   PURPOSE: Tx result module API.
+ * 
+ ****************************************************************************/
+
+#ifndef _TX_RESULT_API_H
+#define _TX_RESULT_API_H
+
+
+#include "TWDriverInternal.h"
+
+
+/* Public Function Definitions */
+
+TI_HANDLE	txResult_Create (TI_HANDLE hOs);
+TI_STATUS	txResult_Destroy (TI_HANDLE hTxResult);
+TI_STATUS   txResult_Init (TI_HANDLE hTxResult, TI_HANDLE hReport, TI_HANDLE hTwIf);
+void		txResult_setHwInfo (TI_HANDLE hTxResult, TDmaParams *pDmaParams);
+void		txResult_RegisterCb (TI_HANDLE hTxResult, TI_UINT32 CallBackID, void *CBFunc, TI_HANDLE CBObj);
+void        txResult_TxCmpltIntrCb (TI_HANDLE hTxResult, FwStatus_t *pFwStatus);
+
+#ifdef TI_DBG
+void		txResult_PrintInfo (TI_HANDLE hTxResult);
+void		txResult_ClearInfo (TI_HANDLE hTxResult);
+#endif
+
+
+#endif /* _TX_RESULT_API_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/Export_Inc/txXfer_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,68 @@
+/*
+ * txXfer_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  txXfer_api.h
+ *
+ *   PURPOSE: Tx Xfer module API.
+ * 
+ ****************************************************************************/
+
+#ifndef _TX_XFER_API_H
+#define _TX_XFER_API_H
+
+
+#include "TWDriver.h"
+
+
+/* Public Function Definitions */
+
+TI_HANDLE       txXfer_Create (TI_HANDLE hOs);
+TI_STATUS       txXfer_Destroy (TI_HANDLE hTxXfer);
+TI_STATUS       txXfer_Init (TI_HANDLE hTxXfer, TI_HANDLE hReport, TI_HANDLE hTwIf);
+TI_STATUS       txXfer_Restart (TI_HANDLE hTxXfer);
+ETxnStatus      txXfer_SendPacket (TI_HANDLE hTxXfer, TTxCtrlBlk *pPktCtrlBlk);
+void            txXfer_RegisterCb (TI_HANDLE hTxResult, TI_UINT32 CallBackID, void *CBFunc, TI_HANDLE CBObj);
+
+#endif /* _TX_XFER_API_H */
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/FwEvent.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,738 @@
+/*
+ * FwEvent.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  FwEvent.c
+ *  \brief Handle firmware events
+ * 
+ *   
+ * \par Description
+ *      Call the appropriate event handler.
+ *
+ *  \see FwEvent.h
+ */
+
+#define __FILE_ID__  FILE_ID_104
+#include "tidef.h"
+#include "report.h"
+#include "context.h"
+#include "osApi.h"
+#include "TWDriver.h"
+#include "TWDriverInternal.h"
+#include "FwEvent.h" 
+#include "txResult_api.h"
+#include "CmdMBox_api.h"
+#include "rxXfer_api.h" 
+#include "txXfer_api.h" 
+#include "txHwQueue_api.h"
+#include "eventMbox_api.h"
+#include "TwIf.h"
+#ifdef TI_DBG
+    #include "tracebuf_api.h"
+#endif
+
+#ifdef _VLCT_
+extern int trigger_another_read;
+#endif
+
+#define USE_SDIO_24M_WORKAROUND
+#define FW_STATUS_MEM_ADDRESS   0x40400
+
+
+#define TXN_FW_EVENT_SET_MASK_ADDR(pFwEvent)    pFwEvent->tMaskTxn.tTxnStruct.uHwAddr = HINT_MASK;
+#define TXN_FW_EVENT_SET_UNMASK_ADDR(pFwEvent)  pFwEvent->tUnMaskTxn.tTxnStruct.uHwAddr = HINT_MASK;
+#define TXN_FW_EVENT_SET_STATUS_ADDR(pFwEvent)  pFwEvent->tFwStatusTxn.tTxnStruct.uHwAddr = ACX_REG_INTERRUPT_CLEAR;
+#define TXN_FW_EVENT_SET_FW_MEM_ADDR(pFwEvent)  pFwEvent->tMemFwStatusTxn.tTxnStruct.uHwAddr = FW_STATUS_MEM_ADDRESS;
+/********************* static function declerations *************************/
+
+/*
+ * \brief	Call FwEvent client's event handler
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * 
+ * \sa fwEvent_ReadCompleteCb
+ */
+static void fwEvent_CallHandler (TI_HANDLE hFwEvent);
+
+
+/*
+ * \brief	Create the FwEvent module object
+ * 
+ * \param  hOs  - OS module object handle
+ * \return Handle to the created object
+ * 
+ * \par Description
+ * Calling this function creates a FwEvent object
+ * 
+ * \sa fwEvent_Destroy
+ */
+TI_HANDLE fwEvent_Create (TI_HANDLE hOs)
+{
+    TfwEvent *pFwEvent;
+
+    pFwEvent = os_memoryAlloc (hOs, sizeof(TfwEvent),MemoryNormal);
+    if (pFwEvent == NULL)
+    {
+        return NULL;
+    }
+
+    os_memoryZero (hOs, pFwEvent, sizeof(TfwEvent));
+
+    /* Allocation of Data */
+    pFwEvent->tMaskTxn.pData = os_memoryAlloc (hOs, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pFwEvent->tMaskTxn.pData == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pFwEvent->tMaskTxn.pData, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ);
+    pFwEvent->tMaskTxn.pData += WSPI_PAD_LEN_READ;
+
+    /* Allocation of Data */
+    pFwEvent->tUnMaskTxn.pData = os_memoryAlloc (hOs, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pFwEvent->tUnMaskTxn.pData == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pFwEvent->tUnMaskTxn.pData, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ);
+    pFwEvent->tUnMaskTxn.pData += WSPI_PAD_LEN_READ;
+
+     /* Allocation of FW Status buffer */
+    pFwEvent->tFwStatusTxn.pFwStatus = os_memoryAlloc (hOs, sizeof (FwStatus_t) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pFwEvent->tFwStatusTxn.pFwStatus == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pFwEvent->tFwStatusTxn.pFwStatus, sizeof (FwStatus_t) + WSPI_PAD_LEN_READ);
+    pFwEvent->tFwStatusTxn.pFwStatus += WSPI_PAD_LEN_READ;
+
+     /* Allocation of FW Status buffer */
+    pFwEvent->tMemFwStatusTxn.pFwStatus = os_memoryAlloc (hOs, sizeof (FwStatus_t) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pFwEvent->tMemFwStatusTxn.pFwStatus == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pFwEvent->tMemFwStatusTxn.pFwStatus, sizeof (FwStatus_t) + WSPI_PAD_LEN_READ);
+    pFwEvent->tMemFwStatusTxn.pFwStatus += WSPI_PAD_LEN_READ;
+
+
+    pFwEvent->hOs = hOs;
+
+    return (TI_HANDLE)pFwEvent;
+}
+
+
+/*
+ * \brief	Destroys the FwEvent object
+ * 
+ * \param  hFwEvent  - The object to free
+ * \return TI_OK
+ * 
+ * \par Description
+ * Calling this function destroys a FwEvent object
+ * 
+ * \sa fwEvent_Create
+ */
+TI_STATUS fwEvent_Destroy (TI_HANDLE hFwEvent)
+{
+    TfwEvent *pFwEvent = (TfwEvent *)hFwEvent;
+
+    if (pFwEvent->tMaskTxn.pData)
+    {
+        os_memoryFree (pFwEvent->hOs, pFwEvent->tMaskTxn.pData - WSPI_PAD_LEN_READ, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ);
+    }
+
+    if (pFwEvent->tUnMaskTxn.pData)
+    {
+        os_memoryFree (pFwEvent->hOs, pFwEvent->tUnMaskTxn.pData - WSPI_PAD_LEN_READ, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ);
+    }
+
+    if (pFwEvent->tFwStatusTxn.pFwStatus)
+    {
+        os_memoryFree (pFwEvent->hOs, pFwEvent->tFwStatusTxn.pFwStatus - WSPI_PAD_LEN_READ, sizeof (FwStatus_t) + WSPI_PAD_LEN_READ);
+    }
+
+    if (pFwEvent->tMemFwStatusTxn.pFwStatus)
+    {
+        os_memoryFree (pFwEvent->hOs, pFwEvent->tMemFwStatusTxn.pFwStatus - WSPI_PAD_LEN_READ, sizeof (FwStatus_t) + WSPI_PAD_LEN_READ);
+    }
+
+    if (pFwEvent)
+    {
+        os_memoryFree (pFwEvent->hOs, pFwEvent, sizeof(TfwEvent));
+    }
+
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Config the FwEvent module object
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \param  hTWD  - Handle to TWD module
+ * \return TI_OK
+ * 
+ * \par Description
+ * From hTWD we extract : hOs, hReport, hTwIf, hContext,
+ *      hHealthMonitor, hEventMbox, hCmdMbox, hRxXfer, 
+ *      hTxHwQueue, hTxResult
+ * In this function we also register the FwEvent to the context engine
+ * 
+ * \sa
+ */
+TI_STATUS fwEvent_Init (TI_HANDLE hFwEvent, TI_HANDLE hTWD)
+{
+    TfwEvent  *pFwEvent = (TfwEvent *)hFwEvent;
+    TTwd      *pTWD = (TTwd *)hTWD;
+    TTxnStruct* pTxn;
+    
+    pFwEvent->hTWD              = hTWD;
+    pFwEvent->hOs               					= pTWD->hOs;
+    pFwEvent->hReport           					= pTWD->hReport;
+    pFwEvent->hContext          					= pTWD->hContext;
+    pFwEvent->hTwIf             = pTWD->hTwIf;
+    pFwEvent->hHealthMonitor    = pTWD->hHealthMonitor;
+    pFwEvent->hEventMbox        = pTWD->hEventMbox;
+    pFwEvent->hCmdMbox          = pTWD->hCmdMbox;
+    pFwEvent->hRxXfer           = pTWD->hRxXfer;
+    pFwEvent->hTxHwQueue        = pTWD->hTxHwQueue;
+    pFwEvent->hTxXfer           = pTWD->hTxXfer;
+    pFwEvent->hTxResult         = pTWD->hTxResult;
+
+    pFwEvent->eFwEventState       = FW_EVENT_STATE_IDLE;
+    pFwEvent->uEventMask          = 0;
+    pFwEvent->uEventVector        = 0;
+    pFwEvent->bFwNotificationFlag = TI_FALSE;
+
+    pTxn = (TTxnStruct*)&pFwEvent->tMaskTxn.tTxnStruct;
+    TXN_PARAM_SET(pTxn, TXN_HIGH_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pTxn, HINT_MASK, pFwEvent->tMaskTxn.pData, REGISTER_SIZE, NULL, NULL)
+
+    pTxn = (TTxnStruct*)&pFwEvent->tUnMaskTxn.tTxnStruct;
+    TXN_PARAM_SET(pTxn, TXN_HIGH_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pTxn, HINT_MASK, pFwEvent->tUnMaskTxn.pData, REGISTER_SIZE, NULL, NULL)
+
+#ifdef USE_SDIO_24M_WORKAROUND /* FW_STATUS moved from registers to memory area */
+    /* First txn is HINT_STT_CLR register */
+    pTxn = (TTxnStruct*)&pFwEvent->tFwStatusTxn.tTxnStruct;
+    TXN_PARAM_SET(pTxn, TXN_HIGH_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pTxn, ACX_REG_INTERRUPT_CLEAR, pFwEvent->tFwStatusTxn.pFwStatus, REGISTER_SIZE, NULL, NULL)
+    /* FW status from memory area */
+    pTxn = (TTxnStruct*)&pFwEvent->tMemFwStatusTxn.tTxnStruct;
+    TXN_PARAM_SET(pTxn, TXN_HIGH_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pTxn, FW_STATUS_MEM_ADDRESS, pFwEvent->tMemFwStatusTxn.pFwStatus, sizeof(FwStatus_t)-REGISTER_SIZE, (TTxnDoneCb)fwEvent_ReadCompleteCb, hFwEvent)
+#else
+    pTxn = (TTxnStruct*)&pFwEvent->tFwStatusTxn.tTxnStruct;
+    TXN_PARAM_SET(pTxn, TXN_HIGH_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pTxn, ACX_REG_INTERRUPT_CLEAR, pFwEvent->tFwStatusTxn.pFwStatus, sizeof(FwStatus_t), (TTxnDoneCb)fwEvent_ReadCompleteCb, hFwEvent)
+#endif
+    /* 
+     *  Register the FwEvent to the context engine and get the client ID.
+     *  The FwEvent() will be called from the context_DriverTask() after scheduled
+     *    by a FW-Interrupt (see fwEvent_InterruptRequest()).
+     */
+    pFwEvent->uContextId = context_RegisterClient (pFwEvent->hContext,
+                                                   fwEvent_Handle,
+                                                   hFwEvent,
+                                                   TI_FALSE,
+                                                   "FW_EVENT",
+                                                   sizeof("FW_EVENT"));
+	
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Call FwEvent client's event handler
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * 
+ * \sa fwEvent_ReadCompleteCb
+ */
+static void fwEvent_CallHandler (TI_HANDLE hFwEvent)
+{
+    TfwEvent   *pFwEvent = (TfwEvent *)hFwEvent;
+
+    if (pFwEvent->uEventVector & ACX_INTR_WATCHDOG)
+    {
+        /* Fw watchdog timeout has occured */
+        TWD_WdExpireEvent (pFwEvent->hTWD);
+    }
+
+    if (pFwEvent->uEventVector & ACX_INTR_INIT_COMPLETE)
+    {
+        TRACE0(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_CallHandler: INIT_COMPLETE\n");
+    }
+	/* Change to handle the command MBOX before the event MBOX to maintain order for WHA command response
+	 * and follow command complete
+	 */
+    if (pFwEvent->uEventVector & ACX_INTR_CMD_COMPLETE)
+    {
+        /* Command Mbox completed */
+        cmdMbox_CommandComplete(pFwEvent->hCmdMbox);
+    }
+    if (pFwEvent->uEventVector & ACX_INTR_EVENT_A)
+    {
+        eventMbox_Handle(pFwEvent->hEventMbox,(FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus));
+    }
+    if (pFwEvent->uEventVector & ACX_INTR_EVENT_B)
+    {
+        eventMbox_Handle(pFwEvent->hEventMbox,(FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus));
+    }
+    
+
+    /* The DATA interrupt is shared by all data path events, so call all Tx and Rx clients */
+    if (pFwEvent->uEventVector & ACX_INTR_DATA)
+    {
+        rxXfer_RxEvent (pFwEvent->hRxXfer, (FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus));
+
+        txHwQueue_UpdateFreeResources (pFwEvent->hTxHwQueue, (FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus));
+
+        txResult_TxCmpltIntrCb (pFwEvent->hTxResult, (FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus));
+    } 
+
+    /* After handling all raised bits, we can negate them */
+    ((FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus))->intrStatus &= pFwEvent->uEventMask;
+}
+
+
+/*
+ * \brief	Requests the context engine to schedule the driver task
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * Called by the FW-Interrupt ISR.
+ * Requests the context engine to schedule the driver task 
+ * for handling the FW-Events (FwEvent callback).
+ * 
+ * \sa
+ */
+void fwEvent_InterruptRequest (TI_HANDLE hFwEvent)
+{
+    TfwEvent *pFwEvent = (TfwEvent *)hFwEvent;
+
+    /* Request switch to driver context for handling the FW-Interrupt event */
+    context_RequestSchedule (pFwEvent->hContext, pFwEvent->uContextId);
+}
+
+
+/*
+ * \brief	Handle the FW interrupts
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * Called from context module upon receiving FW interrupt
+ * The function mask the interrupts and reads the FW status
+ * 
+ * \sa
+ */
+
+void fwEvent_Handle (TI_HANDLE hFwEvent)
+{
+    TfwEvent   *pFwEvent = (TfwEvent *)hFwEvent;
+    ETxnStatus rc;
+
+    /* NOTE: pFwEvent may be uninitialized at init stage */
+    if (pFwEvent != NULL)
+    {
+        if (pFwEvent->eFwEventState != FW_EVENT_STATE_IDLE)
+        {
+	    os_InterruptServiced (pFwEvent->hOs);
+            twIf_HwAvailable(pFwEvent->hTwIf);
+            return;
+        }
+
+        pFwEvent->eFwEventState = FW_EVENT_STATE_READING;
+        pFwEvent->bFwNotificationFlag = TI_TRUE;
+
+        twIf_Awake(pFwEvent->hTwIf);
+        twIf_HwAvailable(pFwEvent->hTwIf);
+
+        /* Write HINT mask */
+        *((TI_UINT32*)(pFwEvent->tMaskTxn.pData)) = ACX_INTR_ALL;
+        TXN_FW_EVENT_SET_MASK_ADDR(pFwEvent)
+        twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tMaskTxn.tTxnStruct));
+
+#ifdef USE_SDIO_24M_WORKAROUND /* FW_STATUS moved from registers to memory area */
+        /* 
+         * Read first register (HINT_STT_CLR) only from registers area
+         */
+        TXN_FW_EVENT_SET_STATUS_ADDR(pFwEvent)
+        twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tFwStatusTxn.tTxnStruct));
+
+        /* 
+         * Read other 16 registers value from memory area FW_STATUS_MEM_ADDRESS
+         */
+        TXN_FW_EVENT_SET_FW_MEM_ADDR(pFwEvent)
+        rc = twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tMemFwStatusTxn.tTxnStruct));
+
+        if (rc == TXN_STATUS_COMPLETE)
+        {
+            fwEvent_ReadCompleteCb(hFwEvent);
+        }
+#else
+
+        /* Read the Fw status */
+        TXN_FW_EVENT_SET_STATUS_ADDR(pFwEvent)
+        rc = twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tFwStatusTxn.tTxnStruct));
+
+        if (rc == TXN_STATUS_COMPLETE)
+        {
+            fwEvent_ReadCompleteCb(hFwEvent);
+        }
+#endif
+    }
+    else
+    {
+        os_InterruptServiced (pFwEvent->hOs);
+
+    /* end of if */
+    }
+}
+
+
+/*
+ * \brief	Handle the Fw Status information 
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * This function is called from fwEvent_Handle on a sync read, or from TwIf as a CB on an async read.
+ * It calls fwEvent_CallHandler to handle the triggered interrupts.
+ * 
+ * \sa fwEvent_Handle
+ */
+void fwEvent_ReadCompleteCb (TI_HANDLE hFwEvent)
+{
+    TfwEvent *pFwEvent = (TfwEvent *)hFwEvent;
+    
+#ifdef USE_SDIO_24M_WORKAROUND /* FW_STATUS moved from registers to memory area */
+    /* 
+     * copy FW status 16 registers values from memory transaction read area to the original place 
+*/
+    os_memoryCopy (pFwEvent->hOs, &((FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus))->counters, &((FwStatus_t*)(pFwEvent->tMemFwStatusTxn.pFwStatus))->counters, sizeof(FwStatus_t)-REGISTER_SIZE);
+#endif
+    
+    os_InterruptServiced (pFwEvent->hOs);
+	  
+    /* If we were called because of an interrupt */
+	if (pFwEvent->bFwNotificationFlag)
+    {
+        /* In case of level interrupt we need to clear the line */
+        /*os_InterruptServiced(pFwEvent->hOs);*/
+
+        /*
+         * Sync to fw time so we can update the tx packets
+         * on the delta time that they spent in the driver 
+         */
+        pFwEvent->uFwTimeOffset = (os_timeStampMs (pFwEvent->hOs) * 1000) - 
+                                  ENDIAN_HANDLE_LONG (((FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus))->fwLocalTime);
+
+        pFwEvent->bFwNotificationFlag = TI_FALSE;
+    }
+
+    pFwEvent->uEventVector = ((FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus))->intrStatus;
+
+    /* 
+     * Mask unwanted interrupts. 
+     */
+    pFwEvent->uEventVector &= pFwEvent->uEventMask;
+
+    fwEvent_CallHandler(hFwEvent);
+
+    /* Check if the state is changed in the context of the event callbacks */
+    if (pFwEvent->eFwEventState == FW_EVENT_STATE_IDLE)
+    {
+        /*
+         * When fwEvent_stop is called state is changed to IDLE
+         * This is done in the context of the above events callbacks
+         * Don't send the UNMASK transaction because the driver stop process includes power off
+         */ 
+        TRACE0(pFwEvent->hReport, REPORT_SEVERITY_WARNING, "fwEvent_ReadCompleteCb : State is IDLE ! don't send the UNMASK");
+        return;
+    }
+
+    /* Write HINT unmask */
+    *((TI_UINT32*)(pFwEvent->tUnMaskTxn.pData)) = ~pFwEvent->uEventMask;
+    TXN_FW_EVENT_SET_UNMASK_ADDR(pFwEvent)
+    twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tUnMaskTxn.tTxnStruct));
+
+    twIf_Sleep(pFwEvent->hTwIf);
+    pFwEvent->eFwEventState = FW_EVENT_STATE_IDLE;
+} 
+
+
+/*
+ * \brief	Translate host to FW time (Usec)
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \param  uHostTime - The host time in MS to translate
+ *
+ * \return FW Time in Usec
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_UINT32 fwEvent_TranslateToFwTime (TI_HANDLE hFwEvent, TI_UINT32 uHostTime)
+{
+    TfwEvent *pFwEvent = (TfwEvent *)hFwEvent;
+
+    return ((uHostTime * 1000) - pFwEvent->uFwTimeOffset);
+}
+
+
+/*
+ * \brief	Unmask only cmd-cmplt and events interrupts (needed for init phase)
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return Event mask
+ * 
+ * \par Description
+ * Unmask only cmd-cmplt and events interrupts (needed for init phase)
+ *                  and return interrupt enabled bit mask.
+ * 
+ * \sa
+ */
+TI_UINT32 fwEvent_GetInitMask (TI_HANDLE hFwEvent)
+{
+    TfwEvent *pFwEvent = (TfwEvent *)hFwEvent;
+
+    /* Unmask only the interrupts needed for the FW configuration process. */
+    pFwEvent->uEventMask = ACX_INTR_CMD_COMPLETE | ACX_INTR_EVENT_A | ACX_INTR_EVENT_B;
+
+    return pFwEvent->uEventMask;
+}
+
+
+/*
+ * \brief	Stop & reset FwEvent (called by the driver stop process)
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return TI_OK
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS fwEvent_Stop (TI_HANDLE hFwEvent)
+{
+    TfwEvent *pFwEvent = (TfwEvent *)hFwEvent;
+
+    pFwEvent->eFwEventState = FW_EVENT_STATE_IDLE;
+    ((FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus))->intrStatus = 0;
+    pFwEvent->uEventMask = 0;
+    pFwEvent->bFwNotificationFlag = TI_FALSE;
+    pFwEvent->uEventVector = 0;    
+    
+    return TI_OK;
+}
+
+
+/*
+ * \brief	Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * Called when driver Start or recovery process is completed.
+ *              Unmask all interrupts, set Rx interrupt bit and call FwEvent_Handle 
+ *                  (in case we missed an Rx interrupt in a recovery process).
+ * 
+ * \sa
+ */
+void fwEvent_EnableExternalEvents (TI_HANDLE hFwEvent)
+{
+    TfwEvent *pFwEvent = (TfwEvent *)hFwEvent;
+
+    /* Unmask all interrupts */
+    pFwEvent->uEventMask    = ALL_EVENTS_VECTOR;
+
+    /* Set Rx interrupt bit to invoke it (in case we missed it in a recovery/start process) */
+    ((FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus))->intrStatus |= ACX_INTR_DATA;
+
+    /* If in IDLE state, handle interrupts including the Rx we've just set manually */
+    if (pFwEvent->eFwEventState == FW_EVENT_STATE_IDLE)
+    {        
+        fwEvent_GetFwStatus (hFwEvent);
+    }
+}
+
+
+/*
+ * \brief	Disable the FwEvent client of the context thread handler
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+void fwEvent_DisableInterrupts(TI_HANDLE hFwEvent)
+{
+    TfwEvent  *pFwEvent = (TfwEvent *)hFwEvent;
+
+    context_DisableClient (pFwEvent->hContext,pFwEvent->uContextId);
+	
+}
+
+
+/*
+ * \brief	Enable the FwEvent client of the context thread handler
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+void fwEvent_EnableInterrupts(TI_HANDLE hFwEvent)
+{
+    TfwEvent  *pFwEvent = (TfwEvent *)hFwEvent;
+
+    context_EnableClient (pFwEvent->hContext,pFwEvent->uContextId);
+	
+}
+
+
+/*
+ * \brief	Issue a FW status read (Not in response to any FW interrupt)
+ * 
+ * \param  hFwEvent  - FwEvent Driver handle
+ * \return void
+ * 
+ * \par Description
+ * Issue a FW status read (Not in response to any FW interrupt)
+ * Called also from fwEvent_EnableExternalEvents after recovery.
+ * 
+ * \sa fwEvent_EnableExternalEvents
+ */
+void fwEvent_GetFwStatus (TI_HANDLE hFwEvent)
+{
+    TfwEvent   *pFwEvent = (TfwEvent *)hFwEvent;
+    ETxnStatus rc;
+
+    /* NOTE: pFwEvent may be uninitialized at init stage */
+    if (pFwEvent != NULL)
+    {
+        if (pFwEvent->eFwEventState != FW_EVENT_STATE_IDLE)
+        {
+            twIf_HwAvailable(pFwEvent->hTwIf);
+            return;
+        }
+
+        pFwEvent->eFwEventState = FW_EVENT_STATE_READING;
+        
+        twIf_Awake(pFwEvent->hTwIf);
+
+        /* Write HINT mask */
+        *((TI_UINT32*)(pFwEvent->tMaskTxn.pData)) = ACX_INTR_ALL;
+        TXN_FW_EVENT_SET_MASK_ADDR(pFwEvent)
+        twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tMaskTxn.tTxnStruct));
+
+#ifdef USE_SDIO_24M_WORKAROUND /* FW_STATUS moved from registers to memory area */
+        /* 
+         * Read first register (HINT_STT_CLR) only from registers area
+         */
+        TXN_FW_EVENT_SET_STATUS_ADDR(pFwEvent)
+        twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tFwStatusTxn.tTxnStruct));
+
+        /* 
+         * Read other 16 registers value from memory area 0x40200
+         */
+        TXN_FW_EVENT_SET_FW_MEM_ADDR(pFwEvent)
+        rc = twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tMemFwStatusTxn.tTxnStruct));
+
+        if (rc == TXN_STATUS_COMPLETE)
+        {
+            fwEvent_ReadCompleteCb(hFwEvent);
+        }
+#else
+        /* Read the Fw status */
+        TXN_FW_EVENT_SET_STATUS_ADDR(pFwEvent)
+        rc = twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tFwStatusTxn.tTxnStruct));
+
+        if (rc == TXN_STATUS_COMPLETE)
+        {
+            fwEvent_ReadCompleteCb(hFwEvent);
+        }
+#endif
+    /* end of if */
+    }
+}
+
+
+#ifdef TI_DBG
+
+void fwEvent_PrintStat (TI_HANDLE hFwEvent)
+{
+    TfwEvent *pFwEvent = (TfwEvent *)hFwEvent;
+    FwStatus_t *fwStat = (FwStatus_t*)(pFwEvent->tFwStatusTxn.pFwStatus); 
+	int i;
+
+    WLAN_OS_REPORT(("Print FW event module info\n"));
+    WLAN_OS_REPORT(("==========================\n"));
+    WLAN_OS_REPORT(("intrStatus = 0x%08x\n", fwStat->intrStatus));
+    WLAN_OS_REPORT(("counters   = 0x%08x\n", fwStat->counters));
+	for (i = 0; i < NUM_RX_PKT_DESC; i++)
+    {
+		WLAN_OS_REPORT(("rxPktsDesc[%1d] = 0x%08x\n", i, fwStat->rxPktsDesc[i]));
+    }
+	for (i = 0; i < NUM_TX_QUEUES; i++)
+    {
+		WLAN_OS_REPORT(("txReleasedBlks[%1d] = 0x%08x\n", i, fwStat->txReleasedBlks[i]));
+    }
+    WLAN_OS_REPORT(("fwLocalTime = 0x%08x\n", fwStat->fwLocalTime));
+}
+
+#endif  /* TI_DBG */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/FwEvent.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,130 @@
+/*
+ * FwEvent.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 FwEvent.h
+ *  \brief FwEvent internal defenitions
+ *
+ *  \see FwEvent.c
+ */
+
+#ifndef _FW_EVENT_
+#define _FW_EVENT_
+
+#include "FwEvent_api.h"
+#include "TwIf.h"
+#include "public_host_int.h"
+
+
+#define ALL_EVENTS_VECTOR        ACX_INTR_WATCHDOG | ACX_INTR_INIT_COMPLETE | ACX_INTR_EVENT_A |\
+                                 ACX_INTR_EVENT_B | ACX_INTR_CMD_COMPLETE |ACX_INTR_HW_AVAILABLE |\
+                                 ACX_INTR_DATA
+
+#define ALL_EVENTS_VECTOR_NEGATE 0xFFFFFFC0   
+
+
+/** \enum EFwEventState
+ * \brief FwEvent states
+ * 
+ * \par Description
+ * 
+ * \sa 
+ */
+typedef enum
+{
+    FW_EVENT_STATE_IDLE,    
+    FW_EVENT_STATE_READING
+
+} EFwEventState;
+
+
+typedef struct 
+{
+    TTxnStruct              tTxnStruct;
+    TI_UINT8                *pData; 
+
+} TRegisterTxn;
+
+typedef struct 
+{
+    TTxnStruct              tTxnStruct;
+    TI_UINT8                *pFwStatus;
+
+} TFwStatusTxn;
+
+
+/** \struct TfwEvent
+ * \brief FW event structure
+ * 
+ * \par Description
+ * 
+ * \sa	
+ */ 
+typedef struct 
+{
+    EFwEventState       eFwEventState;           	/* State machine state */
+    TI_UINT32           uEventMask;              	/* Static interrupt event mask */
+    TI_UINT32           uEventVector;
+    TI_BOOL             bFwNotificationFlag;
+    TRegisterTxn        tMaskTxn;
+    TRegisterTxn        tUnMaskTxn;
+    TFwStatusTxn        tFwStatusTxn;
+    TFwStatusTxn        tMemFwStatusTxn;
+    
+    TI_UINT32           uFwTimeOffset;              /* Offset in microseconds between driver and FW clocks */
+
+    TI_BOOL             bNotIntr;                   /* Boolean that sgnals us that the fwStatus read is not from an interrupt origin */
+
+    TI_HANDLE           hOs;                    	/* OS handle */
+    TI_HANDLE           hTWD;
+    TI_HANDLE           hReport;                	/* Report handle */
+    TI_HANDLE           hContext;               	/* Context-Engine handle */
+    TI_UINT32           uContextId;             	/* The ID allocated on registration to context module */
+    TI_HANDLE           hTwIf;                      /* TwIf handle */
+    TI_HANDLE           hHealthMonitor;             /* healthMonitor handle */
+    TI_HANDLE           hEventMbox;
+    TI_HANDLE           hCmdMbox;
+    TI_HANDLE           hRxXfer;
+    TI_HANDLE           hTxXfer;
+    TI_HANDLE           hTxHwQueue;
+    TI_HANDLE           hTxResult;
+
+} TfwEvent; 
+
+#endif  /* _FW_EVENT_ */
+        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/HwInit.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,2422 @@
+/*
+ * HwInit.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  HwInit.c                                                          */
+/*  PURPOSE: HwInit module manages the init process of the TNETW, included     */
+/*           firmware download process. It shall perform Hard Reset the chip   */
+/*           if possible (this will require a Reset line to be connected to    */
+/*           the host); Start InterfaceCtrl; Download NVS and FW               */
+/*                                                                             */
+/*                                                                             */
+/*******************************************************************************/
+
+#define __FILE_ID__  FILE_ID_105
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "HwInit_api.h"
+#include "FwEvent_api.h"
+#include "TwIf.h"
+#include "TWDriver.h"
+#include "TWDriverInternal.h"
+#include "eventMbox_api.h"
+#include "CmdBld.h"
+#include "CmdMBox_api.h"
+
+
+
+extern void TWD_FinalizeOnFailure   (TI_HANDLE hTWD);
+extern void cmdBld_FinalizeDownload (TI_HANDLE hCmdBld, TBootAttr *pBootAttr, FwStaticData_t *pFwInfo);
+
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+
+/* Download phase partition */
+#define PARTITION_DOWN_MEM_ADDR       0                 
+#define PARTITION_DOWN_MEM_SIZE       0x177C0           
+#define PARTITION_DOWN_REG_ADDR       REGISTERS_BASE	
+#define PARTITION_DOWN_REG_SIZE       0x8800            
+
+/* Working phase partition */
+#define PARTITION_WORK_MEM_ADDR1       0x40000
+#define PARTITION_WORK_MEM_SIZE1       0x14FC0
+#define PARTITION_WORK_MEM_ADDR2       REGISTERS_BASE    
+#define PARTITION_WORK_MEM_SIZE2       0xA000   
+#define PARTITION_WORK_MEM_ADDR3       0x3004F8     
+#define PARTITION_WORK_MEM_SIZE3       0x4   
+#define PARTITION_WORK_MEM_ADDR4       0x40404   
+
+/* DRPW setting partition */
+#define PARTITION_DRPW_MEM_ADDR       0x40000
+#define PARTITION_DRPW_MEM_SIZE       0x14FC0
+#define PARTITION_DRPW_REG_ADDR       DRPW_BASE         
+#define PARTITION_DRPW_REG_SIZE       0x6000	        
+
+/* Total range of bus addresses range */
+#define PARTITION_TOTAL_ADDR_RANGE    0x1FFC0
+
+/* Maximal block size in a single SDIO transfer --> Firmware image load chunk size */
+#ifdef _VLCT_
+#define MAX_SDIO_BLOCK					(4000)	
+#else
+#define MAX_SDIO_BLOCK					(500)	
+#endif
+
+#define ACX_EEPROMLESS_IND_REG        (SCR_PAD4)
+#define USE_EEPROM                    (0)
+#define SOFT_RESET_MAX_TIME           (1000000)
+#define SOFT_RESET_STALL_TIME         (1000)
+#define NVS_DATA_BUNDARY_ALIGNMENT    (4)
+
+#define MAX_HW_INIT_CONSECUTIVE_TXN     15
+
+#define WORD_SIZE                       4
+#define WORD_ALIGNMENT_MASK             0x3
+#define DEF_NVS_SIZE                    (NVS_TOTAL_LENGTH)
+
+#define RADIO_SM_WAIT_LOOP  32
+
+#define FREF_CLK_FREQ_MASK      0x7
+#define FREF_CLK_TYPE_MASK      BIT_3
+#define FREF_CLK_POLARITY_MASK  BIT_4
+
+#define FREF_CLK_TYPE_BITS      0xfffffe7f
+#define CLK_REQ_PRCM            0x100
+
+#define FREF_CLK_POLARITY_BITS  0xfffff8ff
+#define CLK_REQ_OUTN_SEL        0x700
+
+/* time to wait till we check if fw is running */
+#define STALL_TIMEOUT   10
+#define FIN_LOOP 10
+
+/************************************************************************
+ * Macros
+ ************************************************************************/
+
+#define SET_DEF_NVS(aNVS)     aNVS[0]=0x01; aNVS[1]=0x6d; aNVS[2]=0x54; aNVS[3]=0x56; aNVS[4]=0x34; \
+                              aNVS[5]=0x12; aNVS[6]=0x28; aNVS[7]=0x01; aNVS[8]=0x71; aNVS[9]=0x54; \
+                              aNVS[10]=0x00; aNVS[11]=0x08; aNVS[12]=0x00; aNVS[13]=0x00; aNVS[14]=0x00; \
+                              aNVS[15]=0x00; aNVS[16]=0x00; aNVS[17]=0x00; aNVS[18]=0x00; aNVS[19]=0x00; \
+                              aNVS[20]=0x00; aNVS[21]=0x00; aNVS[22]=0x00; aNVS[23]=0x00; aNVS[24]=eNVS_NON_FILE;\
+							  aNVS[25]=0x00; aNVS[26]=0x00; aNVS[27]=0x00;
+
+
+#define SET_PARTITION(pPartition,uAddr1,uMemSize1,uAddr2,uMemSize2,uAddr3,uMemSize3,uAddr4) \
+                    ((TPartition*)pPartition)[0].uMemAdrr = uAddr1; \
+                    ((TPartition*)pPartition)[0].uMemSize = uMemSize1; \
+                    ((TPartition*)pPartition)[1].uMemAdrr = uAddr2; \
+                    ((TPartition*)pPartition)[1].uMemSize = uMemSize2; \
+                    ((TPartition*)pPartition)[2].uMemAdrr = uAddr3; \
+                    ((TPartition*)pPartition)[2].uMemSize = uMemSize3; \
+                    ((TPartition*)pPartition)[3].uMemAdrr = uAddr4; 
+
+#define HW_INIT_PTXN_SET(pHwInit, pTxn)  pTxn = (TTxnStruct*)&(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].tTxnStruct);
+
+#define BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, uAddr, uVal, uSize, direction, fCB, hCB)     \
+                              HW_INIT_PTXN_SET(pHwInit, pTxn) \
+                              TXN_PARAM_SET_DIRECTION(pTxn, direction); \
+                              *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData)) = (TI_UINT32)uVal; \
+                              BUILD_TTxnStruct(pTxn, uAddr, pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData, uSize, fCB, hCB)
+
+#define BUILD_HW_INIT_FW_STATIC_TXN(pHwInit, pTxn, uAddr, fCB, hCB)     \
+                              HW_INIT_PTXN_SET(pHwInit, pTxn) \
+                              TXN_PARAM_SET_DIRECTION(pTxn, TXN_DIRECTION_READ); \
+                              BUILD_TTxnStruct(pTxn, uAddr, pHwInit->tFwStaticTxn.pFwStaticInfo, sizeof(FwStaticData_t), fCB, hCB)
+
+#define BUILD_HW_INIT_FW_DL_TXN(pHwInit, pTxn, uAddr, uVal, uSize, direction, fCB, hCB)     \
+                              HW_INIT_PTXN_SET(pHwInit, pTxn) \
+                              TXN_PARAM_SET_DIRECTION(pTxn, direction); \
+                              BUILD_TTxnStruct(pTxn, uAddr, uVal, uSize, fCB, hCB)
+
+
+#define SET_DRP_PARTITION(pPartition)\
+                        SET_PARTITION(pPartition, PARTITION_DRPW_MEM_ADDR, PARTITION_DRPW_MEM_SIZE, PARTITION_DRPW_REG_ADDR, PARTITION_DRPW_REG_SIZE, 0, 0, 0)
+
+#define SET_FW_LOAD_PARTITION(pPartition,uFwAddress)\
+                            SET_PARTITION(pPartition,uFwAddress,PARTITION_DOWN_MEM_SIZE, PARTITION_DOWN_REG_ADDR, PARTITION_DOWN_REG_SIZE,0,0,0)
+
+#define SET_WORK_PARTITION(pPartition)\
+                        SET_PARTITION(pPartition,PARTITION_WORK_MEM_ADDR1, PARTITION_WORK_MEM_SIZE1, PARTITION_WORK_MEM_ADDR2, PARTITION_WORK_MEM_SIZE2, PARTITION_WORK_MEM_ADDR3, PARTITION_WORK_MEM_SIZE3, PARTITION_WORK_MEM_ADDR4)
+
+/* Handle return status inside a state machine */
+#define EXCEPT(phwinit,status)                                   \
+    switch (status) {                                           \
+        case TI_OK:                                             \
+        case TXN_STATUS_OK:                                     \
+        case TXN_STATUS_COMPLETE:                               \
+             break;                                             \
+        case TXN_STATUS_PENDING:                                \
+             return TXN_STATUS_PENDING;                         \
+        default:                                                \
+             phwinit->DownloadStatus = TXN_STATUS_ERROR;        \
+             TWD_FinalizeOnFailure (phwinit->hTWD);             \
+             return TXN_STATUS_ERROR;                           \
+    }
+
+
+/* Handle return status inside an init sequence state machine  */
+#define EXCEPT_I(phwinit,status)                                \
+    switch (status) {                                           \
+        case TI_OK:                                             \
+        case TXN_STATUS_COMPLETE:                               \
+             break;                                             \
+        case TXN_STATUS_PENDING:                                \
+             phwinit->uInitSeqStatus = status;                  \
+             return TXN_STATUS_PENDING;                         \
+        default:                                                \
+             TWD_FinalizeOnFailure (phwinit->hTWD);             \
+             return TXN_STATUS_ERROR;                           \
+    }
+
+
+/* Handle return status inside a load image state machine */
+#define EXCEPT_L(phwinit,status)                                \
+    switch (status) {                                           \
+        case TXN_STATUS_OK:                                     \
+        case TXN_STATUS_COMPLETE:                               \
+             break;                                             \
+        case TXN_STATUS_PENDING:                                \
+             phwinit->DownloadStatus = status;                  \
+             return TXN_STATUS_PENDING;                         \
+        default:                                                \
+             phwinit->DownloadStatus = status;                  \
+             TWD_FinalizeOnFailure (phwinit->hTWD);             \
+             return TXN_STATUS_ERROR;                           \
+    }
+
+
+/************************************************************************
+ * Types
+ ************************************************************************/
+
+enum
+{
+    REF_FREQ_19_2                   = 0,
+    REF_FREQ_26_0                   = 1,
+    REF_FREQ_38_4                   = 2,
+    REF_FREQ_40_0                   = 3,
+    REF_FREQ_33_6                   = 4,
+    REF_FREQ_NUM                    = 5
+};
+
+enum
+{
+    LUT_PARAM_INTEGER_DIVIDER       = 0,
+    LUT_PARAM_FRACTIONAL_DIVIDER    = 1,
+    LUT_PARAM_ATTN_BB               = 2,
+    LUT_PARAM_ALPHA_BB              = 3,
+    LUT_PARAM_STOP_TIME_BB          = 4,
+    LUT_PARAM_BB_PLL_LOOP_FILTER    = 5,
+    LUT_PARAM_NUM                   = 6
+};
+
+typedef struct 
+{
+    TTxnStruct              tTxnStruct;
+    TI_UINT8                *pData; 
+
+} THwInitTxn;
+
+typedef struct 
+{
+    TTxnStruct              tTxnStruct;
+    TI_UINT8                *pFwStaticInfo; 
+
+} TFwStaticTxn;
+
+
+/* The HW Init module object */
+typedef struct 
+{
+    /* Handles */
+    TI_HANDLE               hOs;
+    TI_HANDLE               hReport;
+    TI_HANDLE               hTWD;
+    TI_HANDLE               hBusTxn;
+    TI_HANDLE               hTwIf;
+
+    TI_HANDLE 		    hFileInfo;	/* holds parameters of FW Image Portion - for DW Download */
+    TEndOfHwInitCb          fInitHwCb;
+
+    /* Firmware image ptr */
+    TI_UINT8               *pFwBuf;       
+    /* Firmware image length */
+    TI_UINT32               uFwLength;
+    TI_UINT32               uFwAddress;
+    TI_UINT32               bFwBufLast;  
+    TI_UINT32               uFwLastAddr;  
+    /* EEPROM image ptr */
+    TI_UINT8               *pEEPROMBuf;   
+    /* EEPROM image length */
+    TI_UINT32               uEEPROMLen;   
+
+    TI_UINT8               *pEEPROMCurPtr;
+    TI_UINT32               uEEPROMCurLen;
+    TBootAttr               tBootAttr;
+    TI_HANDLE               hHwCtrl;
+    ETxnStatus              DownloadStatus;
+    /* Upper module callback for the init stage */
+    fnotify_t               fCb;          
+    /* Upper module handle for the init stage */
+    TI_HANDLE               hCb;          
+    /* Init stage */
+    TI_UINT32               uInitStage;   
+    /* Reset statge */ 
+    TI_UINT32               uResetStage;  
+    /* EEPROM burst stage */
+    TI_UINT32               uEEPROMStage; 
+    /* Init state machine temporary data */
+    TI_UINT32               uInitData;    
+    /* ELP command image */
+    TI_UINT32               uElpCmd;      
+    /* Chip ID */
+    TI_UINT32               uChipId;      
+    /* Boot state machine temporary data */
+    TI_UINT32               uBootData;    
+    TI_UINT32               uSelfClearTime;
+    TI_UINT8                uEEPROMBurstLen;
+    TI_UINT8                uEEPROMBurstLoop;
+    TI_UINT32               uEEPROMRegAddr;
+    TI_STATUS               uEEPROMStatus;
+    TI_UINT32               uNVSStartAddr;
+    TI_UINT32               uNVSNumChar;
+    TI_UINT32               uNVSNumByte;
+    TI_STATUS               uNVSStatus;
+    TI_UINT32               uScrPad6;
+    TI_UINT32               uRefFreq; 
+    TI_UINT32               uInitSeqStage;
+    TI_STATUS               uInitSeqStatus;
+    TI_UINT32               uLoadStage;
+    TI_UINT32               uBlockReadNum;
+    TI_UINT32               uBlockWriteNum;
+    TI_UINT32               uPartitionLimit;
+    TI_UINT32               uFinStage;
+    TI_UINT32               uFinData;
+    TI_UINT32               uFinLoop; 
+    TI_UINT32               uRegStage;
+    TI_UINT32               uRegLoop;
+    TI_UINT32               uRegSeqStage;
+    TI_UINT32               uRegData;  
+    #ifndef _VLCT_   
+        TI_HANDLE               hStallTimer;
+    #endif
+
+    /* Top register Read/Write SM temporary data*/
+    TI_UINT32               uTopRegAddr;
+    TI_UINT32               uTopRegValue;
+    TI_UINT32               uTopRegMask;
+    TI_UINT32               uTopRegUpdateValue;
+    TI_UINT32               uTopStage;
+    TI_STATUS               uTopStatus;
+
+    TI_UINT8                *puFwTmpBuf;
+
+    TFinalizeCb             fFinalizeDownload;
+    TI_HANDLE               hFinalizeDownload;
+    /* Size of the Fw image, retrieved from the image itself */         
+    TI_UINT32               uFwDataLen; 
+    TI_UINT8                aDefaultNVS[DEF_NVS_SIZE];
+    TI_UINT8                uTxnIndex;
+    THwInitTxn              aHwInitTxn[MAX_HW_INIT_CONSECUTIVE_TXN];
+    TFwStaticTxn            tFwStaticTxn;
+
+    TI_UINT32               uSavedDataForWspiHdr;  /* For saving the 4 bytes before the NVS data for WSPI case 
+                                                        where they are overrun by the WSPI BusDrv */
+    TPartition              aPartition[NUM_OF_PARTITION];
+} THwInit;
+
+
+/************************************************************************
+ * Local Functions Prototypes
+ ************************************************************************/
+static void      hwInit_SetPartition                (THwInit   *pHwInit, 
+                                                     TPartition *pPartition);
+static TI_STATUS hwInit_BootSm                      (TI_HANDLE hHwInit);
+static TI_STATUS hwInit_ResetSm                     (TI_HANDLE hHwInit);
+static TI_STATUS hwInit_EepromlessStartBurstSm      (TI_HANDLE hHwInit);                                                   
+static TI_STATUS hwInit_LoadFwImageSm               (TI_HANDLE hHwInit);
+static TI_STATUS hwInit_FinalizeDownloadSm          (TI_HANDLE hHwInit);                                             
+static TI_STATUS hwInit_TopRegisterRead(TI_HANDLE hHwInit);
+static TI_STATUS hwInit_InitTopRegisterRead(TI_HANDLE hHwInit, TI_UINT32 uAddress);
+static TI_STATUS hwInit_TopRegisterWrite(TI_HANDLE hHwInit);
+static TI_STATUS hwInit_InitTopRegisterWrite(TI_HANDLE hHwInit, TI_UINT32 uAddress, TI_UINT32 uValue);
+#ifndef _VLCT_  
+    static void      hwInit_StallTimerCb                (TI_HANDLE hHwInit);
+#endif
+
+
+/*******************************************************************************
+*                       PUBLIC  FUNCTIONS  IMPLEMENTATION                      *
+********************************************************************************/
+
+
+/*************************************************************************
+*                        hwInit_Create                                   *
+**************************************************************************
+* DESCRIPTION:  This function initializes the HwInit module.
+*
+* INPUT:        hOs - handle to Os Abstraction Layer
+*               
+* RETURN:       Handle to the allocated HwInit module
+*************************************************************************/
+TI_HANDLE hwInit_Create (TI_HANDLE hOs)
+{
+    THwInit *pHwInit;
+    int i;
+
+    /* Allocate HwInit module */
+    pHwInit = os_memoryAlloc (hOs, sizeof(THwInit),MemoryNormal);
+
+    if (pHwInit == NULL)
+    {
+        WLAN_OS_REPORT(("Error allocating the HwInit Module\n"));
+        return NULL;
+    }
+
+    /* Reset HwInit module */
+    os_memoryZero (hOs, pHwInit, sizeof(THwInit));
+
+    /* Allocate Register buffer */
+    for (i = 0; i < MAX_HW_INIT_CONSECUTIVE_TXN; i++) 
+    {
+        pHwInit->aHwInitTxn[i].pData = os_memoryAlloc (hOs, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ,MemoryDMA);
+        if (pHwInit->aHwInitTxn[i].pData == NULL) 
+        {
+            return NULL;
+        }
+        os_memoryZero (hOs, pHwInit->aHwInitTxn[i].pData, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+        pHwInit->aHwInitTxn[i].pData += WSPI_PAD_LEN_READ;
+    }
+    
+    pHwInit->tFwStaticTxn.pFwStaticInfo = os_memoryAlloc (hOs, sizeof (FwStaticData_t) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pHwInit->tFwStaticTxn.pFwStaticInfo == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pHwInit->tFwStaticTxn.pFwStaticInfo, sizeof (FwStaticData_t) + WSPI_PAD_LEN_READ);
+    pHwInit->tFwStaticTxn.pFwStaticInfo += WSPI_PAD_LEN_READ;
+
+
+
+    pHwInit->puFwTmpBuf = os_memoryAlloc (hOs, WSPI_PAD_LEN_READ + MAX_SDIO_BLOCK,MemoryDMA);
+    if (pHwInit->puFwTmpBuf == NULL) 
+    {
+     return NULL;
+    }
+    os_memoryZero (hOs, pHwInit->puFwTmpBuf, WSPI_PAD_LEN_READ + MAX_SDIO_BLOCK);
+    pHwInit->puFwTmpBuf += WSPI_PAD_LEN_READ;
+
+    pHwInit->hOs = hOs;
+
+    return (TI_HANDLE)pHwInit;
+}
+
+
+/***************************************************************************
+*                           hwInit_Destroy                                 *
+****************************************************************************
+* DESCRIPTION:  This function unload the HwInit module. 
+*
+* INPUTS:       hHwInit - the object
+*
+* OUTPUT:
+*
+* RETURNS:      TI_OK - Unload succesfull
+*               TI_NOK - Unload unsuccesfull
+***************************************************************************/
+TI_STATUS hwInit_Destroy (TI_HANDLE hHwInit)
+{
+    THwInit *pHwInit = (THwInit *)hHwInit;
+    int i;
+
+    for (i = 0; i < MAX_HW_INIT_CONSECUTIVE_TXN; i++) 
+    {
+        if (pHwInit->aHwInitTxn[i].pData) 
+        {
+            os_memoryFree (pHwInit->hOs, pHwInit->aHwInitTxn[i].pData - WSPI_PAD_LEN_READ, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+        }
+    }
+
+    if (pHwInit->puFwTmpBuf) 
+     {
+
+         os_memoryFree (pHwInit->hOs, pHwInit->puFwTmpBuf - WSPI_PAD_LEN_READ, WSPI_PAD_LEN_READ + MAX_SDIO_BLOCK);
+     }
+
+    if (pHwInit->pEEPROMBuf) 
+     {
+         os_memoryFree (pHwInit->hOs, pHwInit->pEEPROMBuf, pHwInit->uEEPROMLen);
+     }
+
+    if (pHwInit->tFwStaticTxn.pFwStaticInfo)
+    {
+        os_memoryFree (pHwInit->hOs, pHwInit->tFwStaticTxn.pFwStaticInfo - WSPI_PAD_LEN_READ, sizeof (FwStaticData_t) + WSPI_PAD_LEN_READ);
+    }
+
+    #ifndef _VLCT_   
+        if (pHwInit->hStallTimer)
+        {
+            os_timerDestroy(pHwInit->hOs, pHwInit->hStallTimer);
+        }        
+    #endif
+
+    /* Free HwInit Module */
+    os_memoryFree (pHwInit->hOs, pHwInit, sizeof(THwInit));
+
+    return TI_OK;
+}
+
+
+/***************************************************************************
+*                           hwInit_Init                                    *
+****************************************************************************
+* DESCRIPTION:  This function configures the hwInit module
+*
+* RETURNS:      TI_OK - Configuration successful
+*               TI_NOK - Configuration unsuccessful
+***************************************************************************/
+TI_STATUS hwInit_Init (TI_HANDLE      hHwInit,
+                         TI_HANDLE      hReport,
+                         TI_HANDLE      hTWD,
+                         TI_HANDLE 	hFinalizeDownload, 
+			 TFinalizeCb    fFinalizeDownload, 
+                         TEndOfHwInitCb fInitHwCb)
+{
+    THwInit   *pHwInit = (THwInit *)hHwInit;
+    TTxnStruct* pTxn;
+
+    /* Configure modules handles */
+    pHwInit->hReport    = hReport;
+    pHwInit->hTWD       = hTWD;
+    pHwInit->hTwIf      = ((TTwd *)hTWD)->hTwIf;
+    pHwInit->hOs        = ((TTwd *)hTWD)->hOs;
+    pHwInit->fInitHwCb  = fInitHwCb;
+    pHwInit->fFinalizeDownload 	= fFinalizeDownload;
+    pHwInit->hFinalizeDownload 	= hFinalizeDownload;
+
+    SET_DEF_NVS(pHwInit->aDefaultNVS)
+
+    for (pHwInit->uTxnIndex=0;pHwInit->uTxnIndex<MAX_HW_INIT_CONSECUTIVE_TXN;pHwInit->uTxnIndex++)
+    {
+        HW_INIT_PTXN_SET(pHwInit, pTxn)
+        /* Setting write as default transaction */
+        TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    }
+
+    #ifndef _VLCT_   
+        pHwInit->hStallTimer = os_timerCreate (pHwInit->hOs, hwInit_StallTimerCb, hHwInit);
+        if (pHwInit->hStallTimer == NULL) 
+        {
+            return TI_NOK;
+        }
+    #endif
+
+    TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT, ".....HwInit configured successfully\n");
+    
+    return TI_OK;
+}
+
+
+TI_STATUS hwInit_SetNvsImage (TI_HANDLE hHwInit, TI_UINT8 *pbuf, TI_UINT32 length)
+{
+    THwInit   *pHwInit = (THwInit *)hHwInit;
+
+    if (length == 0) {
+        TRACE0 (pHwInit->hReport, REPORT_SEVERITY_WARNING,"NVS File Length iz zero");
+        pHwInit->pEEPROMBuf = NULL;
+        return TI_OK;
+    }
+    /* We need to guarantee that the NVS buffer will be DMA'ble (physically continous) */
+    pHwInit->pEEPROMBuf = os_memoryAlloc (pHwInit->hOs, length, MemoryDMA);
+
+    if (pHwInit->pEEPROMBuf == NULL) 
+    {
+        return TI_NOK;
+    }
+
+    os_memoryCopy(pHwInit->hOs, pHwInit->pEEPROMBuf, pbuf, length);
+
+    pHwInit->uEEPROMLen = length; 
+
+    return TI_OK;
+}
+
+
+TI_STATUS hwInit_SetFwImage (TI_HANDLE hHwInit, TFileInfo *pFileInfo)
+{
+    THwInit   *pHwInit = (THwInit *)hHwInit;
+
+    if ((hHwInit == NULL) || (pFileInfo == NULL))
+    {
+	return TI_NOK;
+    }
+
+    pHwInit->pFwBuf 	= pFileInfo->pBuffer;
+    pHwInit->uFwLength  = pFileInfo->uLength;
+    pHwInit->uFwAddress = pFileInfo->uAddress;
+    pHwInit->bFwBufLast = pFileInfo->bLast;
+
+    return TI_OK;
+}
+
+
+/** 
+ * \fn     hwInit_SetPartition
+ * \brief  Set HW addresses partition
+ * 
+ * Set the HW address ranges for download or working memory and registers access.
+ * Generate and configure the bus access address mapping table.
+ * The partition is split between register (fixed partition of 24KB size, exists in all modes), 
+ *     and memory (dynamically changed during init and gets constant value in run-time, 104KB size).
+ * The TwIf configures the memory mapping table on the device by issuing write transaction to 
+ *     table address (note that the TxnQ and bus driver see this as a regular transaction). 
+ * 
+ * \note In future versions, a specific bus may not support partitioning (as in wUART), 
+ *       In this case the HwInit module shall not call this function (will learn the bus 
+ *       configuration from the INI file).
+ *
+ * \param  pHwInit   - The module's object
+ * \param  uMemAddr  - The memory partition base address
+ * \param  uMemSize  - The memory partition size
+ * \param  uRegAddr  - The registers partition base address
+ * \param  uRegSize  - The register partition size
+ * \return void
+ * \sa     
+ */ 
+static void hwInit_SetPartition (THwInit   *pHwInit, 
+                                 TPartition *pPartition)
+{
+    TRACE7(pHwInit->hReport, REPORT_SEVERITY_INFORMATION, "hwInit_SetPartition: uMemAddr1=0x%x, MemSize1=0x%x uMemAddr2=0x%x, MemSize2=0x%x, uMemAddr3=0x%x, MemSize3=0x%x, uMemAddr4=0x%x, MemSize4=0x%x\n",pPartition[0].uMemAdrr, pPartition[0].uMemSize,pPartition[1].uMemAdrr, pPartition[1].uMemSize,pPartition[2].uMemAdrr, pPartition[2].uMemSize,pPartition[3].uMemAdrr );
+
+    /* Prepare partition Txn data and send to HW */
+    twIf_SetPartition (pHwInit->hTwIf,pPartition);
+}
+
+
+/****************************************************************************
+ *                      hwInit_Boot()
+ ****************************************************************************
+ * DESCRIPTION: Start HW init sequence which writes and reads some HW registers
+ *                  that are needed prior to FW download.
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS hwInit_Boot (TI_HANDLE hHwInit)
+{ 
+    THwInit      *pHwInit = (THwInit *)hHwInit;
+    TTwd         *pTWD = (TTwd *)pHwInit->hTWD;
+    TWlanParams  *pWlanParams = &DB_WLAN(pTWD->hCmdBld);
+    TBootAttr     tBootAttr;
+
+    tBootAttr.MacClock = pWlanParams->MacClock;
+    tBootAttr.ArmClock = pWlanParams->ArmClock;
+
+    /*
+     * Initialize the status of download to  pending 
+     * It will be set to TXN_STATUS_COMPLETE at the FinalizeDownload function 
+     */
+    pHwInit->DownloadStatus = TXN_STATUS_PENDING;
+
+    /* Call the boot sequence state machine */
+    pHwInit->uInitStage = 0;
+
+    os_memoryCopy (pHwInit->hOs, &pHwInit->tBootAttr, &tBootAttr, sizeof(TBootAttr));
+
+    hwInit_BootSm (hHwInit);
+
+    /*
+     * If it returns the status of the StartInstance only then we can here query for the download status 
+     * and then return the status up to the TNETW_Driver.
+     * This return value will go back up to the TNETW Driver layer so that the init from OS will know
+     * if to wait for the InitComplte or not in case of TXN_STATUS_ERROR.
+     * This value will always be pending since the SPI is ASYNC 
+     * and in SDIOa timer is set so it will be ASync also in anyway.
+     */
+    return pHwInit->DownloadStatus;
+}
+
+
+ /****************************************************************************
+ * DESCRIPTION: Firmware boot state machine
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK 
+ ****************************************************************************/
+static TI_STATUS hwInit_BootSm (TI_HANDLE hHwInit)
+{
+    THwInit    *pHwInit = (THwInit *)hHwInit;
+    TI_STATUS   status = 0;
+    TTxnStruct  *pTxn;
+    TI_UINT32   uData;
+    TTwd        *pTWD        = (TTwd *) pHwInit->hTWD;
+    IniFileGeneralParam  *pGenParams = &DB_GEN(pTWD->hCmdBld);
+    TI_UINT32   clkVal = 0x3;
+
+    switch (pHwInit->uInitStage)
+    {
+    case 0:
+        pHwInit->uInitStage++;
+        pHwInit->uTxnIndex = 0;
+        SET_WORK_PARTITION(pHwInit->aPartition)
+
+        /* Set the bus addresses partition to its "running" mode */
+        hwInit_SetPartition (pHwInit,pHwInit->aPartition);
+
+#ifdef _VLCT_
+         /* Set FW to test mode */    
+         BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, SCR_PAD8, 0xBABABABE, 
+                                REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+         twIf_Transact(pHwInit->hTwIf, pTxn);
+         pHwInit->uTxnIndex++;
+#endif
+
+        if (( 0 == (pGenParams->RefClk & FREF_CLK_FREQ_MASK)) || (2 == (pGenParams->RefClk & FREF_CLK_FREQ_MASK))
+             || (4 == (pGenParams->RefClk & FREF_CLK_FREQ_MASK)))
+        {/* ref clk: 19.2/38.4/38.4-XTAL */
+            clkVal = 0x3;
+        }
+        if ((1 == (pGenParams->RefClk & FREF_CLK_FREQ_MASK)) || (3 == (pGenParams->RefClk & FREF_CLK_FREQ_MASK)))
+        {/* ref clk: 26/52 */
+            clkVal = 0x5;
+        }
+
+        WLAN_OS_REPORT(("CHIP VERSION... set 1273 chip top registers\n"));
+
+        /* set the reference clock freq' to be used (pll_selinpfref field) */        
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, PLL_PARAMETERS, clkVal,
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+        twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        pHwInit->uTxnIndex++;
+
+        /* read the PAUSE value to highest threshold */        
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, PLL_PARAMETERS, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_BootSm, hHwInit)
+        status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        EXCEPT (pHwInit, status)
+
+    case 1:
+        pHwInit->uInitStage ++;
+        /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+        uData = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+        if (uData == 0xFFFFFFFF)                     
+        {            
+            TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "hwInit_BootSm: Failed to read PLL parameters\n");
+            pHwInit->DownloadStatus = TXN_STATUS_ERROR;
+            TWD_FinalizeOnFailure (pHwInit->hTWD);
+            return TXN_STATUS_ERROR;
+        }
+        else
+        {
+            uData &= ~(0x3ff);
+        }
+
+        /* Now we can zero the index */
+        pHwInit->uTxnIndex = 0;
+
+        /* set the the PAUSE value to highest threshold */        
+        uData |= WU_COUNTER_PAUSE_VAL;
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, WU_COUNTER_PAUSE, uData, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+        twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        pHwInit->uTxnIndex++;
+
+        /* Continue the ELP wake up sequence */
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, WELP_ARM_COMMAND, WELP_ARM_COMMAND_VAL, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+        twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        /* Wait 500uS */
+        os_StalluSec (pHwInit->hOs, 500);
+
+        SET_DRP_PARTITION(pHwInit->aPartition)
+        /* Set the bus addresses partition to DRPw registers region */
+        hwInit_SetPartition (pHwInit,pHwInit->aPartition);
+
+        pHwInit->uTxnIndex++;
+
+        /* Read-modify-write DRPW_SCRATCH_START register (see next state) to be used by DRPw FW. 
+           The RTRIM value will be added  by the FW before taking DRPw out of reset */
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, DRPW_SCRATCH_START, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ,(TTxnDoneCb)hwInit_BootSm, hHwInit)
+        status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        EXCEPT (pHwInit, status)
+
+    case 2:
+        pHwInit->uInitStage ++;
+
+        /* multiply fref value by 2, so that {0,1,2,3} values will become {0,2,4,6} */
+        /* Then, move it 4 places to the right, to alter Fref relevant bits in register 0x2c */
+        clkVal = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+        pHwInit->uTxnIndex = 0; /* Reset index only after getting the last read value! */
+        clkVal |= (pGenParams->RefClk << 1) << 4;
+        
+        /* Disable LPD mode */
+        clkVal &= 0xf9ffffff;
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, DRPW_SCRATCH_START, clkVal, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+        twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        pHwInit->uTxnIndex++;
+
+        SET_WORK_PARTITION(pHwInit->aPartition)
+        /* Set the bus addresses partition back to its "running" mode */
+        hwInit_SetPartition (pHwInit,pHwInit->aPartition);
+
+        /* 
+         * end of CHIP init seq.
+         */
+
+        /* Disable interrupts */
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, ACX_REG_INTERRUPT_MASK, ACX_INTR_ALL, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+        twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        pHwInit->uTxnIndex++;
+
+        /* Read the CHIP ID to get an indication that the bus is TI_OK */
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, CHIP_ID, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ,(TTxnDoneCb)hwInit_BootSm, hHwInit)
+        status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        EXCEPT (pHwInit, status)
+        
+    case 3:
+        pHwInit->uInitStage ++;
+         
+        /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+         pHwInit->uChipId = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+
+        /* This is only sanity check that the HW exists, we can continue and fail on FwLoad */
+		if (pHwInit->uChipId == CHIP_ID_1273_PG10)
+        {
+            WLAN_OS_REPORT(("Working on a 1273 PG 1.0 board.\n"));
+        }
+		else if (pHwInit->uChipId == CHIP_ID_1273_PG20)
+        {
+            WLAN_OS_REPORT(("Working on a 1273 PG 2.0 board.\n"));
+        }
+        else 
+        {
+            WLAN_OS_REPORT (("Error!! Found unknown Chip Id = 0x%x\n", pHwInit->uChipId));
+
+            /*
+             * NOTE: no exception because of forward compatibility
+             */
+        }
+    
+        /*
+         * Soft reset 
+         */
+        pHwInit->uResetStage = 0;
+        pHwInit->uSelfClearTime = 0;
+        pHwInit->uBootData = 0;
+        status = hwInit_ResetSm (pHwInit);    
+
+        EXCEPT (pHwInit, status)
+    
+    case 4:
+        pHwInit->uInitStage ++;
+
+        TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "TNET SOFT-RESET\n");
+
+        WLAN_OS_REPORT(("Starting to process NVS...\n"));
+
+        /*
+         * Start EEPROM/NVS burst
+         */
+
+        if (pHwInit->pEEPROMBuf) 
+        {
+            /* NVS file exists (EEPROM-less support) */
+            pHwInit->uEEPROMCurLen = pHwInit->uEEPROMLen;
+
+            TRACE2(pHwInit->hReport, REPORT_SEVERITY_INIT , "EEPROM Image addr=0x%x, EEPROM Len=0x0x%x\n", pHwInit->pEEPROMBuf, pHwInit->uEEPROMLen);
+            WLAN_OS_REPORT (("NVS found, EEPROM Image addr=0x%x, EEPROM Len=0x0x%x\n", 
+                              pHwInit->pEEPROMBuf, pHwInit->uEEPROMLen));
+        }
+        else
+        {
+            WLAN_OS_REPORT (("No Nvs, Setting default MAC address\n"));
+            pHwInit->uEEPROMCurLen = DEF_NVS_SIZE;
+            pHwInit->pEEPROMBuf = (TI_UINT8*)(&pHwInit->aDefaultNVS[0]);
+            WLAN_OS_REPORT (("pHwInit->uEEPROMCurLen: %x\n", pHwInit->uEEPROMCurLen));
+            WLAN_OS_REPORT (("ERROR: If you are not calibating the device, you will soon get errors !!!\n"));
+
+        }
+
+        pHwInit->pEEPROMCurPtr = pHwInit->pEEPROMBuf;
+        pHwInit->uEEPROMStage = 0;
+        status = hwInit_EepromlessStartBurstSm (hHwInit);
+
+        EXCEPT (pHwInit, status)
+        
+    case 5: 
+        pHwInit->uInitStage ++;
+        pHwInit->uTxnIndex = 0;
+
+        if (pHwInit->pEEPROMBuf) 
+        {
+            /* Signal FW that we are eeprom less */
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, ACX_EEPROMLESS_IND_REG, ACX_EEPROMLESS_IND_REG, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+            twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "DRIVER NVS BURST-READ\n");
+        }
+        else
+        {
+	    /* 1273 - EEPROM is not support by FPGA yet */ 
+            /*
+             * Start ACX EEPROM
+             */     
+            /*pHwInit->uRegister = START_EEPROM_MGR;
+            TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+            BUILD_TTxnStruct(pTxn, ACX_REG_EE_START, &pHwInit->uRegister, REGISTER_SIZE, 0, NULL, NULL)
+            twIf_Transact(pHwInit->hTwIf, pTxn);*/
+
+            /*
+             * The stall is needed so the EEPROM NVS burst read will complete
+             */     
+            os_StalluSec (pHwInit->hOs, 40000);
+
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, ACX_EEPROMLESS_IND_REG, USE_EEPROM, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+            twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "STARTING EEPROM NVS BURST-READ\n");
+        }
+
+        pHwInit->uTxnIndex++;
+
+        /* Read Chip ID */
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn,  CHIP_ID, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ,(TTxnDoneCb)hwInit_BootSm, hHwInit)
+        status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+        EXCEPT (pHwInit, status)
+
+    case 6:
+        pHwInit->uInitStage ++;
+        /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+        pHwInit->uBootData = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+        /* Now we can zero the index */
+        pHwInit->uTxnIndex = 0;
+
+        WLAN_OS_REPORT(("Chip ID is 0x%X.\n", pHwInit->uBootData));
+		
+        /* Read Scr2 to verify that the HW is ready */
+        BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, SCR_PAD2, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ,(TTxnDoneCb)hwInit_BootSm, hHwInit)
+        status = twIf_Transact(pHwInit->hTwIf, pTxn);
+        EXCEPT (pHwInit, status)
+
+    case 7:
+        pHwInit->uInitStage ++;        
+
+        /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+        pHwInit->uBootData = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+
+        if (pHwInit->uBootData == 0xffffffff)
+        {
+            TRACE0(pHwInit->hReport, REPORT_SEVERITY_FATAL_ERROR , "Error in SCR_PAD2 register\n");
+            EXCEPT (pHwInit, TXN_STATUS_ERROR)
+        }
+
+        /* Call the restart sequence */
+        pHwInit->uInitSeqStage = 0;
+        pHwInit->uInitSeqStatus = TXN_STATUS_COMPLETE;
+
+        EXCEPT (pHwInit, status)
+
+
+    case 8:
+        pHwInit->uInitStage++;
+        
+        if ((pGenParams->RefClk & FREF_CLK_TYPE_MASK) != 0x0)
+        {            
+            status = hwInit_InitTopRegisterRead(hHwInit, 0x448);            
+            EXCEPT (pHwInit, status)
+        }
+
+    case 9:
+        pHwInit->uInitStage++;
+
+        if ((pGenParams->RefClk & FREF_CLK_TYPE_MASK) != 0x0)
+        {            
+            pHwInit->uTopRegValue &= FREF_CLK_TYPE_BITS;
+            pHwInit->uTopRegValue |= CLK_REQ_PRCM;
+         
+            status =  hwInit_InitTopRegisterWrite( hHwInit, 0x448, pHwInit->uTopRegValue);
+            EXCEPT (pHwInit, status)
+        }
+
+    case 10:
+        pHwInit->uInitStage++; 
+
+        if ((pGenParams->RefClk & FREF_CLK_POLARITY_MASK) == 0x0)
+        {            
+            status = hwInit_InitTopRegisterRead(hHwInit, 0xCB2);            
+            EXCEPT (pHwInit, status)
+        }
+
+    case 11:
+        pHwInit->uInitStage++;        
+        if ((pGenParams->RefClk & FREF_CLK_POLARITY_MASK) == 0x0)
+        {            
+            pHwInit->uTopRegValue &= FREF_CLK_POLARITY_BITS;
+            pHwInit->uTopRegValue |= CLK_REQ_OUTN_SEL;            
+
+            status =  hwInit_InitTopRegisterWrite( hHwInit, 0xCB2, pHwInit->uTopRegValue);
+            EXCEPT (pHwInit, status)
+        }
+
+    case 12:
+        pHwInit->uInitStage = 0;
+        
+        /* Set the Download Status to COMPLETE */
+        pHwInit->DownloadStatus = TXN_STATUS_COMPLETE;
+
+        /* Call upper layer callback */
+        if (pHwInit->fInitHwCb)
+        {
+            (*pHwInit->fInitHwCb) (pHwInit->hTWD);
+        }
+
+        return TI_OK;
+    }
+
+    return TI_OK;
+}
+
+
+TI_STATUS hwInit_LoadFw (TI_HANDLE hHwInit)
+{
+    THwInit   *pHwInit = (THwInit *)hHwInit;
+    TI_STATUS  status;
+
+    /* check parameters */
+    if (hHwInit == NULL)
+    {
+        EXCEPT (pHwInit, TXN_STATUS_ERROR)
+    }
+
+    if (pHwInit->pFwBuf)
+    {
+        TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "CPU halt -> download code\n");
+
+        /* Load firmware image */ 
+        pHwInit->uLoadStage = 0;
+        status = hwInit_LoadFwImageSm (pHwInit);
+
+        switch (status)
+        {
+        case TI_OK:
+        case TXN_STATUS_OK:
+        case TXN_STATUS_COMPLETE:
+            WLAN_OS_REPORT (("Firmware successfully downloaded.\n"));
+            break;
+        case TXN_STATUS_PENDING:
+            WLAN_OS_REPORT (("Starting to download firmware...\n"));
+            break;
+        default:
+            TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "Firmware download failed!\n");
+            break;
+        }
+
+        EXCEPT (pHwInit, status);
+    }   
+    else
+    {
+        TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "Firmware not downloaded...\n");
+
+        EXCEPT (pHwInit, TXN_STATUS_ERROR)
+    }
+            
+    WLAN_OS_REPORT (("FW download OK...\n"));
+    return TI_OK;
+}                                                  
+    
+
+/****************************************************************************
+ *                      hwInit_FinalizeDownloadSm()
+ ****************************************************************************
+ * DESCRIPTION: Run the Hardware firmware
+ *              Wait for Init Complete
+ *              Configure the Bus Access with Addresses available on the scratch pad register 
+ *              Change the SDIO/SPI partitions to be able to see all the memory addresses
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: None
+ ****************************************************************************/
+static TI_STATUS hwInit_FinalizeDownloadSm (TI_HANDLE hHwInit)
+{
+    THwInit  *pHwInit = (THwInit *)hHwInit;
+    TTwd     *pTWD = (TTwd *)pHwInit->hTWD;
+    TI_STATUS status = TI_OK;
+    TI_UINT32   uIntVect;
+    TTxnStruct* pTxn;
+
+    while (TI_TRUE)
+    {
+        switch (pHwInit->uFinStage)
+        {
+        case 0:
+            pHwInit->uFinStage = 1;
+            pHwInit->uTxnIndex = 0;
+            /*
+             * Run the firmware (I) - Read current value from ECPU Control Reg.
+             */
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, ACX_REG_ECPU_CONTROL, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_FinalizeDownloadSm, hHwInit)
+            status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            EXCEPT (pHwInit, status)
+
+        case 1:
+            pHwInit->uFinStage ++;
+            /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+            pHwInit->uFinData = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+            /* Now we can zero the index */
+            pHwInit->uTxnIndex = 0;
+
+            /*
+             * Run the firmware (II) - Take HW out of reset (write ECPU_CONTROL_HALT to ECPU Control Reg.)
+             */
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, ACX_REG_ECPU_CONTROL, (pHwInit->uFinData | ECPU_CONTROL_HALT), 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+            twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            WLAN_OS_REPORT (("Firmware running.\n"));
+
+            /* 
+             * CHIP ID Debug
+             */     
+
+            pHwInit->uTxnIndex++;                  
+
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, CHIP_ID, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_FinalizeDownloadSm, hHwInit)
+            status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            EXCEPT (pHwInit, status)
+
+        case 2:
+            pHwInit->uFinStage ++;
+            pHwInit->uFinLoop = 0;
+
+            /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+            pHwInit->uFinData = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+                               
+            TRACE1(pHwInit->hReport, REPORT_SEVERITY_INIT , "CHIP ID IS %x\n", pHwInit->uFinData);
+
+            TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "Wait init complete\n");
+
+        case 3:
+            pHwInit->uTxnIndex = 0;
+
+            /* 
+             * Wait for init complete 
+             */
+            if (pHwInit->uFinLoop < FIN_LOOP)
+            {           
+                pHwInit->uFinStage = 4;
+
+                #ifdef _VLCT_
+                    os_StalluSec (pHwInit->hOs, 50);*/
+                #endif
+                
+                /* Read interrupt status register */
+                BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, ACX_REG_INTERRUPT_NO_CLEAR, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_FinalizeDownloadSm, hHwInit)
+                status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+                EXCEPT (pHwInit, status)
+            }
+            else
+			{
+				pHwInit->uFinStage = 5;
+			}                
+            continue;
+
+        case 4:
+            /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+            pHwInit->uFinData = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+            /* Now we can zero the index */
+            pHwInit->uTxnIndex = 0;
+            
+            if (pHwInit->uFinData == 0xffffffff) /* error */
+            {
+                TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "Error reading hardware complete init indication\n");
+
+                pHwInit->DownloadStatus = TXN_STATUS_ERROR;
+                EXCEPT (pHwInit, TXN_STATUS_ERROR)
+            }
+
+            if (IS_MASK_ON (pHwInit->uFinData, ACX_INTR_INIT_COMPLETE))
+            {
+                pHwInit->uFinStage = 5;
+
+                /* Interrupt ACK */
+                BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, ACX_REG_INTERRUPT_ACK, ACX_INTR_INIT_COMPLETE, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+                twIf_Transact(pHwInit->hTwIf, pTxn);
+
+                break;
+            }
+            else
+            {
+                pHwInit->uFinStage = 3;
+                pHwInit->uFinLoop ++;
+
+                #ifndef _VLCT_                
+                    os_timerStart (pHwInit->hOs, pHwInit->hStallTimer, STALL_TIMEOUT);
+                    return TI_PENDING;
+                #endif
+            }
+            #ifdef _VLCT_     
+                continue;
+            #endif
+
+        case 5:  
+            pHwInit->uFinStage++;
+
+            if (pHwInit->uFinLoop >= FIN_LOOP)
+            {
+                TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "Timeout waiting for the hardware to complete initialization\n");
+
+                pHwInit->DownloadStatus = TXN_STATUS_ERROR;
+                EXCEPT (pHwInit, TXN_STATUS_ERROR);
+            }
+        
+            TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "Firmware init complete...\n");
+
+            /* 
+             * There are valid addresses of the command and event mailbox 
+             * on the scratch pad registers 
+             */
+            /* Hardware config command mail box */
+            status = cmdMbox_ConfigHw (pTWD->hCmdMbox,
+                                       (fnotify_t)hwInit_FinalizeDownloadSm, 
+                                       hHwInit);
+            EXCEPT (pHwInit, status)
+            
+        case 6:  
+            pHwInit->uFinStage++;
+
+            /* Hardware config event mail box */
+            status = eventMbox_InitMboxAddr (pTWD->hEventMbox,
+                                         (fnotify_t)hwInit_FinalizeDownloadSm, 
+                                         hHwInit);
+            EXCEPT (pHwInit, status);
+            
+        case 7: 
+            pHwInit->uFinStage++;
+            pHwInit->uTxnIndex = 0;
+
+            SET_WORK_PARTITION(pHwInit->aPartition)
+            /* Set the bus addresses partition to its "running" mode */
+            hwInit_SetPartition (pHwInit,pHwInit->aPartition);
+
+            /* 
+             * In case of full asynchronous mode the firmware event must be ready 
+             * to receive event from the command mailbox
+             */
+
+            uIntVect = fwEvent_GetInitMask (pTWD->hFwEvent);
+
+                /* Clearing all the interrupt status register sources */
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, ACX_REG_INTERRUPT_MASK, (~uIntVect), 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+            twIf_Transact(pHwInit->hTwIf, pTxn);
+
+
+            pHwInit->uTxnIndex++;
+
+            BUILD_HW_INIT_FW_STATIC_TXN(pHwInit, pTxn, cmdMbox_GetMboxAddress (pTWD->hCmdMbox),
+                                        (TTxnDoneCb)hwInit_FinalizeDownloadSm, hHwInit)
+            status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            EXCEPT (pHwInit, status);
+            continue;
+
+        case 8:
+            
+            pHwInit->uFinStage = 0;
+
+            cmdBld_FinalizeDownload (pTWD->hCmdBld, &pHwInit->tBootAttr, (FwStaticData_t *)(pHwInit->tFwStaticTxn.pFwStaticInfo));
+
+            /* Set the Download Status to COMPLETE */
+            pHwInit->DownloadStatus = TXN_STATUS_COMPLETE;
+
+            return TXN_STATUS_COMPLETE;
+
+        } /* End switch */
+
+    } /* End while */
+
+}
+
+
+/****************************************************************************
+ *                      hwInit_ResetSm()
+ ****************************************************************************
+ * DESCRIPTION: Reset hardware state machine
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+static TI_STATUS hwInit_ResetSm (TI_HANDLE hHwInit)
+{
+    THwInit *pHwInit = (THwInit *)hHwInit;
+    TI_STATUS status = TI_OK;
+    TTxnStruct* pTxn;
+
+    pHwInit->uTxnIndex = 0;
+
+        /* Disable Rx/Tx */
+    BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, REG_ENABLE_TX_RX, 0x0, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+    twIf_Transact(pHwInit->hTwIf, pTxn);
+
+    pHwInit->uTxnIndex++;
+
+        /* Disable auto calibration on start */
+    BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, SPARE_A2, 0xFFFF, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE,(TTxnDoneCb)hwInit_BootSm, hHwInit)
+    status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+    return status;
+}
+
+
+/****************************************************************************
+ *                      hwInit_EepromlessStartBurstSm()
+ ****************************************************************************
+ * DESCRIPTION: prepare eepromless configuration before boot
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+static TI_STATUS hwInit_EepromlessStartBurstSm (TI_HANDLE hHwInit)
+{
+    THwInit   *pHwInit = (THwInit *)hHwInit;
+    TI_STATUS  status = TI_OK;
+    TI_UINT8   *uAddr;
+    TI_UINT32  uDeltaLength;
+    TTxnStruct* pTxn;
+
+    pHwInit->uTxnIndex = 0;
+
+    while (TI_TRUE)
+    {
+        switch (pHwInit->uEEPROMStage)
+        {
+        /* 
+         * Stages 0, 1 handles the eeprom format parameters: 
+         * ------------------------------------------------
+         * Length  - 8bit       --> The length is counted in 32bit words
+         * Address - 16bit
+         * Data    - (Length * 4) bytes
+         * 
+         * Note: The nvs is in big endian format and we need to change it to little endian
+         */
+        case 0: 
+            /* Check if address LSB = 1 --> Register address */
+            if ((pHwInit->uEEPROMRegAddr = pHwInit->pEEPROMCurPtr[1]) & 1)
+            {
+                /* Mask the register's address LSB before writing to it */
+                pHwInit->uEEPROMRegAddr &= 0xfe;
+                /* Change the address's endian */
+                pHwInit->uEEPROMRegAddr |= (TI_UINT32)pHwInit->pEEPROMCurPtr[2] << 8;
+                /* Length of burst data */
+                pHwInit->uEEPROMBurstLen = pHwInit->pEEPROMCurPtr[0];
+                pHwInit->pEEPROMCurPtr += 3;
+                pHwInit->uEEPROMBurstLoop = 0; 
+                /* 
+                 * We've finished reading the burst information.
+                 * Go to stage 1 in order to write it 
+                 */
+                pHwInit->uEEPROMStage = 1;
+            }
+            /* If address LSB = 0 --> We're not in the burst section */
+            else
+            {
+                /* End of Burst transaction: we should see 7 zeroed bytes */
+                if (pHwInit->pEEPROMCurPtr[0] == 0)
+                {
+                    pHwInit->pEEPROMCurPtr += 7;
+                }
+                pHwInit->uEEPROMCurLen -= (pHwInit->pEEPROMCurPtr - pHwInit->pEEPROMBuf + 1);
+                pHwInit->uEEPROMCurLen = (pHwInit->uEEPROMCurLen + NVS_DATA_BUNDARY_ALIGNMENT - 1) & 0xfffffffc;
+                /* End of Burst transaction, go to TLV section */
+                pHwInit->uEEPROMStage = 2;
+            }
+            continue;            
+
+        case 1: 
+            if (pHwInit->uEEPROMBurstLoop < pHwInit->uEEPROMBurstLen)
+            {
+                /* Change the data's endian */
+                TI_UINT32 val = (pHwInit->pEEPROMCurPtr[0] | 
+                                (pHwInit->pEEPROMCurPtr[1] << 8) | 
+                                (pHwInit->pEEPROMCurPtr[2] << 16) | 
+                                (pHwInit->pEEPROMCurPtr[3] << 24));
+
+                TRACE2(pHwInit->hReport, REPORT_SEVERITY_INIT , "NVS::BurstRead: *(%08x) = %x\n", pHwInit->uEEPROMRegAddr, val);
+
+                BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, (REGISTERS_BASE+pHwInit->uEEPROMRegAddr), val, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, (TTxnDoneCb)hwInit_EepromlessStartBurstSm, hHwInit)
+                status = twIf_Transact(pHwInit->hTwIf, pTxn);
+ 
+                pHwInit->uEEPROMStatus = status;
+                pHwInit->uEEPROMRegAddr += WORD_SIZE;
+                pHwInit->pEEPROMCurPtr +=  WORD_SIZE;
+                /* While not end of burst, we stay in stage 1 */
+                pHwInit->uEEPROMStage = 1;
+                pHwInit->uEEPROMBurstLoop ++;
+
+                EXCEPT (pHwInit, status);
+            }
+            else
+            {
+                /* If end of burst return to stage 0 to read the next one */
+                pHwInit->uEEPROMStage = 0;
+            }
+             
+            continue;
+
+        case 2:
+
+
+            pHwInit->uEEPROMStage = 3;
+    
+            SET_WORK_PARTITION(pHwInit->aPartition)
+            /* Set the bus addresses partition to its "running" mode */
+            hwInit_SetPartition (pHwInit,pHwInit->aPartition);
+            continue;
+ 
+        case 3:
+            TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "Reached TLV section\n");
+
+            /* Align the host address */
+            if (((TI_UINT32)pHwInit->pEEPROMCurPtr & WORD_ALIGNMENT_MASK) && (pHwInit->uEEPROMCurLen > 0) )
+            {
+                uAddr = (TI_UINT8*)(((TI_UINT32)pHwInit->pEEPROMCurPtr & 0xFFFFFFFC)+WORD_SIZE);
+                uDeltaLength = uAddr - pHwInit->pEEPROMCurPtr + 1;
+
+                pHwInit->pEEPROMCurPtr = uAddr;
+                pHwInit->uEEPROMCurLen-= uDeltaLength;
+            }
+
+            TRACE2(pHwInit->hReport, REPORT_SEVERITY_INIT , "NVS::WriteTLV: pEEPROMCurPtr= %x, Length=%d\n", pHwInit->pEEPROMCurPtr, pHwInit->uEEPROMCurLen);
+
+            if (pHwInit->uEEPROMCurLen)
+            {
+                /* Save the 4 bytes before the NVS data for WSPI case where they are overrun by the WSPI BusDrv */
+                pHwInit->uSavedDataForWspiHdr = *(TI_UINT32 *)(pHwInit->pEEPROMCurPtr - WSPI_PAD_LEN_WRITE);
+
+                /* Prepare the Txn structure for the NVS transaction to the CMD_MBOX */
+                HW_INIT_PTXN_SET(pHwInit, pTxn)
+                TXN_PARAM_SET_DIRECTION(pTxn, TXN_DIRECTION_WRITE);
+                BUILD_TTxnStruct(pTxn, CMD_MBOX_ADDRESS, pHwInit->pEEPROMCurPtr, pHwInit->uEEPROMCurLen, 
+                                 (TTxnDoneCb)hwInit_EepromlessStartBurstSm, hHwInit)
+
+                /* Transact the NVS data to the CMD_MBOX */
+                status = twIf_Transact(pHwInit->hTwIf, pTxn);
+                
+                pHwInit->uEEPROMCurLen = 0;
+                pHwInit->uNVSStatus = status;
+
+                EXCEPT (pHwInit, status); 
+            }
+            else
+            {
+                /* Restore the 4 bytes before the NVS data for WSPI case were they are overrun by the WSPI BusDrv */
+                *(TI_UINT32 *)(pHwInit->pEEPROMCurPtr - WSPI_PAD_LEN_WRITE) = pHwInit->uSavedDataForWspiHdr;
+
+                /* Call the upper level state machine */
+                if (pHwInit->uEEPROMStatus == TXN_STATUS_PENDING || 
+                    pHwInit->uNVSStatus == TXN_STATUS_PENDING)
+                {
+                    hwInit_BootSm (hHwInit);
+                }
+
+                return TXN_STATUS_COMPLETE;
+            }
+        } /* End switch */
+ 
+    } /* End while */
+}
+
+/****************************************************************************
+ *                      hwInit_LoadFwImageSm()
+ ****************************************************************************
+ * DESCRIPTION: Load image from the host and download into the hardware 
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+
+
+#define ADDRESS_SIZE		(sizeof(TI_INT32))
+
+static TI_STATUS hwInit_LoadFwImageSm (TI_HANDLE hHwInit)
+{
+    THwInit *pHwInit 			= (THwInit *)hHwInit;
+    TI_STATUS status 			= TI_OK;
+	ETxnStatus	TxnStatus;
+	TI_UINT32 uMaxPartitionSize	= PARTITION_DOWN_MEM_SIZE;
+    TTxnStruct* pTxn;
+
+    pHwInit->uTxnIndex = 0;
+
+    while (TI_TRUE)
+    {
+        switch (pHwInit->uLoadStage)
+        {
+		case 0:
+            pHwInit->uLoadStage = 1; 
+
+			/* Check the Downloaded FW alignment */
+			if ((pHwInit->uFwLength % ADDRESS_SIZE) != 0)
+			{
+                TRACE1(pHwInit->hReport, REPORT_SEVERITY_ERROR , "Length of downloaded Portion (%d) is not aligned\n",pHwInit->uFwLength);
+				EXCEPT_L (pHwInit, TXN_STATUS_ERROR);
+			}
+
+            TRACE2(pHwInit->hReport, REPORT_SEVERITY_INIT , "Image addr=0x%x, Len=0x%x\n", pHwInit->pFwBuf, pHwInit->uFwLength);
+
+            SET_FW_LOAD_PARTITION(pHwInit->aPartition,pHwInit->uFwAddress)
+			/* Set bus memory partition to current download area */
+            hwInit_SetPartition (pHwInit,pHwInit->aPartition);
+            status = TI_OK;
+			break;
+
+        case 1:
+
+			pHwInit->uLoadStage = 2;
+			/* if initial size is smaller than MAX_SDIO_BLOCK - go strait to stage 4 to write partial block */
+			if (pHwInit->uFwLength < MAX_SDIO_BLOCK)
+			{
+				pHwInit->uLoadStage = 4; 
+			}
+
+			pHwInit->uBlockReadNum 		= 0;
+			pHwInit->uBlockWriteNum 	= 0;
+			pHwInit->uPartitionLimit 	= pHwInit->uFwAddress + uMaxPartitionSize;
+
+            break;
+                    
+        case 2:
+
+            /* Load firmware by blocks */
+ 			if (pHwInit->uBlockReadNum < (pHwInit->uFwLength / MAX_SDIO_BLOCK))
+            {            
+                pHwInit->uLoadStage = 3;
+
+                /* Change partition */
+				/* The +2 is for the last block and the block remainder */  
+				if ( ((pHwInit->uBlockWriteNum + 2) * MAX_SDIO_BLOCK + pHwInit->uFwAddress) > pHwInit->uPartitionLimit)
+                {                					
+					pHwInit->uFwAddress += pHwInit->uBlockWriteNum * MAX_SDIO_BLOCK;
+					/* update uPartitionLimit */
+					pHwInit->uPartitionLimit = pHwInit->uFwAddress + uMaxPartitionSize;
+                    SET_FW_LOAD_PARTITION(pHwInit->aPartition,pHwInit->uFwAddress)
+                    /* Set bus memory partition to current download area */
+                    hwInit_SetPartition (pHwInit,pHwInit->aPartition);
+                    TxnStatus = TXN_STATUS_OK;
+					pHwInit->uBlockWriteNum = 0;
+                    TRACE1(pHwInit->hReport, REPORT_SEVERITY_INIT , "Change partition to address offset = 0x%x\n", 									   pHwInit->uFwAddress + pHwInit->uBlockWriteNum * MAX_SDIO_BLOCK);
+                    EXCEPT_L (pHwInit, TxnStatus);                                                     
+                }
+            }
+            else
+            {
+                pHwInit->uLoadStage = 4;
+                TRACE0(pHwInit->hReport, REPORT_SEVERITY_INIT , "Load firmware with Portions\n");
+            }
+            break;
+
+        case 3:        
+            pHwInit->uLoadStage = 2;
+
+            pHwInit->uTxnIndex = 0;
+
+            /* Copy image block to temporary buffer */
+            
+            os_memoryCopy (pHwInit->hOs,
+                           (void *)pHwInit->puFwTmpBuf,
+						   (void *)(pHwInit->pFwBuf + pHwInit->uBlockReadNum * MAX_SDIO_BLOCK),
+						   MAX_SDIO_BLOCK);
+
+            /* Load the block. Save WSPI_PAD_LEN_WRITE space for WSPI bus command */
+             BUILD_HW_INIT_FW_DL_TXN(pHwInit, pTxn, (pHwInit->uFwAddress + pHwInit->uBlockWriteNum * MAX_SDIO_BLOCK),
+                                     pHwInit->puFwTmpBuf, MAX_SDIO_BLOCK, TXN_DIRECTION_WRITE,
+                                     (TTxnDoneCb)hwInit_LoadFwImageSm, hHwInit)
+            TxnStatus = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            /* Log ERROR if the transaction returned ERROR */
+            if (TxnStatus == TXN_STATUS_ERROR)
+            {
+                TRACE1(pHwInit->hReport, REPORT_SEVERITY_ERROR , "hwInit_LoadFwImageSm: twIf_Transact retruned status=0x%x\n", TxnStatus);
+            } 
+
+			pHwInit->uBlockWriteNum ++;
+			pHwInit->uBlockReadNum ++;
+            EXCEPT_L (pHwInit, TxnStatus);
+            break;
+
+        case 4:    
+			pHwInit->uLoadStage 	= 5;
+
+            pHwInit->uTxnIndex = 0;
+
+			/* If No Last block to write */
+			if ( pHwInit->uFwLength % MAX_SDIO_BLOCK == 0 )
+			{
+				break;
+			}
+
+
+            /* Copy the last image block */
+            
+            os_memoryCopy (pHwInit->hOs,
+                           (void *)pHwInit->puFwTmpBuf,
+						   (void *)(pHwInit->pFwBuf + pHwInit->uBlockReadNum * MAX_SDIO_BLOCK),
+						   pHwInit->uFwLength % MAX_SDIO_BLOCK);
+
+            /* Load the last block */
+             BUILD_HW_INIT_FW_DL_TXN(pHwInit, pTxn, (pHwInit->uFwAddress + pHwInit->uBlockWriteNum * MAX_SDIO_BLOCK),
+                                     pHwInit->puFwTmpBuf, (pHwInit->uFwLength % MAX_SDIO_BLOCK), TXN_DIRECTION_WRITE,
+                                     (TTxnDoneCb)hwInit_LoadFwImageSm, hHwInit)
+            TxnStatus = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            if (TxnStatus == TXN_STATUS_ERROR)
+			{
+                TRACE1(pHwInit->hReport, REPORT_SEVERITY_ERROR , "hwInit_LoadFwImageSm: last block retruned status=0x%x\n", TxnStatus);
+			}
+
+            EXCEPT_L (pHwInit, TxnStatus);
+            break;
+
+        case 5:
+            pHwInit->uLoadStage = 0;
+
+			/*If end of overall FW Download Process: Finalize download (run firmware)*/
+			if ( pHwInit->bFwBufLast == TI_TRUE )
+			{			
+				/* The download has completed */ 
+				WLAN_OS_REPORT (("Finished downloading firmware.\n"));
+				status = hwInit_FinalizeDownloadSm (hHwInit);
+			}
+			/* Have to wait to more FW Portions */
+			else
+			{
+				/* Call the upper layer callback */
+				if ( pHwInit->fFinalizeDownload != NULL )
+				{
+					(pHwInit->fFinalizeDownload) (pHwInit->hFinalizeDownload);
+				}
+
+				status = TI_OK;
+			}
+            return status;
+
+        } /* End switch */
+
+    } /* End while */
+
+} /* hwInit_LoadFwImageSm() */
+
+#define READ_TOP_REG_LOOP  32
+
+/****************************************************************************
+ *                      hwInit_ReadRadioParamsSm ()
+ ****************************************************************************
+ * DESCRIPTION: hwInit_ReadRadioParamsSm 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS hwInit_ReadRadioParamsSm (TI_HANDLE hHwInit)
+{ 
+    THwInit      *pHwInit = (THwInit *)hHwInit;
+    TTwd         *pTWD = (TTwd *)pHwInit->hTWD;
+   IniFileGeneralParam *pGenParams = &DB_GEN(pTWD->hCmdBld);
+    TI_UINT32  val= 0, value;
+    TI_UINT32  add = FUNC7_SEL;
+	TI_UINT32  retAddress;
+    TTxnStruct  *pTxn;
+    TI_STATUS   status = 0;
+    
+    while (TI_TRUE)
+    {
+        switch (pHwInit->uRegStage)
+        {
+        case 0:
+            pHwInit->uRegStage = 1;
+            pHwInit->uTxnIndex++;
+
+            /*
+             * Select GPIO over Debug for BT_FUNC7 clear bit 17
+             */
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, GPIO_SELECT, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_ReadRadioParamsSm, hHwInit)
+            status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            EXCEPT (pHwInit, status)
+
+        case 1:
+            pHwInit->uRegStage ++;
+            pHwInit->uRegLoop = 0;
+
+            /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+            val = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));                
+            val &= 0xFFFDFFFF; /*clear bit 17*/
+            /* Now we can zero the index */
+            pHwInit->uTxnIndex = 0;
+
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, GPIO_SELECT, val, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+
+            twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            pHwInit->uTxnIndex++; 
+
+            pHwInit->uRegData = FUNC7_SEL;
+
+            continue;
+
+        case 2:
+            pHwInit->uRegStage ++;
+            add = pHwInit->uRegData;
+
+            /* Select GPIO over Debug for BT_FUNC7*/
+            retAddress = (TI_UINT32)(add / 2);
+	        val = (retAddress & 0x7FF);
+        	val |= BIT_16 | BIT_17;
+
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_CTR, val, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+            twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            pHwInit->uTxnIndex++;  
+
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_CMD, 0x2, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+            twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            continue;
+
+        case 3:
+            pHwInit->uRegStage ++;
+            pHwInit->uTxnIndex++; 
+
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_DATA_RD, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_ReadRadioParamsSm, hHwInit)
+            status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            EXCEPT (pHwInit, status)
+
+           
+        case 4:
+            val = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+            pHwInit->uTxnIndex = 0;
+            if (val & BIT_18)
+            {
+              if ((val & BIT_16) && (!(val & BIT_17)))
+              {
+                  pHwInit->uRegStage ++;
+                  pHwInit->uRegLoop = 0;
+
+              }
+              else 
+              {
+                TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "hwInit_ReadRadioParamsSm: can't writing bt_func7_sel\n");
+                TWD_FinalizeFEMRead(pHwInit->hTWD);
+
+                return TI_NOK;
+              }
+            }
+            else
+            {
+              if (pHwInit->uRegLoop < READ_TOP_REG_LOOP)
+              {
+                 pHwInit->uRegStage = 3;
+                 pHwInit->uRegLoop++;
+              }
+              else 
+              {
+
+                TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "Timeout waiting for writing bt_func7_sel\n");
+                TWD_FinalizeFEMRead(pHwInit->hTWD);
+
+                return TI_NOK;
+
+              }
+            }
+
+            continue;
+
+        case 5:
+               
+               pHwInit->uRegStage ++;
+               add = pHwInit->uRegData;
+               retAddress = (TI_UINT32)(add / 2);
+	       value = (retAddress & 0x7FF);
+               value |= BIT_16 | BIT_17;
+
+               BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_CTR, value, 
+                                  REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+               twIf_Transact(pHwInit->hTwIf, pTxn);
+
+               pHwInit->uTxnIndex++;  
+
+              if (pHwInit->uRegSeqStage == 0)
+              {
+                  if (pHwInit->uRegData == FUNC7_SEL)
+                    value = (val | 0x600);
+                  else
+                    value = (val | 0x1000);
+              }
+              else
+              {
+                  if (pHwInit->uRegData == FUNC7_SEL)
+                    value = (val & 0xF8FF);
+                  else
+                    value = (val & 0xCFFF);
+
+              }
+
+	      value &= 0xFFFF;
+          
+               BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_WDATA, value, 
+                                  REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+               twIf_Transact(pHwInit->hTwIf, pTxn);
+
+               pHwInit->uTxnIndex++; 
+
+               BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_CMD, 0x1, 
+                                  REGISTER_SIZE, TXN_DIRECTION_WRITE, (TTxnDoneCb)hwInit_ReadRadioParamsSm, hHwInit)
+               status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+               pHwInit->uTxnIndex++; 
+
+               if ((pHwInit->uRegData == FUNC7_SEL)&& (pHwInit->uRegSeqStage == 0))
+               {
+                 pHwInit->uRegData = FUNC7_PULL;
+                 pHwInit->uRegStage = 2;
+               }
+               else
+               {
+                  if ((pHwInit->uRegData == FUNC7_PULL)&& (pHwInit->uRegSeqStage == 1))
+                   {
+                     pHwInit->uRegData = FUNC7_SEL;
+                     pHwInit->uRegStage = 2;
+                   }
+               }
+
+               EXCEPT (pHwInit, status)              
+               continue;
+
+        case 6:
+
+              if (pHwInit->uRegSeqStage == 1)
+              {
+                  pHwInit->uRegStage = 8;
+              }
+              else
+              {
+                pHwInit->uRegStage ++;
+                pHwInit->uTxnIndex++; 
+
+                BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, GPIO_OE_RADIO, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_ReadRadioParamsSm, hHwInit)
+                status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+                EXCEPT (pHwInit, status)
+              }
+              continue;
+
+        case 7:
+            
+            pHwInit->uRegStage ++;
+
+            /* We don't zero pHwInit->uTxnIndex at the begining because we need it's value to the next transaction */
+            val = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));                
+            val |= 0x00020000;
+
+            pHwInit->uTxnIndex = 0; 
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, GPIO_OE_RADIO, val, 
+                               REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+            twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            pHwInit->uTxnIndex++;  
+
+            BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, GPIO_IN, 0, 
+                               REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_ReadRadioParamsSm, hHwInit)
+            status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+            EXCEPT (pHwInit, status)
+
+            
+        case 8:
+            
+             if (pHwInit->uRegSeqStage == 0)
+             {
+	       val = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));                  
+	       val &= 0x20000;
+	       if(val)
+	      {
+		   pGenParams->TXBiPFEMManufacturer = FEM_TRIQUINT_TYPE_E;
+	      }
+	      else
+	      {
+	  	   pGenParams->TXBiPFEMManufacturer = FEM_RFMD_TYPE_E;
+	      }
+               WLAN_OS_REPORT (("hwInit_ReadRadioParamsSm FEM Type %d \n",pGenParams->TXBiPFEMManufacturer));
+			   pHwInit->uTxnIndex = 0;
+               pHwInit->uRegSeqStage = 1;
+               pHwInit->uRegStage = 2;
+               pHwInit->uRegData = FUNC7_PULL;
+               continue;
+             }
+             else
+             {
+              
+			  WLAN_OS_REPORT (("hwInit_ReadRadioParamsSm Ended Successfully\n"));
+
+              TWD_FinalizeFEMRead(pHwInit->hTWD);
+
+                return TI_OK;
+
+             }
+
+        } /* End switch */
+
+    } /* End while */
+
+}
+
+
+/****************************************************************************
+ *                      hwInit_ReadRadioParams()
+ ****************************************************************************
+ * DESCRIPTION: hwInit_ReadRadioParamsSm 
+ * initalizie hwInit_ReadRadioParamsSm parmaeters
+  ****************************************************************************/
+   
+TI_STATUS hwInit_ReadRadioParams (TI_HANDLE hHwInit)
+{
+  THwInit      *pHwInit = (THwInit *)hHwInit;
+
+  pHwInit->uRegStage = 0;
+  pHwInit->uRegSeqStage = 0;
+ 
+  return hwInit_ReadRadioParamsSm (hHwInit);
+}
+
+/****************************************************************************
+ *                      hwInit_InitPoalrity()
+ ****************************************************************************
+ * DESCRIPTION: hwInit_ReadRadioParamsSm 
+ * initalizie hwInit_ReadRadioParamsSm parmaeters
+  ****************************************************************************/
+   
+TI_STATUS hwInit_InitPolarity(TI_HANDLE hHwInit)
+{
+  THwInit      *pHwInit = (THwInit *)hHwInit;
+
+  pHwInit->uRegStage = 0;
+  pHwInit->uRegSeqStage = 0;
+ 
+  return hwInit_WriteIRQPolarity (hHwInit);
+}
+
+
+
+/****************************************************************************
+ *                      hwInit_WriteIRQPolarity ()
+ ****************************************************************************
+ * DESCRIPTION: hwInit_WriteIRQPolarity
+  * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+ TI_STATUS hwInit_WriteIRQPolarity(TI_HANDLE hHwInit)
+ {
+     THwInit      *pHwInit = (THwInit *)hHwInit;
+     TI_UINT32    Address = 0,val = 0,value = 0;
+     TTxnStruct  *pTxn;
+     TI_STATUS   status = 0;
+
+   /*  To write to a top level address from the WLAN IP:
+       Write the top level address to the OCP_POR_CTR register. 
+       Divide the top address by 2, and add 0x30000 to the result – for example for top address 0xC00, write to the OCP_POR_CTR 0x30600
+       Write the data to the OCP_POR_WDATA register
+       Write 0x1 to the OCP_CMD register. 
+
+      To read from a top level address:
+      Write the top level address to the OCP_POR_CTR register.
+      Divide the top address by 2, and add 0x30000 to the result – for example for top address 0xC00, write to the OCP_POR_CTR 0x30600 
+      Write 0x2 to the OCP_CMD register. 
+      Poll bit [18] of OCP_DATA_RD for data valid indication
+      Check bits 17:16 of OCP_DATA_RD:
+      00 – no response
+      01 – data valid / accept
+      10 – request failed
+      11 – response error
+      Read the data from the OCP_DATA_RD register
+   */
+      
+     while (TI_TRUE)
+     {
+         switch (pHwInit->uRegStage)
+         {
+         case 0:
+             pHwInit->uRegStage = 1;
+             pHwInit->uTxnIndex++;
+             pHwInit->uRegLoop = 0;
+
+             /* first read the IRQ Polarity register*/
+             Address = (TI_UINT32)(FN0_CCCR_REG_32 / 2);
+             val = (Address & 0x7FF);
+             val |= BIT_16 | BIT_17;
+
+             /* Write IRQ Polarity address register to OCP_POR_CTR*/
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_CTR, val, 
+                                REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+
+             twIf_Transact(pHwInit->hTwIf, pTxn);
+
+             pHwInit->uTxnIndex++;  
+
+             /* Write read (2)command to the OCP_CMD register. */
+
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_CMD, 0x2, 
+                                REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+             twIf_Transact(pHwInit->hTwIf, pTxn);
+
+             continue;
+
+         case 1:
+             pHwInit->uRegStage ++;
+             pHwInit->uTxnIndex++; 
+
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_DATA_RD, 0, 
+                                REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_WriteIRQPolarity, hHwInit)
+             status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+             EXCEPT (pHwInit, status)
+
+
+         case 2:
+             /* get the value from  IRQ Polarity register*/
+             val = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+            
+             pHwInit->uTxnIndex = 0;
+
+             /*Poll bit 18 of OCP_DATA_RD for data valid indication*/
+             if (val & BIT_18)
+             {
+               if ((val & BIT_16) && (!(val & BIT_17)))
+               {
+                   pHwInit->uRegStage ++;
+                   pHwInit->uRegLoop = 0;
+
+               }
+               else 
+               {
+                 TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "can't writing bt_func7_sel\n");
+                 TWD_FinalizePolarityRead(pHwInit->hTWD);
+
+                 return TI_NOK;
+               }
+             }
+             else
+             {
+               if (pHwInit->uRegLoop < READ_TOP_REG_LOOP)
+               {
+                  pHwInit->uRegStage = 1;
+                  pHwInit->uRegLoop++;
+               }
+               else 
+               {
+
+                 TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "Timeout waiting for writing bt_func7_sel\n");
+                 TWD_FinalizePolarityRead(pHwInit->hTWD);
+
+                 return TI_NOK;
+
+               }
+             }
+
+             continue;
+
+
+         case 3:
+               /* second, write new value of IRQ polarity due to complation flag 1 - active low, 0 - active high*/
+                pHwInit->uRegStage ++;
+                Address = (TI_UINT32)(FN0_CCCR_REG_32 / 2);
+                value = (Address & 0x7FF);
+                value |= BIT_16 | BIT_17;
+
+                /* Write IRQ Polarity address register to OCP_POR_CTR*/
+
+                BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_CTR, value, 
+                                   REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+
+                twIf_Transact(pHwInit->hTwIf, pTxn);
+
+                pHwInit->uTxnIndex++;  
+
+#ifdef USE_IRQ_ACTIVE_HIGH
+                val |= 0x0<<1;
+              
+#else
+                val |= 0x01<<1;
+#endif
+
+                /* Write the new IRQ polarity value to the OCP_POR_WDATA register */
+                BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_WDATA, val, 
+                                   REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+                twIf_Transact(pHwInit->hTwIf, pTxn);
+
+                pHwInit->uTxnIndex++; 
+
+               /* Write write (1)command to the OCP_CMD register. */
+                BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_CMD, 0x1, 
+                                   REGISTER_SIZE, TXN_DIRECTION_WRITE, (TTxnDoneCb)hwInit_WriteIRQPolarity, hHwInit)
+                status = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+                pHwInit->uTxnIndex++; 
+
+                EXCEPT (pHwInit, status)              
+                continue;
+
+         case 4:
+
+             TWD_FinalizePolarityRead(pHwInit->hTWD);
+
+             return TI_OK;
+
+
+         
+         } /* End switch */
+
+     } /* End while */
+
+ }
+
+
+/****************************************************************************
+ *                      hwInit_InitTopRegisterWrite()
+ ****************************************************************************
+ * DESCRIPTION: hwInit_InitTopRegisterWrite 
+ * initalizie hwInit_TopRegisterWrite SM parmaeters
+  ****************************************************************************/
+   
+TI_STATUS hwInit_InitTopRegisterWrite(TI_HANDLE hHwInit, TI_UINT32 uAddress, TI_UINT32 uValue)
+{
+  THwInit      *pHwInit = (THwInit *)hHwInit;
+
+  pHwInit->uTopStage = 0;
+  uAddress = (TI_UINT32)(uAddress / 2);
+  uAddress = (uAddress & 0x7FF);  
+  uAddress|= BIT_16 | BIT_17;
+  pHwInit->uTopRegAddr = uAddress;
+  pHwInit->uTopRegValue = uValue & 0xffff;  
+ 
+  return hwInit_TopRegisterWrite (hHwInit);
+}
+
+
+/****************************************************************************
+ *                      hwInit_WriteTopRegister ()
+ ****************************************************************************
+ * DESCRIPTION: Generic function that writes to the top registers area
+  * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+ TI_STATUS hwInit_TopRegisterWrite(TI_HANDLE hHwInit)
+ {
+     /*  To write to a top level address from the WLAN IP:
+         Write the top level address to the OCP_POR_CTR register. 
+         Divide the top address by 2, and add 0x30000 to the result – for example for top address 0xC00, write to the OCP_POR_CTR 0x30600
+         Write the data to the OCP_POR_WDATA register
+         Write 0x1 to the OCP_CMD register. 
+     */ 
+     THwInit *pHwInit = (THwInit *)hHwInit;
+     TTxnStruct *pTxn;
+        
+     while (TI_TRUE)
+     {
+         switch (pHwInit->uTopStage)
+         {
+         case 0:
+             pHwInit->uTopStage = 1;
+
+             pHwInit->uTxnIndex++;
+             /* Write the address to OCP_POR_CTR*/
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_CTR, pHwInit->uTopRegAddr,
+                                    REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+             twIf_Transact(pHwInit->hTwIf, pTxn);
+
+             pHwInit->uTxnIndex++;
+             /* Write the new value to the OCP_POR_WDATA register */
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_WDATA, pHwInit->uTopRegValue, 
+                                    REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+             twIf_Transact(pHwInit->hTwIf, pTxn);
+
+             pHwInit->uTxnIndex++; 
+             /* Write write (1)command to the OCP_CMD register. */
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_CMD, 0x1, 
+                                    REGISTER_SIZE, TXN_DIRECTION_WRITE, (TTxnDoneCb)hwInit_TopRegisterWrite, hHwInit)
+             pHwInit->uTopStatus = twIf_Transact(pHwInit->hTwIf, pTxn);
+
+             pHwInit->uTxnIndex++;
+
+             EXCEPT (pHwInit, pHwInit->uTopStatus)              
+             continue;
+
+         case 1:
+
+             pHwInit->uTxnIndex = 0;
+             
+             if (pHwInit->uTopStatus == TXN_STATUS_PENDING) {
+                 hwInit_BootSm (hHwInit);
+             }
+             
+             return TI_OK;
+         
+         } /* End switch */
+
+     } /* End while */
+
+ }
+
+
+ /****************************************************************************
+ *                      hwInit_InitTopRegisterRead()
+ ****************************************************************************
+ * DESCRIPTION: hwInit_InitTopRegisterRead 
+ * initalizie hwInit_InitTopRegisterRead SM parmaeters
+  ****************************************************************************/
+   
+TI_STATUS hwInit_InitTopRegisterRead(TI_HANDLE hHwInit, TI_UINT32 uAddress)
+{
+  THwInit      *pHwInit = (THwInit *)hHwInit;
+
+  pHwInit->uTopStage = 0;
+  uAddress = (TI_UINT32)(uAddress / 2);
+  uAddress = (uAddress & 0x7FF);  
+  uAddress|= BIT_16 | BIT_17;
+  pHwInit->uTopRegAddr = uAddress;
+
+  return hwInit_TopRegisterRead (hHwInit);
+}
+
+
+/****************************************************************************
+ *                      hwInit_TopRegisterRead ()
+ ****************************************************************************
+ * DESCRIPTION: Generic function that reads to the top registers area
+  * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+ TI_STATUS hwInit_TopRegisterRead(TI_HANDLE hHwInit)
+ {
+     /*  
+        To read from a top level address:
+        Write the top level address to the OCP_POR_CTR register.
+        Divide the top address by 2, and add 0x30000 to the result – for example for top address 0xC00, write to the OCP_POR_CTR 0x30600 
+        Write 0x2 to the OCP_CMD register. 
+        Poll bit [18] of OCP_DATA_RD for data valid indication
+        Check bits 17:16 of OCP_DATA_RD:
+        00 – no response
+        01 – data valid / accept
+        10 – request failed
+        11 – response error
+        Read the data from the OCP_DATA_RD register
+     */
+
+     THwInit *pHwInit = (THwInit *)hHwInit;
+     TTxnStruct *pTxn;
+        
+     while (TI_TRUE)
+     {
+         switch (pHwInit->uTopStage)
+         {
+         case 0:
+             pHwInit->uTopStage = 1;
+             pHwInit->uTxnIndex++;
+             pHwInit->uRegLoop = 0;
+
+             /* Write the address to OCP_POR_CTR*/
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_POR_CTR, pHwInit->uTopRegAddr,
+                                    REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+             twIf_Transact(pHwInit->hTwIf, pTxn);
+
+             pHwInit->uTxnIndex++;  
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_CMD, 0x2, 
+                                    REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL)
+             twIf_Transact(pHwInit->hTwIf, pTxn);
+
+             continue;
+
+         case 1:
+             pHwInit->uTopStage ++;
+             pHwInit->uTxnIndex++; 
+
+             BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, OCP_DATA_RD, 0, 
+                                    REGISTER_SIZE, TXN_DIRECTION_READ, (TTxnDoneCb)hwInit_TopRegisterRead, hHwInit)
+             pHwInit->uTopStatus = twIf_Transact(pHwInit->hTwIf, pTxn);
+             
+             EXCEPT (pHwInit, pHwInit->uTopStatus)
+
+         case 2:
+             /* get the value from  IRQ Polarity register*/
+             pHwInit->uTopRegValue = *((TI_UINT32*)(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].pData));
+            
+             pHwInit->uTxnIndex = 0;
+
+             /*Poll bit 18 of OCP_DATA_RD for data valid indication*/
+             if (pHwInit->uTopRegValue & BIT_18)
+             {
+               if ((pHwInit->uTopRegValue & BIT_16) && (!(pHwInit->uTopRegValue & BIT_17)))
+               {                   
+                   pHwInit->uTopRegValue &= 0xffff;
+                   
+                   pHwInit->uTxnIndex = 0;
+                   pHwInit->uRegLoop = 0;
+                   if (pHwInit->uTopStatus == TXN_STATUS_PENDING) {
+                       hwInit_BootSm (hHwInit);
+                   }
+                   return TI_OK;
+               }
+               else 
+               {
+                 TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "can't writing bt_func7_sel\n");                 
+                 if (pHwInit->uTopStatus == TXN_STATUS_PENDING) {
+                       hwInit_BootSm (hHwInit);
+                 }
+                 return TI_NOK;
+               }
+             }
+             else
+             {
+               if (pHwInit->uRegLoop < READ_TOP_REG_LOOP)
+               {
+                  pHwInit->uTopStage = 1;
+                  pHwInit->uRegLoop++;
+               }
+               else 
+               {
+                 TRACE0(pHwInit->hReport, REPORT_SEVERITY_ERROR , "Timeout waiting for writing bt_func7_sel\n");                 
+                 if (pHwInit->uTopStatus == TXN_STATUS_PENDING) {
+                       hwInit_BootSm (hHwInit);
+                 }
+                 return TI_NOK;
+               }
+              }
+
+             continue;
+         
+         } /* End switch */
+
+     } /* End while */
+
+ }
+
+
+#ifndef _VLCT_
+    /****************************************************************************
+    *                      hwInit_StallTimerCb ()
+    ****************************************************************************
+    * DESCRIPTION: CB timer function in fTimerFunction format that calls hwInit_StallTimerCb
+     * INPUTS:  TI_HANDLE hHwInit    
+    * 
+    * OUTPUT:  None
+    * 
+    * RETURNS: None
+    ****************************************************************************/
+    static void hwInit_StallTimerCb (TI_HANDLE hHwInit)
+    {
+        hwInit_FinalizeDownloadSm(hHwInit);
+    }
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/HwInit.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,52 @@
+/*
+ * HwInit.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:   HwInit.h                                               */
+/*    PURPOSE:  HwInit module Header file                             */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef _HW_INIT_H_
+#define _HW_INIT_H_
+
+
+#endif /* _HW_INIT_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/RxXfer.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,677 @@
+/*
+ * RxXfer.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  rxXfer.c
+ *
+ *   PURPOSE: Rx Xfer module implementation.Responsible for reading Rx from the FW
+ *              and forward it to the upper layers.
+ * 
+ ****************************************************************************/
+
+#define __FILE_ID__  FILE_ID_106
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "RxXfer.h"
+#include "FwEvent_api.h"
+#include "TWDriverInternal.h"
+#include "RxQueue_api.h"
+#include "TwIf.h"
+#include "public_host_int.h"
+
+#define RX_DRIVER_COUNTER_ADDRESS 0x300538
+#define RX_DRIVER_DUMMY_WRITE_ADDRESS 0x300534
+#define PLCP_HEADER_LENGTH 8
+#define WORD_SIZE   4
+#define UNALIGNED_PAYLOAD   0x1
+
+#define SLV_MEM_ADDR_VALUE(desc, offset)((RX_DESC_GET_MEM_BLK(desc)<<8)+ offset + 4)
+#define SLV_MEM_CP_VALUE(desc, offset)  (((RX_DESC_GET_MEM_BLK(desc)<<8)+ offset))
+/* Add an extra word for alignment the MAC payload in case of QoS MSDU */
+#define ALIGNMENT_SIZE(desc)            ((RX_DESC_GET_UNALIGNED(desc) & UNALIGNED_PAYLOAD)? 2 : 0)
+/*QOS definitions*/
+#define QOS_HW_ADDRESS		0x14FDA
+#define QOS_SHIF_BACK_BUFFER	2
+#define QOS_LENGTH_DIFF		2
+#define QOS_SHIF_IN_BUFFER	4
+/************************ static function declaration *****************************/
+
+static void rxXfer_TxnDoneCb (TI_HANDLE hRxXfer, TTxnStruct* pTxn);
+static void rxXfer_IssueTxn (TI_HANDLE hRxXfer, TI_UINT32 uRxDesc, TI_UINT8 *pHostBuf, TI_UINT32 uBuffSize, TI_BOOL bDropPacket);
+static void rxXfer_ForwardPacket (RxXfer_t* pRxXfer, TTxnStruct* pTxn);
+
+/****************************************************************************
+ *                      RxXfer_Create()
+ ****************************************************************************
+ * DESCRIPTION: Create the RxXfer module object 
+ * 
+ * INPUTS:  None
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: The Created object
+ ****************************************************************************/
+TI_HANDLE rxXfer_Create (TI_HANDLE hOs)
+{
+    RxXfer_t *pRxXfer;
+    int i;
+
+    pRxXfer = os_memoryAlloc (hOs, sizeof(RxXfer_t),MemoryNormal);
+    if (pRxXfer == NULL)
+        return NULL;
+
+    /* For all the counters */
+    os_memoryZero (hOs, pRxXfer, sizeof(RxXfer_t));
+
+    pRxXfer->pTempBuffer = os_memoryAlloc (hOs, MAX_PACKET_SIZE + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pRxXfer->pTempBuffer == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pRxXfer->pTempBuffer, MAX_PACKET_SIZE + WSPI_PAD_LEN_READ);
+    pRxXfer->pTempBuffer += WSPI_PAD_LEN_READ;
+
+    for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++) 
+    {
+        pRxXfer->aSlaveRegTxn[i].pRegData = os_memoryAlloc (hOs, 2*REGISTER_SIZE + WSPI_PAD_LEN_READ,MemoryDMA);
+        if (pRxXfer->aSlaveRegTxn[i].pRegData == NULL) 
+        {
+            return NULL;
+        }
+        os_memoryZero (hOs, pRxXfer->aSlaveRegTxn[i].pRegData, 2*REGISTER_SIZE + WSPI_PAD_LEN_READ);
+        pRxXfer->aSlaveRegTxn[i].pRegData += WSPI_PAD_LEN_READ;
+    }
+
+    for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++) 
+    {
+        pRxXfer->aCounterTxn[i].pCounter = os_memoryAlloc (hOs, REGISTER_SIZE + WSPI_PAD_LEN_READ,MemoryDMA);
+        if (pRxXfer->aCounterTxn[i].pCounter == NULL) 
+        {
+            return NULL;
+        }
+        os_memoryZero (hOs, pRxXfer->aCounterTxn[i].pCounter, REGISTER_SIZE + WSPI_PAD_LEN_READ);
+        pRxXfer->aCounterTxn[i].pCounter += WSPI_PAD_LEN_READ;
+    }
+
+    for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++) 
+    {
+        pRxXfer->aDummyTxn[i].pData = os_memoryAlloc (hOs, REGISTER_SIZE + WSPI_PAD_LEN_READ,MemoryDMA);
+        if (pRxXfer->aDummyTxn[i].pData == NULL) 
+        {
+            return NULL;
+        }
+        os_memoryZero (hOs, pRxXfer->aDummyTxn[i].pData, REGISTER_SIZE + WSPI_PAD_LEN_READ);
+        pRxXfer->aDummyTxn[i].pData += WSPI_PAD_LEN_READ;
+    }
+    
+
+    pRxXfer->hOs = hOs;
+
+    return (TI_HANDLE)pRxXfer;
+}
+
+
+/****************************************************************************
+ *                      RxXfer_Destroy()
+ ****************************************************************************
+ * DESCRIPTION: Destroy the RxXfer module object 
+ * 
+ * INPUTS:  hRxXfer - The object to free
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+void rxXfer_Destroy (TI_HANDLE hRxXfer)
+{
+    RxXfer_t *pRxXfer = (RxXfer_t *)hRxXfer;
+    int i;
+
+    if (pRxXfer)
+    {
+        if (pRxXfer->pTempBuffer) 
+        {
+            os_memoryFree (pRxXfer->hOs, pRxXfer->pTempBuffer - WSPI_PAD_LEN_READ, MAX_PACKET_SIZE + WSPI_PAD_LEN_READ);
+        }
+
+        for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++) 
+        {
+            if (pRxXfer->aSlaveRegTxn[i].pRegData) 
+            {
+                os_memoryFree (pRxXfer->hOs, pRxXfer->aSlaveRegTxn[i].pRegData - WSPI_PAD_LEN_READ, 2*REGISTER_SIZE + WSPI_PAD_LEN_READ);
+            }
+        }
+    
+        for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++) 
+        {
+            if (pRxXfer->aCounterTxn[i].pCounter) 
+            {
+                os_memoryFree (pRxXfer->hOs, pRxXfer->aCounterTxn[i].pCounter - WSPI_PAD_LEN_READ, REGISTER_SIZE + WSPI_PAD_LEN_READ);
+            }
+        }
+    
+        for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++) 
+        {
+            if (pRxXfer->aDummyTxn[i].pData) 
+            {
+                os_memoryFree (pRxXfer->hOs, pRxXfer->aDummyTxn[i].pData - WSPI_PAD_LEN_READ, REGISTER_SIZE + WSPI_PAD_LEN_READ);
+            }
+        }
+    
+        os_memoryFree (pRxXfer->hOs, pRxXfer, sizeof(RxXfer_t));
+    }
+}
+
+
+/****************************************************************************
+ *                      rxXfer_init()
+ ****************************************************************************
+ * DESCRIPTION: Init the FwEvent module object 
+ * 
+ * INPUTS:      hRxXfer       - FwEvent handle;
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: None
+ ****************************************************************************/
+void rxXfer_Init(TI_HANDLE hRxXfer,
+                 TI_HANDLE hFwEvent, 
+                 TI_HANDLE hReport,
+                 TI_HANDLE hTwIf,
+                 TI_HANDLE hRxQueue)
+{
+    RxXfer_t  *pRxXfer      = (RxXfer_t *)hRxXfer;
+
+    pRxXfer->hFwEvent       = hFwEvent;
+    pRxXfer->hReport        = hReport;
+    pRxXfer->hTwIf          = hTwIf;
+    pRxXfer->hRxQueue       = hRxQueue;
+    pRxXfer->uDrvRxCntr     = 0;
+
+    RxXfer_ReStart (hRxXfer);
+
+#ifdef TI_DBG   
+    rxXfer_ClearStats (pRxXfer);
+#endif
+}
+
+
+/****************************************************************************
+ *                      rxXfer_Register_CB()
+ ****************************************************************************
+ * DESCRIPTION: Register the function to be called for request for buffer.
+ * 
+ * INPUTS:      hRxXfer       - RxXfer handle;
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: None
+ ****************************************************************************/
+void rxXfer_Register_CB (TI_HANDLE hRxXfer, TI_UINT32 CallBackID, void *CBFunc, TI_HANDLE CBObj)
+{
+    RxXfer_t* pRxXfer = (RxXfer_t *)hRxXfer;
+
+    TRACE1(pRxXfer->hReport, REPORT_SEVERITY_INFORMATION , "rxXfer_Register_CB (Value = 0x%x)\n", CallBackID);
+
+    switch(CallBackID)
+    {
+    case TWD_INT_REQUEST_FOR_BUFFER:       
+        pRxXfer->RequestForBufferCB = (TRequestForBufferCb)CBFunc;
+        pRxXfer->RequestForBufferCB_handle = CBObj;
+        break;
+
+    default:
+        TRACE0(pRxXfer->hReport, REPORT_SEVERITY_ERROR, "rxXfer_Register_CB - Illegal value\n");
+        return;
+    }
+}
+
+
+/****************************************************************************
+ *                      rxXfer_ForwardPacket()
+ ****************************************************************************
+ * DESCRIPTION:  Forward received packet to the upper layers.
+ *
+ * INPUTS:      
+ * 
+ * OUTPUT:      
+ * 
+ * RETURNS:     
+ ****************************************************************************/
+static void rxXfer_ForwardPacket (RxXfer_t* pRxXfer, TTxnStruct* pTxn)
+{
+	RxIfDescriptor_t *pRxInfo;
+    TI_UINT16        uLenFromRxInfo;
+
+	if (pTxn->uHwAddr == QOS_HW_ADDRESS)/*in case of QOS*/
+	{
+		pTxn->aBuf[0]-= QOS_SHIF_BACK_BUFFER;
+		pRxInfo  = (RxIfDescriptor_t*)(pTxn->aBuf[0]);
+		/*in case of QOS we ask to read the data with 2 bytes shift so the packet will be alignd.
+		as a result we asked to read 2 bytes less,
+		since we are adding the mising 2 bytes (length)
+		we need to add those 2 bytes to the length*/
+		pTxn->aLen[0]+= QOS_LENGTH_DIFF;
+		/*devide by 4 to have the value in word (from byte)*/
+		pRxInfo->length = pTxn->aLen[0] >> 2;
+		/*fix back the endianaty and setting the missing value from the shor descriptor*/
+		pRxInfo->length = ENDIAN_HANDLE_WORD(pRxInfo->length);
+		/*now we have the a regular Rx info with all parameters */
+		pRxInfo  = (RxIfDescriptor_t*)(pTxn->aBuf[0]);
+		
+	}
+	else
+	{
+		/*in case of regular packet*/
+		pRxInfo  = (RxIfDescriptor_t*)(pTxn->aBuf[0]);	
+	}
+
+
+#ifdef TI_DBG   /* packet sanity check */
+    /* Get length from RxInfo, handle endianess and convert to length in bytes */
+    uLenFromRxInfo = ENDIAN_HANDLE_WORD(pRxInfo->length) << 2;
+
+    /* If the length in the RxInfo is different than in the short descriptor, set error status */
+    if (pTxn->aLen[0] != uLenFromRxInfo) 
+    {
+        TRACE3(pRxXfer->hReport, REPORT_SEVERITY_ERROR , ": Bad Length!! RxInfoLength=%d, ShortDescLen=%d, RxInfoStatus=0x%x\n", uLenFromRxInfo, pTxn->aLen[0], pRxInfo->status);
+        report_PrintDump(pTxn->aBuf[0], pTxn->aLen[0]);
+        pRxInfo->status &= ~RX_DESC_STATUS_MASK;
+        pRxInfo->status |= RX_DESC_STATUS_DRIVER_RX_Q_FAIL;
+        pRxInfo->length = ENDIAN_HANDLE_WORD(pTxn->aLen[0] >> 2);
+    }
+#endif
+
+    /* Forward received packet to the upper layers */
+    RxQueue_ReceivePacket (pRxXfer->hRxQueue, (const void *)pTxn->aBuf[0]);
+
+    /* reset the aBuf field for clean on recovery purpose */
+    pTxn->aBuf[0] = 0;
+}
+
+
+/****************************************************************************
+ *                      rxXfer_RxEvent()
+ ****************************************************************************
+ * DESCRIPTION: Called upon Rx event from the FW.calls the SM  
+ * 
+ * INPUTS:      hRxXfer       - RxXfer handle;
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TWIF_OK in case of Synch mode, or TWIF_PENDING in case of Asynch mode
+ *          (when returning TWIF_PENDING, FwEvent module expects the FwEvent_EventComplete()
+ *          function call to finish the Rx Client handling 
+ *
+ ****************************************************************************/
+TI_STATUS rxXfer_RxEvent (TI_HANDLE hRxXfer, FwStatus_t *pFwStatus)
+{
+    RxXfer_t       *pRxXfer = (RxXfer_t *)hRxXfer;
+    TI_UINT32      uTempCounters;
+    FwStatCntrs_t  *pFwStatusCounters;
+    TI_UINT32       i;
+    TI_STATUS   rc;
+    
+
+    uTempCounters = ENDIAN_HANDLE_LONG (pFwStatus->counters);
+#ifdef TI_DBG
+	pRxXfer->DbgStats.counters = uTempCounters;
+#endif
+    pFwStatusCounters = (FwStatCntrs_t*)(&uTempCounters);
+
+    TRACE2(pRxXfer->hReport, REPORT_SEVERITY_INFORMATION , ": NewFwCntr=%d, OldFwCntr=%d\n", pFwStatusCounters->fwRxCntr, pRxXfer->uFwRxCntr);
+
+    if (pFwStatusCounters->fwRxCntr%8 == pRxXfer->uFwRxCntr%8)
+    {
+        return TI_OK;
+    }
+    pRxXfer->uFwRxCntr = pFwStatusCounters->fwRxCntr;
+
+    for (i = 0; i < NUM_RX_PKT_DESC; i++)
+    {
+        pRxXfer->aRxPktsDesc[i] = ENDIAN_HANDLE_LONG (pFwStatus->rxPktsDesc[i]); 
+    }
+
+    rc = rxXfer_Handle (pRxXfer);
+
+    return rc;
+}
+
+
+/****************************************************************************
+ *                      rxXfer_Handle()
+ ****************************************************************************
+ * DESCRIPTION: 
+ *
+ * INPUTS:      hRxXfer       - RxXfer handle;
+ * 
+ * OUTPUT:      
+ * 
+ * RETURNS:     
+ ****************************************************************************/
+TI_STATUS rxXfer_Handle(TI_HANDLE hRxXfer)
+{
+#ifndef _VLCT_
+    RxXfer_t* pRxXfer = (RxXfer_t *)hRxXfer;
+    TI_UINT32   uRxDesc, uPacketIndex, uBuffSize, uSecurity;
+    TI_UINT8 *pHostBuf;
+    ERxBufferStatus  eBufStatus;
+
+
+    if (pRxXfer->uAvailableTxn == 0 )
+    {
+        TRACE0(pRxXfer->hReport, REPORT_SEVERITY_ERROR, "(): No available Txn structures left!\n");
+        return TI_NOK;
+    }
+
+    while (pRxXfer->uFwRxCntr%8 != pRxXfer->uDrvRxCntr%8)
+    {
+        uPacketIndex = pRxXfer->uDrvRxCntr % NUM_RX_PKT_DESC;
+
+        uRxDesc =  pRxXfer->aRxPktsDesc[uPacketIndex];
+        
+        uBuffSize = RX_DESC_GET_LENGTH(uRxDesc) << 2;
+
+        uSecurity = RX_DESC_GET_SECURITY(uRxDesc);
+
+        /* prepare the read buffer */
+        /* the RxBufAlloc() add an extra word for alignment the MAC payload in case of QoS MSDU */
+        eBufStatus = pRxXfer->RequestForBufferCB(pRxXfer->RequestForBufferCB_handle, 
+                                                 (void**)&pHostBuf,
+                                                 uBuffSize,
+                                                 uSecurity);
+
+        TRACE6(pRxXfer->hReport, REPORT_SEVERITY_INFORMATION , ": Index=%d, RxDesc=0x%x, DrvCntr=%d, FwCntr=%d, BufStatus=%d, BuffSize=%d\n", uPacketIndex, uRxDesc, pRxXfer->uDrvRxCntr, pRxXfer->uFwRxCntr, eBufStatus, uBuffSize);
+
+        switch (eBufStatus)
+        {
+            case RX_BUF_ALLOC_PENDING:
+                return TI_OK;
+
+            case RX_BUF_ALLOC_COMPLETE:
+                rxXfer_IssueTxn (pRxXfer, uRxDesc, pHostBuf, uBuffSize, TI_FALSE);
+                break;
+
+            case RX_BUF_ALLOC_OUT_OF_MEM:
+                /* In case the allocation failed, we read the packet to a temporary buffer and ignore it */
+                rxXfer_IssueTxn (pRxXfer, uRxDesc, pRxXfer->pTempBuffer, uBuffSize, TI_TRUE);
+                break;
+        }
+
+    /* End of while */
+    }
+#endif
+    return TI_OK;
+/* End of rxXfer_Handle() */
+}
+
+
+/****************************************************************************
+ *                      rxXfer_IssueTxn()
+ ****************************************************************************
+ * DESCRIPTION: 
+ *
+ * INPUTS:      
+ * 
+ * OUTPUT:      
+ * 
+ * RETURNS:     
+ ****************************************************************************/
+static void rxXfer_IssueTxn (TI_HANDLE hRxXfer, TI_UINT32 uRxDesc, TI_UINT8 *pHostBuf, TI_UINT32 uBuffSize, TI_BOOL bDropPacket)
+{
+    RxXfer_t   *pRxXfer = (RxXfer_t *)hRxXfer;
+    TI_UINT32   uIndex = pRxXfer->uDrvRxCntr % MAX_CONSECUTIVE_READ_TXN;
+    TTxnStruct *pTxn;
+    ETxnStatus  eStatus;
+
+    /* Write the next mem block that we want to read */
+    pRxXfer->aSlaveRegTxn[uIndex].tTxnStruct.uHwAddr = SLV_REG_DATA;
+    ((TI_UINT32*)(pRxXfer->aSlaveRegTxn[uIndex].pRegData))[0] = SLV_MEM_CP_VALUE(uRxDesc, pRxXfer->uPacketMemoryPoolStart);
+    ((TI_UINT32*)(pRxXfer->aSlaveRegTxn[uIndex].pRegData))[1] = SLV_MEM_ADDR_VALUE(uRxDesc, pRxXfer->uPacketMemoryPoolStart);
+    twIf_Transact(pRxXfer->hTwIf, &pRxXfer->aSlaveRegTxn[uIndex].tTxnStruct);
+
+    /* prepare the read transaction */ 
+    pTxn = (TTxnStruct*)&pRxXfer->aTxnStruct[uIndex];
+
+    if (!bDropPacket)
+    {
+		
+        if (ALIGNMENT_SIZE(uRxDesc))
+		{
+			/*because the DMA requiers a 4 bytes alingned buffer and in the case of QOS we have 
+			2 more bytes in the WLAN header,we will give a 4 byte shifted buffer for the read.
+			in addition we will ask to read the data with 2 bytes shift, in this way we will
+			packet aligned. because of this 2 bytes shif the lenght for the read should be 2
+			bytes shorter.
+			we will loose the first 2 bytes in the read (length in the RX info),
+			*/
+			BUILD_TTxnStruct(pTxn, SLV_MEM_QOS_DATA, pHostBuf +QOS_SHIF_IN_BUFFER , uBuffSize-QOS_LENGTH_DIFF, (TTxnDoneCb)rxXfer_TxnDoneCb, hRxXfer)
+		}
+		else
+		{
+        BUILD_TTxnStruct(pTxn, SLV_MEM_DATA, pHostBuf, uBuffSize, (TTxnDoneCb)rxXfer_TxnDoneCb, hRxXfer)
+    }
+			
+    }
+    else
+    {
+        TRACE0(pRxXfer->hReport, REPORT_SEVERITY_WARNING, "Request for Rx buffer failed! \n");
+        BUILD_TTxnStruct(pTxn, SLV_MEM_DATA, pHostBuf, uBuffSize, NULL, NULL)
+    }
+
+    eStatus = twIf_Transact(pRxXfer->hTwIf, pTxn);
+
+    pRxXfer->uDrvRxCntr++;
+
+    
+
+    pTxn = &pRxXfer->aCounterTxn[uIndex].tTxnStruct;
+    *((TI_UINT32*)(pRxXfer->aCounterTxn[uIndex].pCounter)) = ENDIAN_HANDLE_LONG(pRxXfer->uDrvRxCntr);
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pTxn, RX_DRIVER_COUNTER_ADDRESS, pRxXfer->aCounterTxn[uIndex].pCounter, REGISTER_SIZE, NULL, NULL)
+    twIf_Transact(pRxXfer->hTwIf, pTxn);
+
+    TRACE6(pRxXfer->hReport, REPORT_SEVERITY_INFORMATION , ": Counter-Txn: HwAddr=0x%x, Len0=%d, Data0=%d, DrvCount=%d, TxnParams=0x%x, RxDesc=0x%x\n", pTxn->uHwAddr, pTxn->aLen[0], *(TI_UINT32 *)(pTxn->aBuf[0]), pRxXfer->uDrvRxCntr, pTxn->uTxnParams, uRxDesc);
+    
+
+    if (!bDropPacket)
+    {
+        if (eStatus == TXN_STATUS_COMPLETE)
+        {
+            /* Forward received packet to the upper layers */
+            rxXfer_ForwardPacket (pRxXfer, &(pRxXfer->aTxnStruct[uIndex]));
+        }
+        else if (eStatus == TXN_STATUS_PENDING) 
+        {
+            /* Decrease the number of available txn structures */
+            pRxXfer->uAvailableTxn--;
+        }
+        else 
+        {
+            TRACE3(pRxXfer->hReport, REPORT_SEVERITY_ERROR , ": Status=%d, DrvCntr=%d, RxDesc=0x%x\n", eStatus, pRxXfer->uDrvRxCntr, uRxDesc);
+        }
+    }
+}
+  
+
+/****************************************************************************
+ *                      rxXfer_SetRxDirectAccessParams()
+ ****************************************************************************
+ * DESCRIPTION: 
+ *
+ * INPUTS:      
+ * 
+ * OUTPUT:      
+ * 
+ * RETURNS:     
+ ****************************************************************************/
+void rxXfer_SetRxDirectAccessParams (TI_HANDLE hRxXfer, TDmaParams *pDmaParams)
+{
+    RxXfer_t* pRxXfer = (RxXfer_t *)hRxXfer;
+
+    pRxXfer->uPacketMemoryPoolStart = pDmaParams->PacketMemoryPoolStart;
+}
+
+
+/****************************************************************************
+ *                      rxXfer_TxnDoneCb()
+ ****************************************************************************
+ * DESCRIPTION: Forward the packet to the registered CB
+ *
+ * INPUTS:      
+ * 
+ * OUTPUT:      
+ * 
+ * RETURNS:     
+ ****************************************************************************/
+static void rxXfer_TxnDoneCb (TI_HANDLE hRxXfer, TTxnStruct* pTxn)
+{
+    RxXfer_t* pRxXfer = (RxXfer_t *)hRxXfer;
+    
+    /* Increase the number of available txn structures */
+    pRxXfer->uAvailableTxn++;
+
+    /* Forward received packet to the upper layers */
+    rxXfer_ForwardPacket (pRxXfer, pTxn);
+
+    /* Handle further packets if any */
+    rxXfer_Handle(hRxXfer);
+}
+
+
+/****************************************************************************
+ *                      RxXfer_ReStart()
+ ****************************************************************************
+ * DESCRIPTION:	RxXfer_ReStart the RxXfer module object (called by the recovery)
+ * 
+ * INPUTS:	hRxXfer - The object to free
+ * 
+ * OUTPUT:	None
+ * 
+ * RETURNS:	NONE 
+ ****************************************************************************/
+void RxXfer_ReStart(TI_HANDLE hRxXfer)
+{
+	RxXfer_t *pRxXfer = (RxXfer_t *)hRxXfer;
+    TTxnStruct* pTxn;
+    TI_UINT8    i;
+
+    pRxXfer->uFwRxCntr = 0;
+    pRxXfer->uDrvRxCntr = 0;
+    pRxXfer->uAvailableTxn = MAX_CONSECUTIVE_READ_TXN - 1;
+
+    /* Scan all transaction array and release only pending transaction */
+    for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++)
+    {
+        pTxn = &(pRxXfer->aSlaveRegTxn[i].tTxnStruct);
+        /* Check if buffer allocated and not the local one (signed by no callback) */
+        if ((pTxn->hCbHandle != NULL) && (pTxn->aBuf[0] != 0))
+        {
+            RxIfDescriptor_t    *pRxParams  = (RxIfDescriptor_t*)pTxn->aBuf[0];
+
+            WLAN_OS_REPORT (("RxXfer_ReStart: clean, in loop call RxQueue_ReceivePacket with TAG_CLASS_UNKNOWN\n"));
+            /* Set TAG_CLASS_UNKNOWN and call upper layer only to release the allocated buffer */
+            pRxParams->packet_class_tag = TAG_CLASS_UNKNOWN;
+            RxQueue_ReceivePacket (pRxXfer->hRxQueue, (const void *)pTxn->aBuf[0]);
+            pTxn->aBuf[0] = 0;
+        }
+    }
+
+    for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++)
+    {
+        pTxn = &(pRxXfer->aSlaveRegTxn[i].tTxnStruct);
+        TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+        BUILD_TTxnStruct(pTxn, SLV_REG_DATA, pRxXfer->aSlaveRegTxn[i].pRegData, REGISTER_SIZE*2, NULL, NULL)
+
+        pTxn = &pRxXfer->aTxnStruct[i];
+        TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_FIXED_ADDR)
+    }
+	
+} /* RxXfer_ReStart() */
+
+
+#ifdef TI_DBG
+/****************************************************************************
+ *                      rxXfer_ClearStats()
+ ****************************************************************************
+ * DESCRIPTION: 
+ *
+ * INPUTS:  
+ *          pRxXfer The object
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK. 
+ ****************************************************************************/
+void rxXfer_ClearStats (TI_HANDLE hRxXfer)
+{
+    RxXfer_t * pRxXfer = (RxXfer_t *)hRxXfer;
+
+    os_memoryZero (pRxXfer->hOs, &pRxXfer->DbgStats, sizeof(RxXferStats_T));
+}
+
+
+/****************************************************************************
+ *                      rxXfer_PrintStats()
+ ****************************************************************************
+ * DESCRIPTION: .
+ *
+ * INPUTS:  
+ *          pRxXfer The object
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK. 
+ ****************************************************************************/
+void rxXfer_PrintStats (TI_HANDLE hRxXfer)
+{
+    RxXfer_t * pRxXfer = (RxXfer_t *)hRxXfer;
+    
+    WLAN_OS_REPORT(("Print RX Xfer module info\n"));
+    WLAN_OS_REPORT(("=========================\n"));
+    WLAN_OS_REPORT(("Rx counter   = 0x%x\n", pRxXfer->uFwRxCntr));
+    WLAN_OS_REPORT(("Drv counter  = 0x%x\n", pRxXfer->uDrvRxCntr));
+    WLAN_OS_REPORT(("Fw Counters  = 0x%x\n", pRxXfer->DbgStats.counters));
+    WLAN_OS_REPORT(("AvailableTxn = 0x%x\n", pRxXfer->uAvailableTxn));
+}
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/RxXfer.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,131 @@
+/*
+ * RxXfer.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  rxXfer.h
+ *
+ *   PURPOSE: Rx Xfer module header file.
+ * 
+ ****************************************************************************/
+
+#ifndef _RX_XFER_H
+#define _RX_XFER_H
+
+#include "rxXfer_api.h"
+#include "TwIf.h"
+
+
+#define RX_DESCRIPTOR_SIZE (sizeof(RxIfDescriptor_t))
+#ifdef PLATFORM_SYMBIAN	/* UMAC is using only one buffer and therefore we can't use consecutive reads */
+    #define MAX_CONSECUTIVE_READS    1
+#else
+    #define MAX_CONSECUTIVE_READS    8
+#endif
+
+#define MAX_PACKETS_NUMBER  8
+#define MAX_CONSECUTIVE_READ_TXN   16
+/* Max Txn size */
+#define MAX_PACKET_SIZE     4096
+
+typedef struct 
+{
+    TI_UINT32      numPacketsRead;
+    TI_UINT32      numBytesRead;
+    TI_UINT32      numPacketsDroppedNoMem;
+    TI_UINT32      numPacketsDroppedPacketIDMismatch;
+    TI_UINT32      counters;
+    TI_UINT32      numAck0;
+} RxXferStats_T;
+
+
+typedef struct 
+{
+    TTxnStruct              tTxnStruct;
+    TI_UINT8                *pRegData; 
+} TRegTxn;
+
+typedef struct 
+{
+    TTxnStruct              tTxnStruct;
+    TI_UINT8                *pCounter; 
+    
+} TCounterTxn;
+
+typedef struct 
+{
+    TTxnStruct              tTxnStruct;
+    TI_UINT8                *pData; 
+    
+} TDummyTxn;
+
+typedef struct 
+{
+    TI_HANDLE               hOs;
+    TI_HANDLE               hReport;
+    TI_HANDLE               hTwIf;
+    TI_HANDLE               hFwEvent;
+    TI_HANDLE               hRxQueue;
+
+    TI_UINT32               aRxPktsDesc[NUM_RX_PKT_DESC]; /* Array of Rx packets short descriptors (see RX_DESC_SET/GET...) */
+    TI_UINT32               uFwRxCntr;
+    TI_UINT32               uDrvRxCntr;
+
+    TI_UINT32               uPacketMemoryPoolStart;
+
+    TRequestForBufferCb     RequestForBufferCB;
+    TI_HANDLE               RequestForBufferCB_handle;  
+
+    TRegTxn                 aSlaveRegTxn[MAX_CONSECUTIVE_READ_TXN];
+    TTxnStruct              aTxnStruct[MAX_CONSECUTIVE_READ_TXN];
+    TCounterTxn             aCounterTxn[MAX_CONSECUTIVE_READ_TXN];
+    TDummyTxn               aDummyTxn[MAX_CONSECUTIVE_READ_TXN];
+
+    TI_UINT8                *pTempBuffer;
+
+    TI_UINT32               uAvailableTxn;
+    
+#ifdef TI_DBG
+    RxXferStats_T           DbgStats;
+#endif /* TI_DBG */
+
+} RxXfer_t;
+
+
+#endif /* _RX_XFER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/eventMbox.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,787 @@
+/*
+ * eventMbox.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  eventMbox.c 
+ *  \brief Handle any event interrupt from the FW
+ *
+ *  \see   
+ */
+
+#define __FILE_ID__  FILE_ID_102
+#include "eventMbox_api.h"
+#include "TwIf.h"
+#include "osApi.h"
+#include "report.h"
+#include "CmdBld.h"
+#include "FwEvent_api.h"
+#include "TWDriver.h"
+#include "BusDrv.h"
+
+
+
+#define EVENT_MBOX_BUFFERS 2
+
+
+typedef enum
+{
+    EVENT_MBOX_STATE_IDLE,
+    EVENT_MBOX_STATE_READING
+} EEventMboxState;
+
+typedef struct {
+	void*		fCb;            /* Event Callback function */
+	TI_HANDLE	hCb;            /* Evant handle */
+	TI_UINT8*	pDataOffset;    /* Event Data Offset */
+	#ifdef TI_DBG
+	TI_UINT32	uCount;
+	#endif
+
+}TRegisteredEventCb;
+
+typedef struct 
+{
+    TI_UINT32           bitMask;/* Event bit mask */
+    char*               str;    /* Event trace string */
+    TI_UINT8            dataLen;/* Event data length */  
+
+} TEventEntry;
+
+
+typedef struct
+{
+	TTxnStruct	tTxnReg;
+	TI_UINT8 	*pRegBuffer;
+
+} tTxnGenReg;
+
+
+typedef struct
+{
+	TTxnStruct		tEventMbox;
+	TI_UINT8    	*pEventMboxBuf;
+
+} tTxnEventMbox;
+
+
+
+typedef struct 
+{
+	TI_UINT32		   	EventMboxAddr[EVENT_MBOX_BUFFERS];  /* the Event Mbox addresses in the device */
+	TI_UINT8		   	ActiveMbox;                         /* The current active Mbox */
+	EEventMboxState		CurrentState;
+    TRegisteredEventCb  CbTable[TWD_OWN_EVENT_MAX];         /* Callback table */
+
+    /* Handles */
+	TI_HANDLE           hTwif;
+    TI_HANDLE           hOs;
+    TI_HANDLE           hReport;
+    TI_HANDLE           hCmdBld;
+
+	/* HW params */
+    /* use a struct to read or write register (4 byte size) from the bus */
+	tTxnGenReg			iTxnGenRegSize;
+
+	tTxnEventMbox		iTxnEventMbox;
+
+	#ifdef TI_DBG
+	TI_UINT32           uCompounEvCount;    /* Count the compound event */
+	TI_UINT32           uTotalEvCount;      /* Count total number of event sending in the compound */
+	#endif /* TI_DBG */
+	
+	fnotify_t			fCb;
+	TI_HANDLE		   	hCb;
+
+}TEventMbox;
+
+
+/********************************************************************************/
+/*                      Internal functions prototypes.                          */
+/********************************************************************************/
+
+static void eventMbox_ConfigCbTable(TI_HANDLE hEventMbox);
+static void eventMbox_ReadAddrCb(TI_HANDLE hEventMbox, TI_HANDLE hTxn);
+static void eventMbox_DummyCb(TI_HANDLE hEventMbox);
+static void eventMbox_ReadCompleteCB(TI_HANDLE hEventMbox, TTxnStruct *pTxnStruct);
+
+
+static const TEventEntry eventTable [TWD_OWN_EVENT_MAX] =
+{   
+/*==================================================================================
+ *                                                                                     
+ *                                    EVENT TABLE    
+ *                                 
+ *  Note that changes here should be reflected also in ETwdOwnEventId in TWDriver.h !!!
+ *
+ ===================================================================================
+| Id  |     Event Mask Bit                    |   Event String            | Length |
+ ===================================================================================*/
+
+/* 0*/{ RSSI_SNR_TRIGGER_0_EVENT_ID,            "RSSI SNR TRIGGER 0 "     		, 1},
+/* 1*/{ RSSI_SNR_TRIGGER_1_EVENT_ID,            "RSSI SNR TRIGGER 1 "     		, 1},
+/* 2*/{ RSSI_SNR_TRIGGER_2_EVENT_ID,            "RSSI SNR TRIGGER 2 "     		, 1},
+/* 3*/{ RSSI_SNR_TRIGGER_3_EVENT_ID,            "RSSI SNR TRIGGER 3 "     		, 1},
+/* 4*/{ RSSI_SNR_TRIGGER_4_EVENT_ID,            "RSSI SNR TRIGGER 4 "     		, 1},
+/* 5*/{ RSSI_SNR_TRIGGER_5_EVENT_ID,            "RSSI SNR TRIGGER 5 "     		, 1},
+/* 6*/{ RSSI_SNR_TRIGGER_6_EVENT_ID,            "RSSI SNR TRIGGER 6 "     		, 1},
+/* 7*/{ RSSI_SNR_TRIGGER_7_EVENT_ID,            "RSSI SNR TRIGGER 7 "     		, 1},
+/* 8*/{ MEASUREMENT_START_EVENT_ID,             "MEASUREMENT START "      		, 0},    
+/* 9*/{ MEASUREMENT_COMPLETE_EVENT_ID,          "BSS LOSE "               		, 0},
+/*10*/{ SCAN_COMPLETE_EVENT_ID ,                "SCAN CMPLT "             		, 8},    
+/*11*/{ SCHEDULED_SCAN_COMPLETE_EVENT_ID,       "SPS SCAN CMPLT "         		, 3},
+/*12*/{ AP_DISCOVERY_COMPLETE_EVENT_ID,         "MAX TX RETRY "           		, 0},
+/*13*/{ PS_REPORT_EVENT_ID,                     "PS_REPORT "              		, 1},
+/*14*/{ PSPOLL_DELIVERY_FAILURE_EVENT_ID,       "PS-POLL DELIVERY FAILURE"		, 0},
+/*15*/{ DISCONNECT_EVENT_COMPLETE_ID,           "DISCONNECT COMPLETE "    		, 0},
+/*16*/{ JOIN_EVENT_COMPLETE_ID,                 "JOIN CMPLT "             		, 0},
+/*17*/{ CHANNEL_SWITCH_COMPLETE_EVENT_ID,       "SWITCH CHANNEL CMPLT "   		, 0},
+/*18*/{ BSS_LOSE_EVENT_ID,                      "BSS LOST "               		, 0},
+/*19*/{ REGAINED_BSS_EVENT_ID,                  "REGAINED BSS "           		, 0},
+/*20*/{ ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID,  "MAX TX RETRY "           		, 0},
+/*21*/{ BIT_21,									"RESERVED"				  		, 0},
+/*22*/{ SOFT_GEMINI_SENSE_EVENT_ID,             "SOFT GEMINI SENSE "      		, 1},
+/*23*/{ SOFT_GEMINI_PREDICTION_EVENT_ID,        "SOFT GEMINI PREDICTION " 		, 1},
+/*24*/{ SOFT_GEMINI_AVALANCHE_EVENT_ID,         "SOFT GEMINI AVALANCHE "  		, 0},
+/*25*/{ PLT_RX_CALIBRATION_COMPLETE_EVENT_ID,   "PLT RX CALIBR. COMPLETE "		, 0},
+/*26*/{ DBG_EVENT_ID,							"DBG_EVENT_ID "			  		, 16},
+/*27*/{ HEALTH_CHECK_REPLY_EVENT_ID,			"HEALTH_CHECK_REPLY_EVENT_ID"	, 0},
+/*28*/{ PERIODIC_SCAN_COMPLETE_EVENT_ID,        "PERIODIC SCAN COMPLETE " 		, 8},
+/*29*/{ PERIODIC_SCAN_REPORT_EVENT_ID,          "PERIODIC SCAN REPORT "   		, 8},
+/*30*/{ BA_SESSION_TEAR_DOWN_EVENT_ID,			"BA_SESSION_TEAR_DOWN_EVENT_ID"	, 0},
+/*31*/{ EVENT_MBOX_ALL_EVENT_ID,                "ALL EVENTS "             		, 0}
+};
+
+
+/*
+ * \brief	Create the Bus Access mailbox object
+ * 
+ * \param  hOs - OS Handle
+ * \returnThe Created object
+ *
+ * \sa 
+ */
+
+TI_HANDLE eventMbox_Create(TI_HANDLE hOs)
+{
+    TEventMbox *pEventMbox;
+	pEventMbox = (TEventMbox*)os_memoryAlloc(hOs,sizeof(TEventMbox),MemoryNormal);
+    if (pEventMbox == NULL)
+    {
+        WLAN_OS_REPORT (("eventMbox_Create: Error creating EventMbox object\n"));
+        return NULL;
+    }
+    os_memoryZero (hOs, pEventMbox, sizeof(TEventMbox));
+
+    /* Allocate the MBOX Buffer */
+    pEventMbox->iTxnEventMbox.pEventMboxBuf = os_memoryAlloc (hOs, sizeof (EventMailBox_t) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pEventMbox->iTxnEventMbox.pEventMboxBuf == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pEventMbox->iTxnEventMbox.pEventMboxBuf, sizeof (EventMailBox_t) + WSPI_PAD_LEN_READ);
+    pEventMbox->iTxnEventMbox.pEventMboxBuf += WSPI_PAD_LEN_READ;
+
+    /* Allocate the Register buffer */
+    pEventMbox->iTxnGenRegSize.pRegBuffer = os_memoryAlloc (hOs, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pEventMbox->iTxnGenRegSize.pRegBuffer == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pEventMbox->iTxnGenRegSize.pRegBuffer, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ);
+    pEventMbox->iTxnGenRegSize.pRegBuffer += WSPI_PAD_LEN_READ;
+
+    pEventMbox->hOs = hOs;
+    ((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsMask = EVENT_MBOX_ALL_EVENT_ID;
+    return (TI_HANDLE)pEventMbox;
+}
+
+
+/*
+ * \brief	Release all memory resource of EventMbox
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \return none
+ * 
+ * \par Description
+ * This function should called after all interrupts was disabled.
+ *
+ * \sa 
+ */
+void eventMbox_Destroy(TI_HANDLE hEventMbox)
+{
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+
+    if (pEventMbox->iTxnEventMbox.pEventMboxBuf) 
+    {
+        os_memoryFree (pEventMbox->hOs, pEventMbox->iTxnEventMbox.pEventMboxBuf - WSPI_PAD_LEN_READ, sizeof (EventMailBox_t) + WSPI_PAD_LEN_READ);
+    }
+
+    if (pEventMbox->iTxnGenRegSize.pRegBuffer)
+    {
+        os_memoryFree (pEventMbox->hOs, pEventMbox->iTxnGenRegSize.pRegBuffer - WSPI_PAD_LEN_READ, sizeof (TI_UINT32) + WSPI_PAD_LEN_READ);
+    }
+
+    if (pEventMbox)
+    {
+        os_memoryFree (pEventMbox->hOs, pEventMbox, sizeof(TEventMbox));
+    }
+}
+
+
+
+/*
+ * \brief	Stop the EventMbox clear state and event vector
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \return none
+ * 
+ * \par Description
+ * This function should called to stop the EventMb.
+ * Do Not clear the mask Event could use us again when restart/recovery!!!!
+ * \sa 
+ */
+void eventMbox_Stop(TI_HANDLE hEventMbox)
+{
+	TEventMbox* pEventMbox 									= (TEventMbox*)hEventMbox;
+	pEventMbox->ActiveMbox									= 0;
+	pEventMbox->CurrentState								= EVENT_MBOX_STATE_IDLE;
+	((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsVector	= 0;
+}
+
+
+
+/*
+ * \brief	Configure the object
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  hTwif	   - Handle to TWIF
+ * \param  hReport	   - Handle to Report module
+ * \param  hFwEvent    - Handle to FW Event module
+ * \param  hCmdBld     - Handle to Command Build module
+ * \return none
+ *
+ * \par Description
+ * This function should called to configure the module.
+ * \sa 
+ */
+
+void eventMbox_Config(TI_HANDLE hEventMbox, 
+                            TI_HANDLE hTwif, 
+                            TI_HANDLE hReport,    
+                            TI_HANDLE hFwEvent, 
+                            TI_HANDLE hCmdBld)
+{
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+	pEventMbox->hTwif			= hTwif;
+    pEventMbox->hReport = hReport;
+    pEventMbox->hCmdBld = hCmdBld;
+	pEventMbox->ActiveMbox		= 0;
+	pEventMbox->CurrentState	= EVENT_MBOX_STATE_IDLE;
+#ifdef TI_DBG
+	pEventMbox->uCompounEvCount	= 0;
+	pEventMbox->uTotalEvCount	= 0;
+#endif
+	eventMbox_ConfigCbTable(pEventMbox);
+}
+
+
+
+/* 
+ * \brief	Initialization of callback table
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \return none
+ * 
+ * \par Description
+ * This function is called to configure the CB table initialize the
+ * CB functions and handle and set the Data offset.
+ * 
+ * \sa 
+ */
+static void eventMbox_ConfigCbTable(TI_HANDLE hEventMbox)
+{
+	TEventMbox* pEventMbox;
+	TI_UINT8	EvID;
+	
+	pEventMbox = (TEventMbox*)hEventMbox;
+
+	/* for all events set a dummy func and data offset */
+	for (EvID = 0; EvID < TWD_OWN_EVENT_MAX;EvID++)
+	{
+		pEventMbox->CbTable[EvID].pDataOffset = pEventMbox->iTxnEventMbox.pEventMboxBuf;
+		pEventMbox->CbTable[EvID].fCb		  = (void*)eventMbox_DummyCb;
+		pEventMbox->CbTable[EvID].hCb		  = pEventMbox;
+	}
+	/* set the data offset for Events with data only */
+	for (EvID = 0;EvID < NUM_OF_RSSI_SNR_TRIGGERS;EvID++)
+	{
+		pEventMbox->CbTable[EvID].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t, RSSISNRTriggerMetric[EvID]);
+	}
+	pEventMbox->CbTable[TWD_DBG_EVENT                       ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t, dbgEventRep);
+	pEventMbox->CbTable[TWD_OWN_EVENT_SCAN_CMPLT            ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,scanCompleteResults);
+	pEventMbox->CbTable[TWD_OWN_EVENT_SPS_SCAN_CMPLT        ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,scheduledScanAttendedChannels);
+    pEventMbox->CbTable[TWD_OWN_EVENT_PERIODIC_SCAN_COMPLETE].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t, scanCompleteResults);
+    pEventMbox->CbTable[TWD_OWN_EVENT_PERIODIC_SCAN_REPORT  ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t, scanCompleteResults);
+	pEventMbox->CbTable[TWD_OWN_EVENT_SOFT_GEMINI_SENSE     ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,softGeminiSenseInfo);
+	pEventMbox->CbTable[TWD_OWN_EVENT_SOFT_GEMINI_PREDIC    ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,softGeminiProtectiveInfo);
+	pEventMbox->CbTable[TWD_OWN_EVENT_SWITCH_CHANNEL_CMPLT  ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,channelSwitchStatus);
+	pEventMbox->CbTable[TWD_OWN_EVENT_PS_REPORT             ].pDataOffset += TI_FIELD_OFFSET (EventMailBox_t,psStatus);
+}
+    
+
+
+static void eventMbox_DummyCb(TI_HANDLE hEventMbox)
+{
+	TEventMbox* pEventMbox = (TEventMbox*)hEventMbox;
+TRACE0(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_DummyCb : Called for unregistered event");
+}
+
+
+/*
+ * \brief	Read mailbox address
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  fCb		   - CB function to return in Async mode
+ * \param  hCb		   - CB Habdle 
+ * \return TXN_STATUS_COMPLETE, TXN_STATUS_PENDING, TXN_STATUS_ERROR
+ * 
+ * \par Description
+ * This function is called for initialize the Event MBOX addresses.
+ * It issues a read transaction from the Twif with a CB.
+ * 
+ * \sa 
+ */
+TI_STATUS eventMbox_InitMboxAddr(TI_HANDLE hEventMbox, fnotify_t fCb, TI_HANDLE hCb)
+{
+	TTxnStruct  *pTxn;
+	TEventMbox* pEventMbox;
+	ETxnStatus  rc;
+	pEventMbox = (TEventMbox*)hEventMbox;
+	pTxn = &pEventMbox->iTxnGenRegSize.tTxnReg;
+
+	/* Store the Callabck address of the modules that called us in case of Asynchronuous transaction that will complete later */
+	pEventMbox->fCb = fCb;
+    pEventMbox->hCb = hCb;
+
+	/* Build the command TxnStruct */
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+	/* Applying a CB in case of an async read */
+    BUILD_TTxnStruct(pTxn, REG_EVENT_MAILBOX_PTR, pEventMbox->iTxnGenRegSize.pRegBuffer, REGISTER_SIZE, eventMbox_ReadAddrCb, hEventMbox)
+	rc = twIf_Transact(pEventMbox->hTwif,pTxn);
+	if (rc == TXN_STATUS_COMPLETE)
+	{
+		pEventMbox->EventMboxAddr[0] = *((TI_UINT32*)(pEventMbox->iTxnGenRegSize.pRegBuffer));
+		pEventMbox->EventMboxAddr[1] = pEventMbox->EventMboxAddr[0] + sizeof(EventMailBox_t);
+		
+                TRACE3(pEventMbox->hReport, REPORT_SEVERITY_INIT , "eventMbox_ConfigHw: event A Address=0x%x, event B Address=0x%x, sizeof=%d\n", pEventMbox->EventMboxAddr[0], pEventMbox->EventMboxAddr[1], sizeof(EventMailBox_t));
+
+	}
+	return rc;
+}
+
+
+/*
+ * \brief	Save the Event MBOX addresses
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  hTxn		   - Handle to TTxnStruct
+ * \return none
+ * 
+ * \par Description
+ * This function is called upon completion of thr read Event MBOX address register.
+ * It save the addresses in EventMbox.
+ * 
+ * \sa 
+ */
+static void eventMbox_ReadAddrCb(TI_HANDLE hEventMbox, TI_HANDLE hTxn)
+{
+    TEventMbox* pEventMbox;
+	
+	pEventMbox = (TEventMbox*)hEventMbox;
+
+	pEventMbox->EventMboxAddr[0] = *((TI_UINT32*)(pEventMbox->iTxnGenRegSize.pRegBuffer));
+	pEventMbox->EventMboxAddr[1] = pEventMbox->EventMboxAddr[0] + sizeof(EventMailBox_t);
+ 
+    TRACE3(pEventMbox->hReport, REPORT_SEVERITY_INIT , "eventMbox_ConfigHw: event A Address=0x%x, event B Address=0x%x, sizeof=%d\n", pEventMbox->EventMboxAddr[0], pEventMbox->EventMboxAddr[1], sizeof(EventMailBox_t));
+
+	/* call back the module that called us before to read our self-address */
+	pEventMbox->fCb(pEventMbox->hCb,TI_OK);
+}
+
+
+/*
+ * \brief	confige the Mask vector in FW 
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \return none
+ * 
+ * \par Description
+ * This function is called upon exit from init it will set the mask vector.
+ * this function is mostly use for recovery
+ * Note that at Init stage the FW is already configured to have all events masked but at Recovery stage 
+ * The driver whishes to just set back previous event mask configuration
+ * 
+ * \sa 
+ */
+void eventMbox_InitComplete(TI_HANDLE hEventMbox)
+{
+
+    TEventMbox* pEventMbox;
+	pEventMbox = (TEventMbox*)hEventMbox;
+	
+    TRACE1(pEventMbox->hReport, REPORT_SEVERITY_INFORMATION, "eventMbox_InitComplete: mask = 0x%x\n", ((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsMask);
+
+	cmdBld_CfgEventMask(pEventMbox->hCmdBld,((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsMask,NULL,NULL);
+}
+    
+
+
+/*
+ * \brief	Register an event 
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  EvID - the event ID to register
+ * \param  fCb - CB function of the registered event
+ * \param  hCb - CB handle of the registered event
+ * \return TI_OK,TI_NOK
+ *
+ * \par Description
+ * This function is called from the user upon request to register for event.
+ * an Event can only be register to one user.
+ * This function doesn't change the mask vector in FW!!!
+ * 
+ * \sa 
+ */
+TI_STATUS eventMbox_RegisterEvent(TI_HANDLE hEventMbox,TI_UINT32 EvID,void* fCb,TI_HANDLE hCb)
+{
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+    if (fCb == NULL || hCb == NULL)
+    { 
+TRACE0(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_RegisterEvent : NULL parameters\n");
+        return TI_NOK;
+    }
+    if (EvID >= TWD_OWN_EVENT_ALL)
+    {
+TRACE0(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_RegisterEvent : Event ID invalid\n");
+		return TI_NOK;
+    }
+	pEventMbox->CbTable[EvID].fCb = fCb;
+	pEventMbox->CbTable[EvID].hCb = hCb;
+	return TI_OK;
+}
+
+
+
+
+/*
+ * \brief	Replace event callback 
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  EvID - the event ID to register
+ * \param  fNewCb - the new CB function of the registered event
+ * \param  hNewCb - the new CB handle of the registered event
+ * \param  pPrevCb - the old CB to save
+ * \param  pPrevHndl - the old handle to save
+ * \return TI_OK,TI_NOK
+ * 
+ * \par Description
+ * Replace event callback function by another one.
+ *              Provide the previous CB to the caller.
+ *
+ * \sa 
+ */
+TI_STATUS eventMbox_ReplaceEvent (TI_HANDLE hEventMbox,
+                                    TI_UINT32   EvID, 
+                                    void       *fNewCb, 
+                                    TI_HANDLE   hNewCb,                                   
+                                    void      **pPrevCb, 
+                                    TI_HANDLE  *pPrevHndl)                                    
+{
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+    if (fNewCb == NULL || hNewCb == NULL)
+    { 
+TRACE0(pEventMbox->hReport, REPORT_SEVERITY_ERROR , "eventMbox_ReplaceEvent: NULL parameters\n");
+        return TI_NOK;
+    }
+    if (EvID >= TWD_OWN_EVENT_ALL)
+    {
+TRACE1(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_ReplaceEvent: invalid ID. ID is %d\n", EvID);
+        return TI_NOK;
+    }
+
+	/* Save the old CBs */
+	*pPrevCb   = pEventMbox->CbTable[EvID].fCb;
+	*pPrevHndl = pEventMbox->CbTable[EvID].hCb;
+
+	/* store the new CBs */
+	pEventMbox->CbTable[EvID].fCb = fNewCb;
+	pEventMbox->CbTable[EvID].hCb = hNewCb;
+
+    TRACE0(pEventMbox->hReport, REPORT_SEVERITY_INFORMATION, "eventMbox_ReplaceEvent: EVENT  has registered\n");
+	return TI_OK;
+}
+
+
+/*
+ * \brief	Un mask an event
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  EvID - the event ID to un mask
+ * \param  fCb - CB function
+ * \param  hCb - CB handle
+ * \return TI_COMPLETE,TI_PENDING,TI_ERROR
+ *
+ * \par Description
+ * This function is called from the user upon request to un mask an event.
+ * This function change the mask vector in FW but doesn't register for it in the driver and 
+ * doesn't set Cb function and Cb Handle in case of un mask event without registered for it an 
+ * error will be handling!!!
+ * 
+ * \sa 
+ */
+TI_STATUS eventMbox_UnMaskEvent(TI_HANDLE hEventMbox,TI_UINT32 EvID,void* fCb,TI_HANDLE hCb)
+{
+	TI_UINT32*	pEventMask;
+	TI_STATUS	aStatus;
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+	pEventMask = (TI_UINT32*)&((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsMask;
+
+    if (EvID >= TWD_OWN_EVENT_ALL)
+    {
+TRACE1(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_UnMaskEvent : Un mask an Invalid event = 0x%x\n",EvID);
+		return TXN_STATUS_ERROR;
+    }
+TRACE0(pEventMbox->hReport, REPORT_SEVERITY_INFORMATION, "eventMbox_UnMaskEvent : EVENT  is unmasked\n");
+
+	*pEventMask &= ~eventTable[EvID].bitMask;
+
+	aStatus = cmdBld_CfgEventMask (pEventMbox->hCmdBld, *pEventMask, fCb, hCb);
+	return aStatus;
+}
+
+
+/*
+ * \brief	mask an event
+ *
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  EvID - the event ID to un mask
+ * \param  fCb - CB function
+ * \param  hCb - CB handle
+ * \return TI_COMPLETE,TI_PENDING,TI_ERROR
+ * 
+ * \par Description
+ * This function is called from the user upon request to mask an event.
+ * This function change the mask vector in FW but doesn't unregister it in the driver. 
+ * \sa 
+ */
+TI_STATUS eventMbox_MaskEvent(TI_HANDLE hEventMbox,TI_UINT32 EvID,void* fCb,TI_HANDLE hCb)
+{
+	TI_UINT32*	pEventMask;
+	TI_STATUS	aStatus;
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+	pEventMask = (TI_UINT32*)&((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsMask;
+    
+    if (EvID >= TWD_OWN_EVENT_ALL)
+    {
+TRACE1(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_MaskEvent : Mask an Invalid event = 0x%x\n",EvID);
+		return TXN_STATUS_ERROR;
+    }
+
+	*pEventMask |= eventTable[EvID].bitMask;
+
+    TRACE0(pEventMbox->hReport, REPORT_SEVERITY_INFORMATION , "eventMbox_MaskEvent : EVENT  is masked\n");
+
+	aStatus = cmdBld_CfgEventMask(pEventMbox->hCmdBld,*pEventMask,fCb,hCb);
+	return aStatus;
+}
+
+
+
+/*
+ * \brief	Handle the incoming event read the Mbox data
+ * 
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  TFwStatus  - FW status
+ * \return none
+ *
+ * \par Description
+ * This function is called from the FW Event upon receiving MBOX event.
+ * \sa 
+ */
+void eventMbox_Handle(TI_HANDLE hEventMbox,FwStatus_t* pFwStatus)
+{
+	ETxnStatus	rc;
+	TTxnStruct  *pTxn;
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+
+	pTxn = &pEventMbox->iTxnEventMbox.tEventMbox;
+
+TRACE1(pEventMbox->hReport, REPORT_SEVERITY_INFORMATION, "eventMbox_Handle : Reading from MBOX -- %d",pEventMbox->ActiveMbox);
+
+#ifdef TI_DBG
+    /* Check if missmatch MBOX */
+	if (pEventMbox->ActiveMbox == 0)
+    {
+    	if (pFwStatus->intrStatus & ACX_INTR_EVENT_B)
+        {
+        TRACE0(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_Handle : incorrect MBOX SW MBOX -- A FW MBOX -- B");
+        }
+    }
+	else if (pEventMbox->ActiveMbox == 1)
+    {
+        if (pFwStatus->intrStatus & ACX_INTR_EVENT_A)
+        {
+            TRACE0(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_Handle : incorrect MBOX SW MBOX -- B FW MBOX -- A");
+        }
+    }
+#endif /* TI_DBG */
+    
+	if (pEventMbox->CurrentState != EVENT_MBOX_STATE_IDLE)
+	{
+TRACE0(pEventMbox->hReport, REPORT_SEVERITY_ERROR, "eventMbox_Handle : Receiving event not in Idle state");
+    }
+	pEventMbox->CurrentState = EVENT_MBOX_STATE_READING;
+
+	/* Build the command TxnStruct */
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+	/* Applying a CB in case of an async read */
+    BUILD_TTxnStruct(pTxn, pEventMbox->EventMboxAddr[pEventMbox->ActiveMbox], pEventMbox->iTxnEventMbox.pEventMboxBuf, sizeof(EventMailBox_t),(TTxnDoneCb)eventMbox_ReadCompleteCB, pEventMbox)
+	rc = twIf_Transact(pEventMbox->hTwif,pTxn);
+
+	pEventMbox->ActiveMbox = 1 - pEventMbox->ActiveMbox;
+	if (rc == TXN_STATUS_COMPLETE)
+    {   
+		eventMbox_ReadCompleteCB(pEventMbox,pTxn);
+    }
+}
+
+
+/*
+ * \brief	Process the event 
+ *
+ * \param  hEventMbox  - Handle to EventMbox
+ * \param  pTxnStruct  - the Txn data
+ * \return none
+ * 
+ * \par Description
+ * This function is called from the upon reading completion of the event MBOX
+ * it will call all registered event according to the pending bits in event MBOX vector.
+ * \sa 
+ */
+static void eventMbox_ReadCompleteCB(TI_HANDLE hEventMbox, TTxnStruct *pTxnStruct)
+{
+	TI_UINT32	EvID;
+	TTxnStruct*	pTxn;
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+	pTxn = &pEventMbox->iTxnGenRegSize.tTxnReg;
+
+TRACE1(pEventMbox->hReport, REPORT_SEVERITY_INFORMATION, "eventMbox_ReadCompleteCB : event vector -- 0x%x\n",((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsVector);
+    
+	*((TI_UINT32*)(pEventMbox->iTxnGenRegSize.pRegBuffer)) = INTR_TRIG_EVENT_ACK;
+
+    for (EvID = 0; EvID < TWD_OWN_EVENT_ALL; EvID++)
+    {
+        if (((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsVector & eventTable[EvID].bitMask)
+                {                  
+                    if (eventTable[EvID].dataLen)
+                    {
+                ((TEventMboxDataCb)pEventMbox->CbTable[EvID].fCb)(pEventMbox->CbTable[EvID].hCb,(TI_CHAR*)pEventMbox->CbTable[EvID].pDataOffset,eventTable[EvID].dataLen);
+            }
+            else
+            {
+                ((TEventMboxEvCb)pEventMbox->CbTable[EvID].fCb)(pEventMbox->CbTable[EvID].hCb);
+            }
+        }
+    }     
+
+    /* Check if the state is changed in the context of the event callbacks */
+    if (pEventMbox->CurrentState == EVENT_MBOX_STATE_IDLE)
+    {
+        /*
+         * When eventMbox_stop is called state is changed to IDLE
+         * This is done in the context of the above events callbacks
+         * Don't send the EVENT ACK transaction because the driver stop process includes power off
+         */ 
+        TRACE0(pEventMbox->hReport, REPORT_SEVERITY_WARNING, "eventMbox_ReadCompleteCB : State is IDLE ! don't send the EVENT ACK");
+        return;
+    }
+
+	pEventMbox->CurrentState = EVENT_MBOX_STATE_IDLE;
+
+	/* Build the command TxnStruct */
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+	/* Applying a CB in case of an async read */
+    BUILD_TTxnStruct(pTxn, ACX_REG_INTERRUPT_TRIG, pEventMbox->iTxnGenRegSize.pRegBuffer, sizeof(TI_UINT32), NULL, NULL)
+	twIf_Transact(pEventMbox->hTwif,pTxn);
+}    
+
+
+#ifdef TI_DBG
+
+/*
+ *  eventMbox_Print: print the Event Mailbox statistic :Number 890
+ */
+TI_STATUS eventMbox_Print (TI_HANDLE hEventMbox)
+{
+    TEventMbox *pEventMbox = (TEventMbox *)hEventMbox;
+    TI_UINT32 i;
+    TI_UINT32 EvMask   = ((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsMask;
+    TI_UINT32 EvVector = ((EventMailBox_t*)(pEventMbox->iTxnEventMbox.pEventMboxBuf))->eventsVector;
+
+    TRACE0(pEventMbox->hReport, REPORT_SEVERITY_CONSOLE, "------------------------- EventMbox  Print ----------------------------\n");
+
+    TRACE1(pEventMbox->hReport, REPORT_SEVERITY_INFORMATION, " eventMbox_HandleEvent: Event Vector = 0x%x\n", EvVector);
+    TRACE1(pEventMbox->hReport, REPORT_SEVERITY_INFORMATION, " eventMbox_HandleEvent: Event Mask = 0x%x\n", EvMask);
+    TRACE1(pEventMbox->hReport, REPORT_SEVERITY_CONSOLE, " Total Number Of Compound Event = %d: \n", pEventMbox->uCompounEvCount);
+    TRACE1(pEventMbox->hReport, REPORT_SEVERITY_CONSOLE, " Total Number Of Events = %d: \n", pEventMbox->uTotalEvCount);
+    TRACE0(pEventMbox->hReport, REPORT_SEVERITY_CONSOLE, "\t\t\t\t *** Event Counters *** :\n");
+    for (i = 0; i < TWD_OWN_EVENT_ALL; i++)
+    {
+        TRACE2(pEventMbox->hReport, REPORT_SEVERITY_CONSOLE, " %d) Event Name = EVENT , Number of Event = %d\n", i, pEventMbox->CbTable[i].uCount);
+    }
+
+    TRACE0(pEventMbox->hReport, REPORT_SEVERITY_CONSOLE, "------------------------- EventMbox  Print End ----------------------------\n");
+
+    return TI_OK;
+}
+
+
+#endif /* TI_DBG */
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/fwDebug.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,351 @@
+/*
+ * fwDebug.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  FWDebug.c 
+ * 
+ *  \see   FWDebug.h 
+ */
+
+#define __FILE_ID__  FILE_ID_103
+#include "tidef.h"
+#include "fwDebug_api.h"
+#include "osApi.h"
+#include "report.h"
+#include "BusDrv.h"
+#include "TwIf.h"
+
+
+
+#define DMA_SIZE_BUF 256
+
+typedef struct 
+{
+    TI_HANDLE       hOs;
+    TI_HANDLE       hReport;
+	TI_HANDLE		hTwif;
+
+	TFwDubCallback	fCb;
+	TI_HANDLE hCb;
+
+	TI_UINT8*		pReadBuf;
+        
+	TTxnStruct		tTxn;
+	TI_UINT8*		pDMABuf;
+
+}TFwDebug;
+
+/* Local functions */
+static void     fwDbg_WriteAddrCb   (TI_HANDLE hFwDebug,TTxnStruct* pTxn);
+static void     fwDbg_ReadAddrCb    (TI_HANDLE hFwDebug,TTxnStruct* pTxn);
+
+
+
+/*
+ * \brief	Create the FW Debug module
+ * 
+ * \param  hOs  - Handle to OS
+ * \return The created object
+ * 
+ * \par Description
+ * This function will allocate memory to FW Debug module.
+ * 
+ * \sa 
+ */
+TI_HANDLE fwDbg_Create (TI_HANDLE hOs)
+{
+	TFwDebug* pFwDebug = (TFwDebug*)os_memoryAlloc(hOs,sizeof(TFwDebug),MemoryNormal);
+    if (pFwDebug == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pFwDebug, sizeof(TFwDebug));
+	pFwDebug->hOs = hOs;
+
+	/* Allocate DMA memory for read write transact */
+	pFwDebug->pDMABuf = (TI_UINT8*)os_memoryAlloc(pFwDebug->hOs,DMA_SIZE_BUF + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pFwDebug->pDMABuf == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs, pFwDebug->pDMABuf, DMA_SIZE_BUF + WSPI_PAD_LEN_READ);
+    pFwDebug->pDMABuf += WSPI_PAD_LEN_READ;
+
+	return pFwDebug;
+}
+
+
+/*
+ * \brief	Initialize the module
+ * 
+ * \param  hFwDebug  - Handle to FW Debug
+ * \param  hReport - Handle to report
+ * \param  hTwif - Handle to TWIF
+ * \return none
+ * 
+ * \par Description
+ * 
+ * 
+ * \sa 
+ */
+void fwDbg_Init (TI_HANDLE hFwDebug,
+				 TI_HANDLE hReport,
+				 TI_HANDLE hTwif)
+{
+	TFwDebug* pFwDebug = (TFwDebug*)hFwDebug;
+	pFwDebug->hReport  = hReport;
+	pFwDebug->hTwif	   = hTwif;
+}
+
+
+/*
+ * \brief	Destroy the object
+ * 
+ * \param  hFwDebug  - Handle to FW Debug
+ * \return none
+ * 
+ * \par Description
+ * Deallocate the object memory
+ * 
+ * \sa 
+ */
+void fwDbg_Destroy (TI_HANDLE hFwDebug)
+{
+	TFwDebug* pFwDebug = (TFwDebug*)hFwDebug;
+
+	if (pFwDebug)
+	{
+		if (pFwDebug->pDMABuf)
+    	{
+    		os_memoryFree(pFwDebug->hOs,pFwDebug->pDMABuf - WSPI_PAD_LEN_READ,DMA_SIZE_BUF + WSPI_PAD_LEN_READ);
+    	}
+        os_memoryFree(pFwDebug->hOs,pFwDebug,sizeof(pFwDebug));
+	}
+}
+
+
+/*
+ * \brief	Write Address to FW
+ * 
+ * \param  hFwDebug  - Handle to FW Debug
+ * \param  Address - Absolute HW address
+ * \param  Length - Length in byte to write
+ * \param  Buffer - Buffer to copy to FW
+ * \param  fCb - CB function
+ * \param  hCb - CB Handle
+ * \return none
+ * 
+ * \par Description
+ * Write buffer to HW must receive length in byte max size 256 bytes
+ * address must be absolute HW address.
+ * 
+ * \sa 
+ */
+TI_STATUS fwDbg_WriteAddr (TI_HANDLE hFwDebug,
+                           TI_UINT32 Address,
+                           TI_UINT32 Length,
+                           TI_UINT8* Buffer,
+                           TFwDubCallback fCb,
+                           TI_HANDLE hCb)
+{
+	TI_STATUS rc;
+	TTxnStruct *pTxn;
+	TFwDebug* pFwDebug = (TFwDebug*)hFwDebug;
+
+	pTxn = &pFwDebug->tTxn;
+
+	/* check if length is large than default threshold */
+	if (Length > DMA_SIZE_BUF)
+    {
+TRACE1(pFwDebug->hOs, REPORT_SEVERITY_ERROR, "fwDbg_WriteAddr : Buffer Length too large -- %d",Length);
+		return TXN_STATUS_ERROR;
+    }
+
+	pFwDebug->fCb = fCb;
+	pFwDebug->hCb = hCb;
+	/* copy the given buffer to DMA buffer */
+	os_memoryCopy(pFwDebug->hOs,pFwDebug->pDMABuf,Buffer,Length);
+	/* Build the command TxnStruct */
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+	/* Applying a CB in case of an async read */
+    BUILD_TTxnStruct(pTxn, Address, pFwDebug->pDMABuf, Length,(TTxnDoneCb)fwDbg_WriteAddrCb, pFwDebug)
+	rc = twIf_Transact(pFwDebug->hTwif,pTxn);
+
+	return rc;
+}
+
+
+/*
+ * \brief	Read Address to FW
+ * 
+ * \param  hFwDebug  - Handle to FW Debug
+ * \param  Address - Absolute HW address
+ * \param  Length - Length in byte to write
+ * \param  Buffer - Buffer to copy to FW
+ * \param  fCb - CB function
+ * \param  hCb - CB Handle
+ * \return none
+ * 
+ * \par Description
+ * Read from HW, must receive length in byte max size 256 bytes
+ * address must be absolute HW address.
+ * 
+ * \sa 
+ */
+TI_STATUS fwDbg_ReadAddr (TI_HANDLE hFwDebug,
+                          TI_UINT32 Address,
+                          TI_UINT32 Length,
+                          TI_UINT8* Buffer,
+                          TFwDubCallback fCb,
+                          TI_HANDLE hCb)
+{
+	TI_STATUS rc;
+	TTxnStruct *pTxn;
+	TFwDebug *pFwDebug = (TFwDebug*)hFwDebug;
+	pTxn = &pFwDebug->tTxn;
+	/* check if length is large than default threshold */
+	if (Length > DMA_SIZE_BUF)
+	{
+TRACE1(pFwDebug->hOs, REPORT_SEVERITY_ERROR, "fwDbg_ReadAddr : Buffer Length too large -- %d",Length);
+		return TXN_STATUS_ERROR;
+	}
+
+	pFwDebug->fCb = fCb;
+	pFwDebug->hCb = hCb;
+	pFwDebug->pReadBuf = Buffer;
+
+	/* Build the command TxnStruct */
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+	/* Applying a CB in case of an async read */
+    BUILD_TTxnStruct(pTxn, Address, pFwDebug->pDMABuf, Length,(TTxnDoneCb)fwDbg_ReadAddrCb, pFwDebug)
+	rc = twIf_Transact(pFwDebug->hTwif,pTxn);
+	if (rc == TXN_STATUS_COMPLETE)
+    {
+		/* copy from DMA buufer to given buffer */
+		os_memoryCopy(pFwDebug->hOs,pFwDebug->pReadBuf,pFwDebug->pDMABuf,Length);
+	}
+	return rc;
+}
+
+
+/*
+ * \brief	Write CB function
+ * 
+ * \param  hFwDebug  - Handle to FW Debug
+ * \param  pTxn - pointer ti Transact
+ * \return none
+ * 
+ * \par Description
+ * This function called from TWIF upon Async Write
+ * 
+ * \sa 
+ */
+static void fwDbg_WriteAddrCb (TI_HANDLE hFwDebug,TTxnStruct* pTxn)
+{
+	TFwDebug *pFwDebug = (TFwDebug*)hFwDebug;
+
+	if (pFwDebug->fCb && pFwDebug->hCb)
+    {
+		pFwDebug->fCb(pFwDebug->hCb);
+    }
+}
+
+
+/*
+ * \brief	Read CB function
+ * 
+ * \param  hFwDebug  - Handle to FW Debug
+ * \param  pTxn - pointer ti Transact
+ * \return none
+ * 
+ * \par Description
+ * This function called from TWIF upon Async Read
+ * 
+ * \sa 
+ */
+static void fwDbg_ReadAddrCb (TI_HANDLE hFwDebug,TTxnStruct* pTxn)
+{
+	TFwDebug *pFwDebug = (TFwDebug*)hFwDebug;
+	/* copy from DMA buufer to given buffer */
+	os_memoryCopy(pFwDebug->hOs,pFwDebug->pReadBuf,pFwDebug->pDMABuf,pTxn->aLen[0]);
+
+	if (pFwDebug->fCb && pFwDebug->hCb)
+    {
+		pFwDebug->fCb(pFwDebug->hCb);
+    }
+}
+    
+
+/*
+ * \brief	Check HW address
+ * 
+ * \param  hFwDebug  - Handle to FW Debug
+ * \return TI_TRUE, TI_FALSE
+ * 
+ * \par Description
+ * This function called to check the given address to be a valid memory address.
+ * 
+ * \sa 
+ */
+TI_BOOL fwDbg_isValidMemoryAddr (TI_HANDLE hFwDebug, TI_UINT32 Address, TI_UINT32 Length)
+{
+	TFwDebug *pFwDebug = (TFwDebug*)hFwDebug; 
+
+	return twIf_isValidMemoryAddr(pFwDebug->hTwif, Address, Length);
+}
+
+
+/*
+ * \brief	Check HW address
+ * 
+ * \param  hFwDebug  - Handle to FW Debug
+ * \return TI_TRUE, TI_FALSE
+ * 
+ * \par Description
+ * This function called to check the given address to be a valid register address.
+ * 
+ * \sa 
+ */
+TI_BOOL fwDbg_isValidRegAddr (TI_HANDLE hFwDebug, TI_UINT32 Address, TI_UINT32 Length)
+{
+	TFwDebug *pFwDebug = (TFwDebug*)hFwDebug; 
+
+	return twIf_isValidRegAddr(pFwDebug->hTwif, Address, Length);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/txResult.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,494 @@
+/*
+ * txResult.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  txResult.c
+ *   
+ *   PURPOSE:  Handle packets Tx results upon Tx-complete from the FW. 
+ * 
+ *   DESCRIPTION:  
+ *   ============
+ *      This module is called upon Tx-complete from FW. 
+ *      It retrieves the transmitted packets results from the FW TxResult table and
+ *        calls the upper layer callback function for each packet with its results.
+ *
+ ****************************************************************************/
+
+#define __FILE_ID__  FILE_ID_107
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "TwIf.h"
+#include "txCtrlBlk_api.h"
+#include "txResult_api.h"
+#include "TWDriver.h"
+#include "FwEvent_api.h"
+
+
+
+#define TX_RESULT_QUEUE_DEPTH_MASK  (TRQ_DEPTH - 1)
+
+#if (TX_RESULT_QUEUE_DEPTH_MASK & TRQ_DEPTH) 
+    #error  TRQ_DEPTH should be a power of 2 !!
+#endif
+
+
+/* Callback function definition for Tx sendPacketComplete */
+typedef void (* TSendPacketCompleteCb)(TI_HANDLE hCbObj, TxResultDescriptor_t *pTxResultInfo);
+
+/* Tx-Result SM states */
+typedef enum
+{
+    TX_RESULT_STATE_IDLE,
+    TX_RESULT_STATE_READING
+} ETxResultState;
+
+/* The host Tx-results counter write transaction structure. */
+typedef struct
+{
+    TTxnStruct tTxnStruct;
+    TI_UINT8  *pCounter;              
+} THostCounterWriteTxn;
+
+/* The Tx-results counters and table read transaction structure. */
+typedef struct
+{
+    TTxnStruct          tTxnStruct;
+    TI_UINT8            *pTxResultInfo;
+} TResultsInfoReadTxn;
+
+/* The TxResult module object. */
+typedef struct
+{
+    TI_HANDLE               hOs;
+    TI_HANDLE               hReport;
+    TI_HANDLE               hTwIf;
+
+    TI_UINT32               uTxResultInfoAddr;       /* The HW Tx-Result Table address */
+    TI_UINT32               uTxResultHostCounterAddr;/* The Tx-Result host counter address in SRAM */
+    TI_UINT32               uHostResultsCounter;     /* Number of results read by host from queue since FW-init (updated to FW) */
+    ETxResultState          eState;                  /* Current eState of SM */
+    TSendPacketCompleteCb   fSendPacketCompleteCb;   /* Tx-Complete callback function */
+    TI_HANDLE               hSendPacketCompleteHndl; /* Tx-Complete callback function handle */
+    THostCounterWriteTxn    tHostCounterWriteTxn;    /* The structure used for writing host results counter to FW */
+    TResultsInfoReadTxn     tResultsInfoReadTxn;     /* The structure used for reading Tx-results counters and table from  FW */
+#ifdef TI_DBG
+    TI_UINT32               uInterruptsCounter;         /* Count number of Tx-results */
+#endif
+
+} TTxResultObj;
+
+
+static void txResult_Restart (TTxResultObj *pTxResult);
+static void txResult_HandleNewResults (TTxResultObj *pTxResult);
+static void txResult_StateMachine (TI_HANDLE hTxResult);
+
+
+
+/****************************************************************************
+ *                      txResult_Create()
+ ****************************************************************************
+ * DESCRIPTION: Create the Tx-Result object 
+ * 
+ * INPUTS:  hOs
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: The Created object
+ ****************************************************************************/
+TI_HANDLE txResult_Create(TI_HANDLE hOs)
+{
+    TTxResultObj *pTxResult;
+
+    pTxResult = os_memoryAlloc(hOs, sizeof(TTxResultObj),MemoryNormal);
+    if (pTxResult == NULL)
+        return NULL;
+
+    os_memoryZero(hOs, pTxResult, sizeof(TTxResultObj));
+
+    pTxResult->tResultsInfoReadTxn.pTxResultInfo = os_memoryAlloc(hOs, sizeof(TxResultInterface_t) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pTxResult->tResultsInfoReadTxn.pTxResultInfo == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs,pTxResult->tResultsInfoReadTxn.pTxResultInfo, sizeof(TxResultInterface_t) + WSPI_PAD_LEN_READ);
+    pTxResult->tResultsInfoReadTxn.pTxResultInfo += WSPI_PAD_LEN_READ;
+
+
+    pTxResult->tHostCounterWriteTxn.pCounter = os_memoryAlloc(hOs, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ,MemoryDMA);
+    if (pTxResult->tHostCounterWriteTxn.pCounter == NULL) 
+    {
+        return NULL;
+    }
+    os_memoryZero (hOs,pTxResult->tHostCounterWriteTxn.pCounter, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+    pTxResult->tHostCounterWriteTxn.pCounter += WSPI_PAD_LEN_READ;
+
+    pTxResult->hOs = hOs;
+
+    return( (TI_HANDLE)pTxResult );
+}
+
+
+/****************************************************************************
+ *                      txResult_Destroy()
+ ****************************************************************************
+ * DESCRIPTION: Destroy the Tx-Result object 
+ * 
+ * INPUTS:  hTxResult - The object to free
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS txResult_Destroy(TI_HANDLE hTxResult)
+{
+    TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;
+
+    if (pTxResult)
+    {
+        if (pTxResult->tResultsInfoReadTxn.pTxResultInfo) 
+        {
+            os_memoryFree (pTxResult->hOs, pTxResult->tResultsInfoReadTxn.pTxResultInfo - WSPI_PAD_LEN_READ, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+        }
+
+        if (pTxResult->tHostCounterWriteTxn.pCounter) 
+        {
+            os_memoryFree (pTxResult->hOs, pTxResult->tHostCounterWriteTxn.pCounter - WSPI_PAD_LEN_READ, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+        }
+
+        os_memoryFree(pTxResult->hOs, pTxResult, sizeof(TTxResultObj));
+    }
+
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *               txResult_Init()
+ ****************************************************************************
+   DESCRIPTION:  
+   ============
+     Initialize the txResult module.
+ ****************************************************************************/
+TI_STATUS txResult_Init(TI_HANDLE hTxResult, TI_HANDLE hReport, TI_HANDLE hTwIf)
+{
+    TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;
+    TTxnStruct   *pTxn;
+
+    pTxResult->hReport    = hReport;
+    pTxResult->hTwIf      = hTwIf;
+
+    /* Prepare Host-Results-Counter write transaction (HwAddr is filled before each transaction) */
+    pTxn = &pTxResult->tHostCounterWriteTxn.tTxnStruct;
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pTxn, 0, pTxResult->tHostCounterWriteTxn.pCounter, REGISTER_SIZE, NULL, NULL)
+
+    /* Prepare Tx-Result counter and table read transaction (HwAddr is filled before each transaction) */
+    pTxn = &pTxResult->tResultsInfoReadTxn.tTxnStruct;
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_INC_ADDR)
+    BUILD_TTxnStruct(pTxn, 
+                     0, 
+                     pTxResult->tResultsInfoReadTxn.pTxResultInfo, 
+                     sizeof(TxResultInterface_t), 
+                     (TTxnDoneCb)txResult_StateMachine, 
+                     hTxResult)
+
+    txResult_Restart (pTxResult);
+
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *               txResult_Restart()
+ ****************************************************************************
+   DESCRIPTION:  
+   ============
+     Restarts the Tx-Result module.
+     Called upon init and recovery.
+     Shouldn't be called upon disconnect, since the FW provides Tx-Complete
+       for all pending packets in FW!!
+ ****************************************************************************/
+static void txResult_Restart (TTxResultObj *pTxResult)
+{
+	pTxResult->uHostResultsCounter = 0;
+    pTxResult->eState = TX_RESULT_STATE_IDLE;      
+}
+
+
+/****************************************************************************
+ *                      txResult_setHwInfo()
+ ****************************************************************************
+ * DESCRIPTION:  
+ *      Called after the HW configuration upon init or recovery.
+ *      Store the Tx-result table HW address.
+ ****************************************************************************/
+void  txResult_setHwInfo(TI_HANDLE hTxResult, TDmaParams *pDmaParams)
+{
+    TTxResultObj *pTxResult = (TTxResultObj *)hTxResult;
+
+    pTxResult->uTxResultInfoAddr = (TI_UINT32)(pDmaParams->fwTxResultInterface);
+	pTxResult->uTxResultHostCounterAddr = pTxResult->uTxResultInfoAddr + 
+		TI_FIELD_OFFSET(TxResultControl_t, TxResultHostCounter);
+
+    txResult_Restart (pTxResult);
+} 
+
+
+/****************************************************************************
+ *                      txResult_TxCmpltIntrCb()
+ ****************************************************************************
+ * DESCRIPTION:   
+ * ============
+ *  Called upon DATA interrupt from the FW.
+ *  If new Tx results are available, start handling them.
+ * 
+ * INPUTS:  hTxResult - the txResult object handle.
+ *          pFwStatus - The FW status registers read by the FwEvent
+ *  
+ * OUTPUT:  None
+ * 
+ * RETURNS: void                  
+ ***************************************************************************/
+void txResult_TxCmpltIntrCb (TI_HANDLE hTxResult, FwStatus_t *pFwStatus)
+{
+    TTxResultObj   *pTxResult = (TTxResultObj *)hTxResult;
+    TI_UINT32      uTempCounters;
+    FwStatCntrs_t  *pFwStatusCounters;
+
+#ifdef TI_DBG
+    pTxResult->uInterruptsCounter++;
+
+    if (pTxResult->eState != TX_RESULT_STATE_IDLE)
+    {
+        TRACE1(pTxResult->hReport, REPORT_SEVERITY_INFORMATION, ": called in eState %d, so exit\n", pTxResult->eState);
+        return;
+    }
+#endif
+
+    /* If no new results - exit (may happen since Data interrupt is common to all Tx&Rx events) */
+    uTempCounters = ENDIAN_HANDLE_LONG(pFwStatus->counters);
+    pFwStatusCounters = (FwStatCntrs_t *)&uTempCounters;
+    if (pFwStatusCounters->txResultsCntr == (TI_UINT8)pTxResult->uHostResultsCounter)
+    {
+        TRACE0(pTxResult->hReport, REPORT_SEVERITY_INFORMATION, ": No new Tx results\n");
+        return;
+    }
+
+    /* Call the SM to handle the new Tx results */
+    txResult_StateMachine (hTxResult);
+}
+
+
+/****************************************************************************
+ *                      txResult_StateMachine()
+ ****************************************************************************
+ * DESCRIPTION:  
+ *
+ *  The main SM of the module. Called in IDLE eState by txResult_TxCmpltIntrCb() on 
+ *      Data interrupt from the FW. 
+ *  If no new results - exit (may happen since Data interrupt is common to all Tx&Rx events)
+ *  Read all Tx-Result cyclic table.
+ *  Go over the new Tx-results and call the upper layer callback function for each packet result.
+ *  At the end - write the new host counter to the FW.
+ *          
+ * INPUTS:  
+ *
+ * OUTPUT:  
+ * 
+ * RETURNS: None 
+ ****************************************************************************/
+static void txResult_StateMachine (TI_HANDLE hTxResult)
+{
+    TTxResultObj *pTxResult  = (TTxResultObj *)hTxResult;
+	ETxnStatus   eTwifStatus = TXN_STATUS_COMPLETE;  /* Last bus operation status: Complete (Sync) or Pending (Async). */
+    TTxnStruct   *pTxn       = &(pTxResult->tResultsInfoReadTxn.tTxnStruct);
+ 
+    /* Loop while processing is completed in current context (sync), or until fully completed */
+    while (eTwifStatus == TXN_STATUS_COMPLETE)
+    {
+        TRACE2(pTxResult->hReport, REPORT_SEVERITY_INFORMATION, ": eState = %d, eTwifStatus = %d\n", pTxResult->eState, eTwifStatus);
+
+        switch(pTxResult->eState) 
+        {
+        case TX_RESULT_STATE_IDLE:
+            /* Read Tx-Result queue and counters. */
+            pTxn->uHwAddr = pTxResult->uTxResultInfoAddr;
+            eTwifStatus = twIf_Transact (pTxResult->hTwIf, pTxn);
+
+            pTxResult->eState = TX_RESULT_STATE_READING;
+            break;
+    
+        case TX_RESULT_STATE_READING:
+            /* Process new Tx results, call upper layers to handle them and update host-index in the FW. */
+            txResult_HandleNewResults (pTxResult);
+            pTxResult->eState = TX_RESULT_STATE_IDLE;
+            return;  /*********  Exit after all processing is finished  **********/
+
+        default:
+            TRACE1(pTxResult->hReport, REPORT_SEVERITY_ERROR, ": Unknown eState = %d\n", pTxResult->eState);
+            return;
+        }
+    }
+
+    if (eTwifStatus == TXN_STATUS_ERROR)
+    {   
+        TRACE2(pTxResult->hReport, REPORT_SEVERITY_ERROR, ": returning ERROR in eState %d, eTwifStatus=%d !!!\n", pTxResult->eState, eTwifStatus);
+    }
+}
+
+
+/****************************************************************************
+ *                      txResult_HandleNewResults()
+ ****************************************************************************
+ * DESCRIPTION:   
+ * ============
+ *	We now have the Tx Result table info from the FW so do as follows:
+ *	1.	Find the number of new results (FW counter minus host counter), and if 0 exit.
+ *  2.	Call the upper layers callback per Tx result. 
+ *	3.	Update Host-Counter to be equal to the FW-Counter, and write it to the FW.
+ ***************************************************************************/
+static void txResult_HandleNewResults (TTxResultObj *pTxResult)
+{
+	TI_UINT32 uNumNewResults;    /* The number of new Tx-Result entries to be processed. */
+	TI_UINT32 uFwResultsCounter; /* The FW current results counter (accumulated). */
+	TI_UINT32 uTableIndex;
+	TI_UINT32 i;
+	TxResultDescriptor_t *pCurrentResult;
+    TTxnStruct *pTxn = &(pTxResult->tHostCounterWriteTxn.tTxnStruct);
+
+	/* The uFwResultsCounter is the accumulated number of Tx-Results provided by the FW, and the 
+	 *   uHostResultsCounter is the accumulated number of Tx-Results processed by the host.
+	 * The delta is the number of new Tx-results in the queue, waiting for host processing.
+	 * Since the difference is always a small positive number, a simple subtraction is good
+	 *   also for wrap around case.
+	 */
+	uFwResultsCounter = ENDIAN_HANDLE_LONG(((TxResultInterface_t*)(pTxResult->tResultsInfoReadTxn.pTxResultInfo))->TxResultControl.TxResultFwCounter);
+	uNumNewResults = uFwResultsCounter - pTxResult->uHostResultsCounter;
+
+#ifdef TI_DBG
+	/* Verify there are new entries (was already checked in txResult_TxCmpltIntrCb) */
+	if (uNumNewResults == 0)
+	{
+TRACE2(pTxResult->hReport, REPORT_SEVERITY_WARNING, ": No New Results although indicated by FwStatus!!  HostCount=%d, FwCount=%d\n", pTxResult->uHostResultsCounter, uFwResultsCounter);
+		return;
+	}
+#endif
+
+	/* Update host results-counter in FW to be equal to the FW counter (all new results were processed). */
+	*((TI_UINT32*)(pTxResult->tHostCounterWriteTxn.pCounter)) = ENDIAN_HANDLE_LONG(uFwResultsCounter);
+    pTxn->uHwAddr = pTxResult->uTxResultHostCounterAddr; 
+    twIf_Transact(pTxResult->hTwIf, pTxn);
+
+    TRACE3(pTxResult->hReport, REPORT_SEVERITY_INFORMATION, ": NumResults=%d, OriginalHostCount=%d, FwCount=%d\n", uNumNewResults, pTxResult->uHostResultsCounter, uFwResultsCounter);
+
+	/* Loop over all new Tx-results and call Tx-complete callback with current entry pointer. */
+    /* NOTE: THIS SHOULD COME LAST because it may lead to driver-stop process!! */
+	for (i = 0; i < uNumNewResults; i++)
+	{
+		uTableIndex = pTxResult->uHostResultsCounter & TX_RESULT_QUEUE_DEPTH_MASK;
+		pCurrentResult = &(((TxResultInterface_t*)(pTxResult->tResultsInfoReadTxn.pTxResultInfo))->TxResultQueue[uTableIndex]);
+        pTxResult->uHostResultsCounter++;
+
+        TRACE1(pTxResult->hReport, REPORT_SEVERITY_INFORMATION , ": call upper layer CB, Status = %d\n", pCurrentResult->status);
+
+		pTxResult->fSendPacketCompleteCb (pTxResult->hSendPacketCompleteHndl, pCurrentResult);
+	}
+}
+
+
+/****************************************************************************
+ *                      txResult_RegisterCb()
+ ****************************************************************************
+ * DESCRIPTION:  Register the upper driver Tx-Result callback functions.
+ ****************************************************************************/
+void txResult_RegisterCb (TI_HANDLE hTxResult, TI_UINT32 uCallBackId, void *CBFunc, TI_HANDLE hCbObj)
+{
+    TTxResultObj* pTxResult = (TTxResultObj*)hTxResult;
+
+    switch (uCallBackId)
+    {
+        /* Set Tx-Complete callback */
+        case TWD_INT_SEND_PACKET_COMPLETE:
+            pTxResult->fSendPacketCompleteCb   = (TSendPacketCompleteCb)CBFunc;
+            pTxResult->hSendPacketCompleteHndl = hCbObj;
+            break;
+
+        default:
+            TRACE0(pTxResult->hReport, REPORT_SEVERITY_ERROR, ": Illegal value\n");
+            return;
+    }
+}
+
+
+#ifdef TI_DBG      /*  Debug Functions   */
+
+/****************************************************************************
+ *                      txResult_PrintInfo()
+ ****************************************************************************
+ * DESCRIPTION:  Prints TX result debug information.
+ ****************************************************************************/
+void txResult_PrintInfo (TI_HANDLE hTxResult)
+{
+    TTxResultObj* pTxResult = (TTxResultObj*)hTxResult;
+
+    WLAN_OS_REPORT(("Tx-Result Module Information:\n"));
+    WLAN_OS_REPORT(("=============================\n"));
+    WLAN_OS_REPORT(("uInterruptsCounter:     %d\n", pTxResult->uInterruptsCounter));
+    WLAN_OS_REPORT(("uHostResultsCounter:    %d\n", pTxResult->uHostResultsCounter));
+    WLAN_OS_REPORT(("=============================\n"));
+}
+
+
+/****************************************************************************
+ *                      txResult_ClearInfo()
+ ****************************************************************************
+ * DESCRIPTION:  Clears TX result debug information.
+ ****************************************************************************/
+void txResult_ClearInfo (TI_HANDLE hTxResult)
+{
+    TTxResultObj* pTxResult = (TTxResultObj*)hTxResult;
+
+    pTxResult->uInterruptsCounter = 0;
+}
+
+#endif  /* TI_DBG */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FW_Transfer/txXfer.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,328 @@
+/*
+ * txXfer.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  txXfer.c
+ *   
+ *   PURPOSE: Handle Tx frame transfer to the firmware. 
+ * 
+ *   DESCRIPTION:  
+ *   ============
+ *      This module gets the upper driver's Tx packets after FW resources were
+ *        allocated for it, and handles its transfer to the FW via the 
+ *        host slave (indirect) interface, using the TwIf Transaction API.
+ *
+ ****************************************************************************/
+
+#define __FILE_ID__  FILE_ID_108
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "TwIf.h"
+#include "TWDriver.h"
+#include "FwEvent_api.h"
+#include "txXfer_api.h"
+
+
+
+typedef struct 
+{
+    TTxnStruct              tTxnStruct;
+    TI_UINT8                *pPktsCntr; 
+} TPktsCntrTxn;
+
+
+/* The TxXfer module object. */
+typedef struct 
+{
+    TI_HANDLE               hOs;
+    TI_HANDLE               hReport;
+    TI_HANDLE               hTwIf;
+
+    TSendPacketTranferCb    fSendPacketTransferCb;   /* Upper layer Xfer-Complete callback */
+    TI_HANDLE               hSendPacketTransferHndl; /* Upper layer Xfer-Complete callback handle */
+
+    TI_UINT32               uPktsCntr; 
+    TPktsCntrTxn            aPktsCntrTxn[CTRL_BLK_ENTRIES_NUM]; 
+
+} TTxXferObj;
+
+static void txXfer_TransferDoneCb (TI_HANDLE hTxXfer, TTxnStruct *pTxn);
+
+
+
+/****************************************************************************
+ *                      txXfer_Create()
+ ****************************************************************************
+ * DESCRIPTION: Create the Xfer module object 
+ * 
+ * INPUTS:  None
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: The Created object
+ ****************************************************************************/
+TI_HANDLE txXfer_Create(TI_HANDLE hOs)
+{
+    TTxXferObj *pTxXfer;
+    int i;
+
+    pTxXfer = os_memoryAlloc (hOs, sizeof(TTxXferObj), MemoryNormal);
+    if (pTxXfer == NULL)
+    {
+        return NULL;
+    }
+
+    os_memoryZero (hOs, pTxXfer, sizeof(TTxXferObj));
+
+    for (i = 0; i < CTRL_BLK_ENTRIES_NUM; i++) 
+    {
+        pTxXfer->aPktsCntrTxn[i].pPktsCntr = os_memoryAlloc (hOs, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ, MemoryDMA);
+        if (pTxXfer->aPktsCntrTxn[i].pPktsCntr == NULL) 
+        {
+            return NULL;
+        }
+        os_memoryZero (hOs, pTxXfer->aPktsCntrTxn[i].pPktsCntr, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+        pTxXfer->aPktsCntrTxn[i].pPktsCntr += WSPI_PAD_LEN_READ;
+    }
+    
+    pTxXfer->hOs = hOs;
+
+    return (TI_HANDLE)pTxXfer;
+}
+
+
+/****************************************************************************
+ *                      txXfer_Destroy()
+ ****************************************************************************
+ * DESCRIPTION: Destroy the Xfer module object 
+ * 
+ * INPUTS:  hTxXfer - The object to free
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+TI_STATUS txXfer_Destroy(TI_HANDLE hTxXfer)
+{
+    TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer;
+    int i;
+
+    if (pTxXfer)
+    {
+        for (i = 0; i < CTRL_BLK_ENTRIES_NUM; i++) 
+        {
+            if (pTxXfer->aPktsCntrTxn[i].pPktsCntr) 
+            {
+                os_memoryFree (pTxXfer->hOs, ((TI_UINT8*)pTxXfer->aPktsCntrTxn[i].pPktsCntr) - WSPI_PAD_LEN_READ, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+            }
+        }
+        
+        os_memoryFree (pTxXfer->hOs, pTxXfer, sizeof(TTxXferObj));
+    }
+
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *               txXfer_init()
+ ****************************************************************************
+   DESCRIPTION:  
+   ============
+     Initialize the Xfer module.
+ ****************************************************************************/
+TI_STATUS txXfer_Init (TI_HANDLE hTxXfer, TI_HANDLE hReport, TI_HANDLE hTwIf)
+{
+    TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer;
+    TTxnStruct *pTxn;
+    TI_UINT8    i;
+
+    pTxXfer->hReport = hReport;
+    pTxXfer->hTwIf   = hTwIf;
+    pTxXfer->fSendPacketTransferCb = NULL;
+
+    
+    pTxXfer->uPktsCntr = 0;
+    for (i = 0; i < CTRL_BLK_ENTRIES_NUM; i++)
+    {
+        pTxn = &(pTxXfer->aPktsCntrTxn[i].tTxnStruct);
+        TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+        BUILD_TTxnStruct(pTxn, HOST_WR_ACCESS_REG, pTxXfer->aPktsCntrTxn[i].pPktsCntr, REGISTER_SIZE, NULL, NULL)
+    }
+
+    return txXfer_Restart(hTxXfer);
+}
+
+
+/****************************************************************************
+ *               txXfer_Restart()
+ ****************************************************************************
+   DESCRIPTION:  
+   ============
+     Restart the Xfer module.
+ ****************************************************************************/
+TI_STATUS txXfer_Restart (TI_HANDLE hTxXfer)
+{
+    TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer;
+
+    pTxXfer->uPktsCntr = 0;
+
+    return TI_OK;
+}
+
+
+/****************************************************************************
+ *                  txXfer_sendPacket()
+ ****************************************************************************
+ * DESCRIPTION: 
+   ============
+   Send packet to the transaction queue.
+   Return the transfer status:
+     TXN_STATUS_COMPLETE - if completed, i.e. Synchronous mode.
+     TXN_STATUS_PENDING  - if pending, i.e. Asynchronous mode. 
+   Note that in case of PENDING, a callback function will be called 
+       only if registered (needed for WHA).
+ ****************************************************************************/
+ETxnStatus txXfer_SendPacket (TI_HANDLE hTxXfer, TTxCtrlBlk *pPktCtrlBlk)
+{
+    TTxXferObj   *pTxXfer = (TTxXferObj *)hTxXfer;
+    TTxnStruct   *pTxn    = (TTxnStruct *)pPktCtrlBlk;
+    ETxnStatus   eStatus; 
+    TPktsCntrTxn *pPktsCntrTxn; 
+    
+    /* Prepare the Txn fields to the host-slave register (fixed address) */
+    TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_FIXED_ADDR)
+    pTxn->uHwAddr = SLV_MEM_DATA;
+
+    /* Fill the TxnDone CB only if registered by the upper layers */
+    if (pTxXfer->fSendPacketTransferCb == NULL)
+    {
+        pTxn->fTxnDoneCb = NULL;
+    }
+    else 
+    {
+        pTxn->fTxnDoneCb = (TTxnDoneCb)txXfer_TransferDoneCb;
+        pTxn->hCbHandle  = hTxXfer;
+    }
+
+    /* Send the transaction */
+    eStatus = twIf_Transact (pTxXfer->hTwIf, pTxn);
+
+#ifdef TI_DBG
+
+    TRACE11(pTxXfer->hReport, REPORT_SEVERITY_INFORMATION, ": Status=%d, PktType=%d, Len0=%d, Len1=%d, Length=%d, ExtraBlks=%d, TotalBlks=%d, TxAttr=0x%x, TID=%d, DescID=%d, StartTime=%d\n", eStatus, pPktCtrlBlk->tTxPktParams.uPktType, pPktCtrlBlk->tTxnStruct.aLen[0], pPktCtrlBlk->tTxnStruct.aLen[1], pPktCtrlBlk->tTxDescriptor.length, pPktCtrlBlk->tTxDescriptor.extraMemBlks, pPktCtrlBlk->tTxDescriptor.totalMemBlks, pPktCtrlBlk->tTxDescriptor.txAttr, pPktCtrlBlk->tTxDescriptor.tid, pPktCtrlBlk->tTxDescriptor.descID, pPktCtrlBlk->tTxDescriptor.startTime);
+
+    if (eStatus == TXN_STATUS_ERROR)
+    {
+        TI_UINT32 i;
+        for (i = 0; i < MAX_XFER_BUFS; i++)
+        {
+            if (pPktCtrlBlk->tTxnStruct.aLen[i] == 0)
+            {
+                break;
+            }
+            TRACE1(pTxXfer->hReport, REPORT_SEVERITY_CONSOLE, "txXfer_SendPacket():  Tx Buffer %d:\n", i);
+            WLAN_OS_REPORT (("txXfer_SendPacket():  Tx Buffer %d:\n", i));
+            report_PrintDump(pPktCtrlBlk->tTxnStruct.aBuf[i], pPktCtrlBlk->tTxnStruct.aLen[i]);
+        }
+    }
+
+#endif  /* TI_DBG */
+
+    
+    pTxXfer->uPktsCntr++;
+    pPktsCntrTxn = &(pTxXfer->aPktsCntrTxn[pTxXfer->uPktsCntr % CTRL_BLK_ENTRIES_NUM]);
+    *((TI_UINT32*)(pPktsCntrTxn->pPktsCntr)) = ENDIAN_HANDLE_LONG(pTxXfer->uPktsCntr);
+    pPktsCntrTxn->tTxnStruct.uHwAddr = HOST_WR_ACCESS_REG;
+    twIf_Transact(pTxXfer->hTwIf, &pPktsCntrTxn->tTxnStruct);
+
+    /* Return the Txn result - COMPLETE or PENDING. */
+    /* Note: For PENDING, a callback function will be called only if registered (needed for WHA) */
+    return eStatus;
+}
+
+
+/****************************************************************************
+ *                      txXfer_TransferDoneCb()
+ ****************************************************************************
+ * DESCRIPTION:  Call the upper layers TranferDone callback, providing the TxCtrlBlk
+ ****************************************************************************/
+static void txXfer_TransferDoneCb (TI_HANDLE hTxXfer, TTxnStruct *pTxn)
+{
+    TTxXferObj *pTxXfer = (TTxXferObj*)hTxXfer;
+
+    TRACE1(pTxXfer->hReport, REPORT_SEVERITY_INFORMATION, ": pTxn=0x%x\n", pTxn);
+
+    /* Call the upper layers TranferDone callback, providing the TxCtrlBlk. */
+    /* Note: If this CB was called it means that the upper CB exists (see in txXfer_SendPacket) */
+    pTxXfer->fSendPacketTransferCb (pTxXfer->hSendPacketTransferHndl, (TTxCtrlBlk *)pTxn);
+}
+
+
+/****************************************************************************
+ *                      txXfer_RegisterCb()
+ ****************************************************************************
+ * DESCRIPTION:  Register the upper driver Xfer callback functions.
+ ****************************************************************************/
+void txXfer_RegisterCb (TI_HANDLE hTxXfer, TI_UINT32 CallBackID, void *CBFunc, TI_HANDLE CBObj)
+{
+    TTxXferObj* pTxXfer = (TTxXferObj*)hTxXfer;
+
+    TRACE3(pTxXfer->hReport, REPORT_SEVERITY_INFORMATION, ": CallBackID=%d, CBFunc=0x%x, CBObj=0x%x\n", CallBackID, CBFunc, CBObj);
+
+    switch(CallBackID)
+    {
+        /* Save upper layers Transfer-Done callback */
+        case TWD_INT_SEND_PACKET_TRANSFER:
+            pTxXfer->fSendPacketTransferCb   = (TSendPacketTranferCb)CBFunc;
+            pTxXfer->hSendPacketTransferHndl = CBObj;
+            break;
+
+        default:
+            TRACE0(pTxXfer->hReport, REPORT_SEVERITY_ERROR, " - Illegal value\n");
+            break;
+    }
+}
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FirmwareApi/public_commands.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1585 @@
+/*
+ * public_commands.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/**********************************************************************************************************************
+
+  FILENAME:       public_commands.h
+
+  DESCRIPTION:    Command definitions shared with host
+
+
+
+***********************************************************************************************************************/
+#ifndef PUBLIC_COMMANDS_H
+#define PUBLIC_COMMANDS_H
+
+
+#include "public_types.h"
+#include "public_radio.h"
+
+typedef enum
+{
+    CMD_INTERROGATE     = 1,    /*use this to read information elements*/
+    CMD_CONFIGURE       = 2,    /*use this to write information elements*/
+    CMD_ENABLE_RX       = 3,
+    CMD_ENABLE_TX       = 4,
+    CMD_DISABLE_RX      = 5,
+    CMD_DISABLE_TX      = 6,
+    CMD_SCAN            = 8,
+    CMD_STOP_SCAN       = 9,
+
+    CMD_START_JOIN      = 11,
+    CMD_SET_KEYS        = 12,
+    CMD_READ_MEMORY     = 13,
+    CMD_WRITE_MEMORY    = 14,
+
+    CMD_SET_TEMPLATE    = 19,
+    CMD_TEST            = 23,
+
+    CMD_NOISE_HIST      = 28,
+    
+    CMD_LNA_CONTROL     = 32,
+    CMD_SET_BCN_MODE    = 33,
+
+    CMD_MEASUREMENT      = 34,
+    CMD_STOP_MEASUREMENT = 35,
+    CMD_DISCONNECT       = 36,
+    CMD_SET_PS_MODE      = 37,
+
+    CMD_CHANNEL_SWITCH   = 38,
+    CMD_STOP_CHANNEL_SWICTH = 39,
+
+    CMD_AP_DISCOVERY     = 40,
+    CMD_STOP_AP_DISCOVERY = 41,
+
+    CMD_SPS_SCAN = 42,
+    CMD_STOP_SPS_SCAN = 43,
+    
+    CMD_HEALTH_CHECK     = 45,     
+    CMD_DEBUG            = 46, 
+    CMD_TRIGGER_SCAN_TO  = 47,
+
+    CMD_CONNECTION_SCAN_CFG        = 48,
+    CMD_CONNECTION_SCAN_SSID_CFG   = 49,
+    CMD_START_PERIODIC_SCAN        = 50,
+    CMD_STOP_PERIODIC_SCAN         = 51,
+    CMD_SET_STA_STATE              = 52,
+
+NUM_COMMANDS,
+    MAX_COMMAND_ID = 0xFFFF
+} Command_enum;
+
+#ifdef HOST_COMPILE
+typedef uint16 Command_e;
+#else
+typedef Command_enum Command_e;
+#endif
+
+
+#ifdef HOST_COMPILE
+
+#define     CMD_MAILBOX_IDLE               0
+#define     CMD_STATUS_SUCCESS             1
+#define     CMD_STATUS_UNKNOWN_CMD         2
+#define     CMD_STATUS_UNKNOWN_IE          3
+#define     CMD_STATUS_REJECT_MEAS_SG_ACTIVE    11
+#define     CMD_STATUS_RX_BUSY             13
+#define     CMD_STATUS_INVALID_PARAM       14
+#define     CMD_STATUS_TEMPLATE_TOO_LARGE  15 
+#define     CMD_STATUS_OUT_OF_MEMORY       16 
+#define     CMD_STATUS_STA_TABLE_FULL      17
+#define     CMD_STATUS_RADIO_ERROR         18
+#define     CMD_STATUS_WRONG_NESTING       19
+#define     CMD_STATUS_TIMEOUT             21 /* Driver internal use.*/
+#define     CMD_STATUS_FW_RESET            22 /* Driver internal use.*/
+#define     MAX_COMMAND_STATUS             MAX_POSITIVE16
+
+#else
+
+typedef enum
+{
+    CMD_MAILBOX_IDLE              =  0,
+    CMD_STATUS_SUCCESS            =  1,
+    CMD_STATUS_UNKNOWN_CMD        =  2,
+    CMD_STATUS_UNKNOWN_IE         =  3,
+    CMD_STATUS_REJECT_MEAS_SG_ACTIVE =  11,
+    CMD_STATUS_RX_BUSY            = 13,
+    CMD_STATUS_INVALID_PARAM      = 14,
+    CMD_STATUS_TEMPLATE_TOO_LARGE = 15, 
+    CMD_STATUS_OUT_OF_MEMORY      = 16, 
+    CMD_STATUS_STA_TABLE_FULL     = 17,
+    CMD_STATUS_RADIO_ERROR        = 18,
+    CMD_STATUS_WRONG_NESTING      = 19,
+    CMD_STATUS_TIMEOUT            = 21, /* Driver internal use.*/
+    CMD_STATUS_FW_RESET           = 22, /* Driver internal use.*/
+    MAX_COMMAND_STATUS            = MAX_POSITIVE16
+} CommandStatus_enum;
+
+#endif
+
+#ifdef HOST_COMPILE
+typedef uint16 CommandStatus_e;
+#else
+typedef CommandStatus_enum CommandStatus_e;
+#endif
+
+#define MAX_CMD_PARAMS 610
+
+#define DEBUG_INDICATOR      0x8000    
+
+typedef struct
+{
+    Command_e cmdID;
+    CommandStatus_e cmdStatus;
+    uint8 parameters[MAX_CMD_PARAMS];
+} Command_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_INTERROGATE
+    Desc:     This command requests an information element from the WiLink. The 
+              interface for this command is somewhat different from other commands 
+              since the interface is bi-directional and asymmetric. 
+              The host structure consists of the Command ID, a Command Status 
+              (returned by WiLink) place holder, and the Information Element Heading
+              (ID and expected length).
+              The response to that command is a buffer of the information element's 
+              actual values returned by the WiLink just after the command is issued.
+              The response to that command is a buffer of the information element's 
+              actual values returned by the WiLink just after the command is issued.
+    Params:   InfoElement_t - see below.
+              
+    
+******************************************************************************/
+/*
+Description of InfoElement structure - defined in "public_infoele.h"
+offset  length  source  description
+======  ======  ======  ===========
+0       2       host    Information Element ID - contains the ID of the requested 
+                        information element (refer to InfoElement_enum in 
+                        pblic_infoele.h). In response to this command, the WiLink 
+                        writes the requested information element to the response area 
+                        for the command mailbox.
+2       4       wilink  Length - the length of the response (different for each IE
+                        according to definitions in public_infoele.h).
+4       Length  wilink  IE payload according to definition in public_infoele.h.
+*/
+
+
+
+/******************************************************************************
+
+    ID:       CMD_CONFIGURE
+    Desc:     This command configures an information element in the WiLink. 
+    Params:   InfoElement_t - see below.
+
+******************************************************************************/
+/*
+Description of InfoElement structure - defined in "public_infoele.h"
+offset  length  source  description
+======  ======  ======  ===========
+0       2       host    Information Element ID - contains the ID of the requested 
+                        information element (refer to InfoElement_enum in 
+                        pblic_infoele.h). In response to this command, the WiLink 
+                        writes the requested information element to the response area 
+                        for the command mailbox.
+2       4       host    Length - the length of the response (different for each IE
+                        according to definitions in public_infoele.h).
+4       Length  host    IE payload according to definition in public_infoele.h.
+*/
+
+
+/******************************************************************************
+
+    ID:       CMD_ENABLE_RX
+    Desc:     This command enables the normal reception of frames. 
+    Params:   Channel Number - this field indicates the radio channel on which to
+                               receive data. This parameter also sets the channel on
+                               which to transmit. The last channel number used, 
+                               regardless of the order in which the ENABLE_RX and 
+                               ENABLE_TX commands are issued, is the channel number 
+                               for both RX and TX. This command must be issued after 
+                               the host has set all necessary configuration elements 
+                               appropriately.
+    
+******************************************************************************/
+
+
+
+/******************************************************************************
+
+    ID:       CMD_ENABLE_TX
+    Desc:     This command enables the normal transmission of frames.  
+    Params:   Channel Number - this field indicates the radio channel on which to
+                               transmit data. This parameter also sets the channel on
+                               which to receive. The last channel number used, 
+                               regardless of the order in which the ENABLE_RX and 
+                               ENABLE_TX commands are issued, is the channel number 
+                               for both RX and TX. This command must be issued after
+                               the host has set all necessary configuration elements
+                               appropriately.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_DISABLE_RX
+    Desc:     This command disables the normal reception of packets over the 
+              Baseband interface. 
+    Params:   None
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_DISABLE_TX
+    Desc:     This command disables the normal transmission of frames. 
+    Params:   None.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_SCAN
+    Desc:     This command instructs the WiLink to scan for BSS/IBSSs. The host 
+              may perform either an active scan or a passive scan. During an active
+              scan, the WiLink transmits a probe request on the specified channel(s) 
+              and then listens for beacon/probe responses. During a passive scan, the 
+              WiLink monitors the specified channel(s) for beacons.
+              The WiLink sends SCAN_COMPLETE event to notify the host when it has 
+              completed a scan.
+    Params:   ScanParameters_t - see below
+    
+******************************************************************************/
+/*
+Offset  Length  Definition
+0       8       RX filters for Scan (refer to ACXRxConfigStruct)
+8       2       Scan options (Band select, Voice mode and Scan type = Active/Passive)
+10      1       NumChannels 
+11      1       Number of Probe requests (used for Active scan)
+12      2       Probe request rate & modulation
+14      1       AC trigger (for Voice mode only)
+15      1       SSID length
+16      32      SSID string (Null terminated)
+48      2       Channel [0] ScanMinDuration
+50      2       Channel [0] ScanMaxDuration 
+52      6       Channel [0] BSSID (4 bytes LOW and 2 bytes HIGH)
+58      1       Channel [0].bit0-3: Early Termination count. Bit 4-5: Condition
+59      1       Channel [0] TX power level for Scan (0 means do not change - other values:1-5)
+60      1       Channel [0] Channel  
+61      3       Channel [0] Reserved
+64-404  340     Optional Channel [1] - Channel [15] - same format as Channel [0] fields above.
+*/
+
+/* Defines for Rx "ConfigOptions".*/
+/* Only bits 2-10 can be configured by the Driver".*/
+#define CFG_RX_SERIAL           BIT_0    /* 0 = use parallel interface,         1 = use serial interface from ACX101- not valid.*/
+#define CFG_RX_RAW              BIT_1    /* 1 = write all data from baseband to frame buffer including PHY header.*/
+#define CFG_RX_FCS              BIT_2    /* 1 = write FCS to end of frame in memory, 0 = do not write FCS to memory.*/
+#define CFG_RX_ALL_GOOD         BIT_3    /* promiscuous mode, receive all good frames.*/
+#define CFG_UNI_FILTER_EN       BIT_4    /* local MAC address filter enable.*/
+#define CFG_BSSID_FILTER_EN     BIT_5    /* BSSID filter enable.*/
+#define CFG_MC_FILTER_EN        BIT_6    /* 0 = receive all multicast,          1 = use one or both multicast address filters.*/
+#define CFG_MC_ADDR0_EN         BIT_7    /* 1 = receive frames from mc_addr0,   0 = do not use this filter.*/
+#define CFG_MC_ADDR1_EN         BIT_8    /* 1 = receive frames from mc_addr1,   0 = do not use this filter .*/
+#define CFG_BC_REJECT_EN        BIT_9    /* 0 = receive all broadcast,          1 = filter all broadcast.*/
+#define CFG_SSID_FILTER_EN      BIT_10   /* SSID Filter Enable.*/
+#define CFG_RX_INT_FCS_ERROR    BIT_11   /* 1 = give rx complete interrupt for FCS errors.*/
+#define CFG_RX_INT_ENCRYPTED    BIT_12   /* 1 = only give rx header interrupt if frame is encrypted.*/
+#define CFG_RX_WR_RX_STATUS     BIT_13   /* 0 = do not write three status words, 1 = write three receive status words to top of rx'd MPDU.*/
+#define CFG_RX_FILTER_NULTI     BIT_14   /* 1 = filter multicast/broadcast frame if SA matchs local MAC addr->.*/
+#define CFG_RX_RESERVE          BIT_15   /* reserve.*/
+#define CFG_RX_TIMESTAMP_TSF    BIT_16   /* 1 = sample frame's' arrival time in 32bits TSF, 0 = write it in MAC time stamp.*/
+
+
+/* Defines for Rx "FilterOptions".*/
+/* The rx filter enables control what type of receive frames will be rejected or received by the rx hardware*/
+/* 1 = frame is written to memory,*/
+/* 0 = not written to memory, rejected.*/
+#define CFG_RX_RSV_EN       BIT_0  /* reserved types and subtypes.*/
+#define CFG_RX_RCTS_ACK     BIT_1  /* rts, cts, ack frames.*/
+#define CFG_RX_PRSP_EN      BIT_2  /* probe response.*/
+#define CFG_RX_PREQ_EN      BIT_3  /* probe request.*/
+#define CFG_RX_MGMT_EN      BIT_4  /* type = management.*/
+#define CFG_RX_FCS_ERROR    BIT_5  /* frames with FCS errors.*/
+#define CFG_RX_DATA_EN      BIT_6  /* type = data.*/
+#define CFG_RX_CTL_EN       BIT_7  /* type = control.*/
+#define CFG_RX_CF_EN        BIT_8  /* contention free frames.*/
+#define CFG_RX_BCN_EN       BIT_9  /* beacons.*/
+#define CFG_RX_AUTH_EN      BIT_10 /* authentication, deauthentication.*/
+#define CFG_RX_ASSOC_EN     BIT_11 /* association related frames (all 5 subtypes – assoc req/resp,*/
+
+
+typedef struct
+{
+    uint32          ConfigOptions;
+    uint32          FilterOptions;
+} ACXRxConfigStruct;
+
+
+/* ScanOptions bit mask field.*/
+#define SCAN_ACTIVE         0
+#define SCAN_PASSIVE        1   /* 1 = passive scan, 0 = active scan*/
+/* #define SCAN_5GHZ_BAND      2  */  /* 1 = scan channel list in 5 Ghz band, 0 = scan channel list in 2.4 Ghz band*/ 
+#define TRIGGERED_SCAN      2   /* 1 = Triggered scan, 0 = Normal scan*/
+#define SCAN_PRIORITY_HIGH  4   /* 1 = High priority scan, 0 = Low priority scan*/
+ 
+typedef uint8 TidTrigger_t;
+
+/* General scan parameters.*/
+typedef struct
+{
+    ACXRxConfigStruct  rxCfg;         /* Rx filter to be used for each channel scan. */
+                                      /* The BSSID filter enable will be set (by the */
+                                      /* scan process) to ON for a specific channel if*/
+                                      /* the BSSID of this channel is a unicast address.*/
+                                      /* Otherwise it will be set to OFF (Refer to */
+                                      /* ACXRxConfig IE in public_infoele.h).*/
+
+    uint16             scanOptions;   /* This bitwise field indicates the scan options. */
+                                      /* Bits [4:15] are reserved. */
+                                      /* Bits [0:3] are defined as follows: */
+                                      /* Scan Type (bit 0) - When this bit is set, the */
+                                      /*  WiLink performs a passive scan. When this bit*/
+                                      /*  is cleared, the WiLink performs an active scan. */
+                                      /* Band Select (bit 1) - When this bit is set, the*/
+                                      /*  WiLink scans the specified channels in the */
+                                      /*  5GHz band. When this bit is cleared, the */
+                                      /*  WiLink scans the specified channels in the */
+                                      /*  2.4GHz band. */
+                                      /* Voice mode (bit 2) - When this bit is set, */
+                                      /*  the request is for a voice scan. When this bit*/
+                                      /*  is cleared, the request is for a normal scan. */
+                                      /* Scan priority (bit 3) - When this bit is set, */
+                                      /*  the request is for a high priority scan. When*/
+                                      /*  this bit is cleared, the request is for a low*/
+                                      /*  priority scan.*/
+        
+    uint8              numChannels;   /* Number of scan channels in the list (minimum is*/
+                                      /* 1, maximum is 30).*/
+
+    uint8              numOfProbRqst; /* This field indicates the number of probe */
+                                      /* requests to send per channel, in active scan. */
+    
+    EHwRateBitFiled    txdRateSet;    /* This EHwRateBitFiled format field specifies the rate and */
+                                      /* modulation to transmit the probe request during*/
+	                                  /* an active scan. It is not used for passive scans.*/
+   
+    TidTrigger_t       tidTrigger;    /* used for TidTriggered scan only.*/
+
+    uint8              ssidLength;    /* This field specifies the size of the SSID, */
+                                      /* which can be up to 32 bytes long. If this field*/
+                                      /* equals to zero, SSID filter is not applied. */
+    
+    uint8              padding1[2];    /* in order to align */ 
+
+
+    uint32             ssidStr[8];    /* This field specifies the SSID packets from that*/
+                                      /* are relevant for the Scan result. The WiLink*/
+                                      /* uses this information to filter beacon, probe*/
+                                      /* response frames (if the SSID length field of */
+                                      /* this command structure is not zero) */
+
+    RadioBand_e         band;         /* Band to scan */
+
+    uint8               useSsidList;  /* Whether to use SSID list (configured seperately)
+                                         when transmitting probe-requests */
+
+    uint8               scanTag;      /* Scan results tag */
+
+    uint8               padding2;     /* in order to align */ 
+
+} BasicScanParameters_t;
+
+
+
+#define SCAN_ET_COND_MASK  0x30
+#define SCAN_ET_COUNT_MASK 0x0F
+
+#define SCAN_MAX_NUM_OF_CHANNELS 24
+
+/* Early Termination condition (bits 4-5) - This field can have one of the following */
+/* values (note that bits 0-3 indicates Early Termination count): */
+typedef enum 
+{
+    ET_COND_DISABLE = 0x00,          /* Disable - No early termination condition.*/
+
+    ET_COND_BEACON  = 0x10,          /* Beacon only. When this value is selected, the */
+                                     /* Early Termination count field specifies the */
+                                     /* maximum number of beacons to collect before */
+                                     /* ending a scan. */
+
+    ET_COND_PROBE_RESP = 0x20,       /* Probe responses only. When this value is */
+                                     /* selected, the Early Termination count field */
+                                     /* specifies the maximum number of probe responses*/
+                                     /* to collect before ending a scan. */
+
+    ET_COND_BEACON_PROBE_RESP = 0x30,/* Beacon/probe response. When this value is */
+                                     /* selected, the Early Termination count field */
+                                     /* specifies the maximum number of beacons or probe*/
+                                     /* responses to collect before ending a scan. */
+                                     
+    ET_COND_INVALID = 0xFF
+} ETCondition_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 ETCondition_e;
+#else
+typedef ETCondition_enum ETCondition_e;
+#endif
+
+
+typedef uint8 ETCondCount_t;
+
+
+
+#define PROCESS_SCAN_IS_HIGH(pScanParameters) ((pScanParameters)->basicScanParameters.scanOptions & SCAN_PRIORITY_HIGH)
+#define PROCESS_SCAN_IS_LOW(pScanParameters) ((PROCESS_SCAN_IS_HIGH(pScanParameters)) == 0)
+
+
+/* Per-Channel scan parameters.*/
+typedef struct
+{
+
+    uint32        scanMinDuration;    /* For active scans, this field specifies the */
+                                      /* minimum amount of time, in time units (TUs), */
+                                      /* to wait for a frame on a channel. This */
+                                      /* parameter is not used for passive scans. The*/
+                                      /*  value can range from 0 to 65535 TUs */
+                                      /* (67.1 seconds). */
+
+    uint32        scanMaxDuration;    /* For active scans, this field specifies the */
+                                      /* maximum amount of time, in time units (TUs), */
+                                      /* to wait for a probe response on a channel.*/
+                                      /* For passive scans, this field specifies the */
+                                      /* amount of time, in time units (TUs), to listen*/
+                                      /* on a channel. The value can range from 0 to */
+                                      /* 65535 TUs (67.1 seconds). */
+    
+
+    uint32        bssIdL;             /* 32 LSBits of BSSID of the AP to scan for. */
+                                      /* If scanning on this channel any BSSID, this */
+                                      /* field shall be set to broadcast BSSID. */
+
+    uint16        bssIdH;             /* 16 MSBits of BSSID of the AP to scan for.*/
+
+    ETCondCount_t ETCondCount;        /* bit 0-3: Early Termination count - This field */
+                                      /*          defines the maximum number of beacons*/
+                                      /*          or probe responses or both (according*/
+                                      /*          to condition) to collect before ending*/
+                                      /*          a scan.*/
+    
+                                      /* Bit 4-5: Early Termination Condition (refer */
+                                      /*          to ETCondition_enum).*/
+                
+    uint8         txPowerAttenuation; /* TX power level to be used per channel scanned. */
+                                      /* If 0, leave normal TX power level for this */
+                                      /* channel. Range: 0 - 20 [dB].*/
+    
+    Channel_e     channel;            /* Channel number to scan, valid range 0-255 */
+                                      /* (1-14 for 802.11b). */
+
+    Bool_e        dfsCandidate;       /* FW internal use only! */
+    Bool_e        activityDetected;   /* FW internal use only! */
+
+    uint8         padding[1];             /* for alignment to 32 bits boundry*/
+} BasicScanChannelParameters_t;
+
+/* The Scan command structure.*/
+typedef struct
+{
+    BasicScanParameters_t basicScanParameters; /* refer to BasicScanParameters_t */
+                                               /* definition*/
+
+    BasicScanChannelParameters_t basicScanChannelParameters[SCAN_MAX_NUM_OF_CHANNELS];
+} ScanParameters_t;
+
+/*****************************************************************************
+
+    ID:       CMD_TRIGGER_SCAN_TO
+    Desc:     This Command will configure the enhanced Trigger Scan Timeout 
+                information.
+              To use legacy Trigger Scan, configure the parameter to 0
+    Params:   None
+    
+******************************************************************************/
+typedef struct 
+{
+    uint32  slicedScanTimeOut;          /* 0 - Split Scan Disable
+                                           any other value will represent the timeout 
+                                           for each channel "mini scan" in uSec */
+}enhancedTriggerTO_t;
+
+
+
+/*****************************************************************************
+
+    ID:       CMD_STOP_SCAN
+    Desc:     This command instructs the WiLink to terminate any scan in progress. 
+              After processing this command, the WiLink returns to its previous state
+              (the state before the scan was started) and generates the SCAN_COMPLETE
+              information message. 
+    Params:   None
+    
+******************************************************************************/
+
+
+
+/******************************************************************************
+
+    ID:       CMD_START_JOIN
+    Desc:     This command instructs the WiLink to either join a BSS or IBSS, or 
+              start an IBSS. When the device has joined the BSS or IBSS the Join 
+              Complete event is raised to the host.  
+    Params:   StartJoinRequest_t - see below.
+
+******************************************************************************/
+
+/* 
+ * Join command  control bit mask field:
+ */
+
+
+
+/* Cyclic counter in range 1-7, advanced on every Join command to enable the FW distinguish 
+     between connection sessions and drop obsolete Tx packets. */
+#define JOIN_CMD_CTRL_TX_SESSION       (BIT_3 | BIT_2 | BIT_1)
+
+/* When this bit is set,the firmware will flush all Tx frames in the pipe and will not transmit them. */
+#define JOIN_CMD_CTRL_TX_FLUSH         BIT_7 
+
+/* Offsets of the above fields */
+#define JOIN_CMD_CTRL_OFFSET_TX_SESSION             1
+#define JOIN_CMD_CTRL_OFFSET_TX_FLUSH                      7 
+
+
+typedef enum
+{
+    BSS_TYPE_IBSS = 0,
+    BSS_TYPE_STA_BSS = 2,
+    BSS_TYPE_AP_BSS = 3,
+    MAX_BSS_TYPE = 0xFF
+} BssType_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 BSS_e;
+#else
+typedef BssType_enum BSS_e;
+#endif
+
+#define MAX_SSID_STR_LEN_BYTESX4 8
+
+typedef struct
+{
+    uint32            bssIdL;        /* This field indicates the 32 LSBits of the MAC*/
+                                     /* address of the BSS to join. */
+                                     /* Note: To correctly generate beacon frames, the */
+                                     /* byte order of the BSS ID field must be */
+                                     /* reversed. for example, if the MAC address of */
+                                     /* the AP is 00 7E 99 11 22 33, program the BSS */
+                                     /* ID field as 33 22 11 99 7E 00.*/
+        
+    uint16            bssIdH;        /* This field indicates the 16 MSBits of the MAC*/
+                                     /* address of the BSS to join. */
+
+    uint16            beaconInterval;/* This field specifies the time between target */
+                                     /* beacon transmission times (TBTTs), in time */
+                                     /* units (TUs). Valid values are 1 to 1024.*/
+    
+    ACXRxConfigStruct rxFilter;      /* This filed is the Rx filter configuration for*/
+                                     /* the device while connected to the BSS or IBSS.*/
+                                     /* This setting is overridden in case of a */
+                                     /* measurement or a scan activity and is reset */
+                                     /* after these activities end.*/
+
+    EHwRateBitFiled   basicRateSet;  /* For 802.11b, this field specifies the control*/
+                                     /* response frame rate for the BSS or IBSS (that*/
+                                     /* is, the BSSBasicRateSet parameter in the */
+                                     /* 802.11 Specification). The WiLink uses this */
+                                     /* field to determine the rate at which to */
+                                     /* transmit control frame responses (such as ACK */
+	                                 /* or CTS frames). */
+    
+    uint8             dtimInterval;  /* This field specifies the number of beacon */
+                                     /* intervals between DTIM beacon frames. The host*/
+                                     /* is only required to set this field when the */
+                                     /* BSS Type is infrastructure BSS (STA) or AP. */
+                                     /* For an independent BSS, the host should set */
+                                     /* this field to 1.*/
+    
+    BSS_e             bssType;       /* bits 0-2: This bitwise field specifies the type */
+                                     /*  of BSS to start or join (Refer to BssType_enum). */
+                                     /* bit 4: Band - The radio band in which to join*/
+                                     /*  or start.*/
+                                     /*  0 - 2.4GHz band    */
+                                     /*  1 - 5GHz band*/
+                                     /* bits 3, 5-7: Reserved*/
+
+    Channel_e         channelNumber; /* This field specifies the channel number of the*/
+                                     /* BSS to join or start. Valid values are 1 to 14. */
+                                     /* If the specified channel is not allowed in the*/
+                                     /* regulatory domain, the command is rejected and*/
+                                     /* the status code 0x0005 is returned in the */
+                                     /* Command Status field.*/
+    
+    uint8             ssidLength;    /* This field specifies the size of the SSID, which*/
+                                     /* can be up to 32 bytes long.*/
+    
+    uint32              ssidStr[MAX_SSID_STR_LEN_BYTESX4];
+                                     /* This field specifies the SSID of the BSS to */
+                                     /* start or join. The WiLink uses this information*/
+                                     /* to filter beacon, probe response and probe */
+                                     /* request frames (if configured to do so in bit 10*/
+                                     /* in the Receive Configuration field of the */
+                                     /* ACXRxConfig information element). */
+                                     /* It also uses this information to determine if a*/
+                                     /* probe response should be transmitted in */
+                                     /* response to a received probe request.*/
+    
+    uint8             ctrl;          /* Join command control field (refer to */
+                                     /* the JOIN_CMD_CTRL... specified above).*/
+
+    uint8             reserved[3];
+} StartJoinRequest_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_SET_KEYS
+    Desc:     The host issues this command to manage the WEP key cache in the WiLink. 
+              The host can issue this command during the configuration or operation 
+              phase.  
+    Params:   SetKey_t - see below.
+
+******************************************************************************/
+
+#define NUM_ACCESS_CATEGORIES_COPY 4 
+
+#define MAX_KEY_SIZE 32
+
+typedef enum
+{
+    KEY_ADD_OR_REPLACE = 1,             /* Add or replace a key in the WEP cache*/
+    KEY_REMOVE         = 2,             /* Remove a key from the WEP cache*/
+    KEY_SET_ID         = 3,             /* Set Key ID*/
+    MAX_KEY_ACTION     = MAX_POSITIVE16 /* force this enum to be uint16*/
+} KeyAction_enum;
+
+#ifdef HOST_COMPILE
+typedef uint16 KeyAction_e;
+#else
+typedef KeyAction_enum KeyAction_e;
+#endif
+
+
+/*
+Key Size+Key Data table (valid value)
+KeyType_enum  Key Type                    Valid Key Size    Key Data Field Format
+============  ========                    ==============    =====================
+0x00          WEP default key             5, 13, 29         Key Size bytes of key data
+
+0x01          WEP key mapping key         5, 13, 29         Key Size bytes of key data
+
+0x04          AES Group Key               16                16 bytes of key data
+
+0x05          AES Pairwise Key            16                16 bytes of key data
+
+0x0A          TKIP and MIC Group Key      32                16 bytes of TKIP key data
+                                                        8 bytes of Rx MIC key data
+                                                        8 bytes of Tx MIC key data
+
+0x0B          TKIP and MIC Pairwise Key   32                16 bytes of TKIP key data
+                                                        8 bytes of Rx MIC key data
+                                                        8 bytes of Tx MIC key data
+
+0x0C          GEM and MIC Group Key      32                 16 bytes of GEM key data
+                                                            16 bytes of MIC key data
+
+0x0D          GEM and MIC Pairwise Key   32                 16 bytes of GEM key data
+                                                            16 bytes of MIC key data
+                                                            
+*/
+
+
+typedef enum
+{
+  CIPHER_SUITE_NONE = 0,
+  CIPHER_SUITE_WEP  = 1,
+  CIPHER_SUITE_TKIP = 2,
+  CIPHER_SUITE_AES  = 3,
+    CIPHER_SUITE_GEM  = 4,
+  MAX_KEY_TYPE
+} CipherSuite_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 CipherSuite_e;
+#else
+typedef CipherSuite_enum CipherSuite_e;
+#endif
+
+typedef enum
+{
+    NO_KEY            =  0,
+    KEY_SIZE_WEP_64   =  5,
+    KEY_SIZE_WEP_128  = 13,
+    KEY_SIZE_WEP_256  = 29,
+    KEY_SIZE_TKIP     = MAX_KEY_SIZE
+} KeySize_enum;                      /* WEP keysizes reflect 3 bytes appended from IV.*/
+
+#ifdef HOST_COMPILE
+typedef uint8 KeySize_e;
+#else
+typedef KeySize_enum KeySize_e;
+#endif
+
+
+typedef struct
+{
+    uint8 addr[MAC_ADDR_SIZE]; /* This field specifies the MAC address of the station to*/
+                               /* add or remove from the WEP key cache. This field is */
+                               /* ignored if a WEP default key is being added or removed.*/
+    
+    KeyAction_e action;        /* This field specifies the action to be performed.*/
+                               /* Refer to KeyAction_enum.*/
+
+    uint16      reserved;
+    KeySize_e   keySize;       /* This field indicates the size of the key in bytes */
+                               /* being added. Valid values are listed in the Valid Key */
+                               /* Size column in the above "Key Size+Key Data table". */
+
+    CipherSuite_e   type;          /* This field indicates the type of key being added.*/
+                               /* Valid values are listed in the Value column in the*/
+                               /* KeyType_enum.*/
+
+    uint8       ssidProfile;   /* This field indicates the SSID profile for which the */
+                               /* key is set.*/
+    uint8       id;            /* Key ID - For TKIP and AES key types, this field */
+                               /* indicates the value that should be inserted into the*/
+                               /* KeyID field of frames transmitted using this key */
+                               /* entry. For WEP default key types, this field indicates*/
+                               /* the ID of the key to add or remove. */
+                               /* For WEP key mapping key types, this field is ignored.*/
+                               /* Valid values for this field are 0 to 3.*/
+    
+    uint8       reserved2[6];  
+    uint8       key[MAX_KEY_SIZE];
+                               /* This field holds the security key data to add to the*/
+                               /* STA table. The format of this field varies depending*/
+                               /* on the type field. The format of this field for each*/
+                               /* key type is described in the Key Data Field Format */
+                               /* column in the "Key Size+Key Data table", above.*/
+
+    uint16      AcSeqNum16[NUM_ACCESS_CATEGORIES_COPY]; 
+                               /* This field indicates the lower part of the PN\IV */
+                               /* sequence number that is used, for the four Access*/
+                               /* Categories.*/
+
+    uint32      AcSeqNum32[NUM_ACCESS_CATEGORIES_COPY]; 
+                               /* This field indicates the higher part of the PN\IV */
+                               /* sequence number that is used, for four Access */
+                               /* Categories.*/
+    
+} SetKey_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_READ_MEMORY
+    Desc:     The host issues this command to read the WiLink device 
+              memory/registers. 
+    Params:   ReadWriteCommand_t - see below.
+    Note:     The Base Band address has special handling (16 bits registers and
+              addresses). For more information, see the hardware specification.
+
+******************************************************************************/
+/******************************************************************************
+
+    ID:       CMD_WRITE_MEMORY
+    Desc:     The host issues this command to write the WiLink device memory/registers. 
+    Params:   ReadWriteCommand_t - see below.
+    Note:     The Base Band address has special handling (16 bits registers and
+              addresses). For more information, see the hardware specification.
+
+******************************************************************************/
+
+#define MAX_READ_SIZE 256
+
+typedef struct
+{
+    uint32 addr;                 /* The address of the memory to read from or write to.*/
+    uint32 size;                 /* The amount of data in bytes to read from or write */
+                                 /* to the WiLink device.*/
+    uint8  value[MAX_READ_SIZE]; /* The actual value read from or written to the Wilink.*/
+                                 /* The source of this field is the Host in WRITE */
+                                 /* command or the Wilink in READ command.*/
+} ReadWriteCommand_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_BEACON
+    Desc:     This command specifies the contents of the beacon template stored in 
+              the WiLink. 
+    Params:   PktTemplate_t - see below.
+
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_PROBE_RESP
+    Desc:     This command specifies the contents of the probe response template
+              stored in the WiLink.  
+    Params:   PktTemplate_t - see below.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_NULL_DATA
+    Desc:     This command specifies the contents of the Null data template
+              stored in the WiLink. 
+    Params:   PktTemplate_t - see below.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_PROBE_REQ
+    Desc:     This command specifies the contents of the probe request template
+              stored in the WiLink.  
+    Params:   PktTemplate_t - see below.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_PS_POLL
+    Desc:     This command specifies the contents of the PS-poll template
+              stored in the WiLink.  
+    Params:   PktTemplate_t - see below.
+    
+******************************************************************************/
+
+
+/******************************************************************************
+
+    ID:       CMD_QOS_NULL_DATA
+    Desc:     This command specifies the contents of the QOS-Null template
+              stored in the WiLink.  
+    Params:   PktTemplate_t - see below.
+    
+******************************************************************************/
+/* Template command data structure.*/
+typedef enum
+{
+    TEMPLATE_NULL_DATA = 0,
+    TEMPLATE_BEACON,        
+    CFG_TEMPLATE_PROBE_REQ_2_4,
+    CFG_TEMPLATE_PROBE_REQ_5,
+    TEMPLATE_PROBE_RESPONSE,
+    TEMPLATE_QOS_NULL_DATA,
+    TEMPLATE_PS_POLL,
+    TEMPLATE_KLV,
+	TEMPLATE_DISCONNECT, 
+    TEMPLATE_PROBE_REQ_2_4, /*for firmware internal use only*/
+    TEMPLATE_PROBE_REQ_5, /*for firmware internal use only*/
+	TEMPLATE_BAR, /*for firmware internal use only*/
+    TEMPLATE_CTS, /* For CTS-to-self (FastCTS) mechanism for BT/WLAN coexistence (SoftGemini). */
+	TEMPLATE_ARP, /* Template for Automatic ARP reply by FW */
+
+    MAX_NUM_OF_TEMPLATES = 0xff
+} TemplateType_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 TemplateType_e;
+#else
+typedef TemplateType_enum TemplateType_e;
+#endif
+
+#define MAX_TEMPLATES_SIZE 252  /* according to max size of FW memblock */
+#define RATE_MASK_UNSPECIFIED   0    /* Let the FW select the rates mask internally */
+
+/* 
+aflag definition:
+bit field       description
+=========       ===========
+0               Truncate - If set, then attempts to send a frame stop when the total 
+                valid per-rate attempts have been exhausted; 
+                otherwise transmissions will continue at the lowest available rate 
+                until the appropriate one of the Short Retry Limit, Long Retry Limit, 
+                dot11MaxTransmitMsduLifetime, or MAX TX Life Time (in ACXTIDConfig), 
+                if supported and supplied, is exhausted.
+1               Preamble Override - Indicates if the preamble type should be used in TX. 
+2               Preamble Type - The type of the preamble to be used by the policy. 
+                0 - long preamble, 
+                1 - short preamble. 
+3-7             Reserved
+*/
+
+/* definition of single rate policy*/
+typedef struct 
+{
+
+    uint32              enabledRates;  				  /* A Bit Mask which indicates which Rates are enabled */
+                                                      /* The rates bitmap is defined in EHwBitRate. */
+                                                      /* If set to RATE_MASK_UNSPECIFIED, the FW sets it internally */
+
+    uint8               shortRetryLimit;              /* The dot11ShortRetryLimit used */
+                                                      /* for Tx retries.*/
+
+    uint8               longRetryLimit;               /* The dot11LongRetryLimit used */
+                                                      /* for Tx retries.  */
+    
+    uint8               aflags;                       /* Flags controlling attributes */
+                                                      /* of the transmission. */
+                                                      /* see above description for the */
+                                                      /* structure of this field.*/
+
+    uint8               reserved;
+}txAttrClass_t;
+     
+/* Template command data structure.*/
+typedef struct 
+{
+    uint16 len;
+    TemplateType_e templateType;
+    uint8 index;    /* relevant only for KLV_TEMPLATE type */
+    txAttrClass_t templateTxAttribute;
+    uint8  templateStart[MAX_TEMPLATES_SIZE]; 
+} PktTemplate_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_NOISE_HIST
+    Desc:     This command starts/stops the noise histogram measurements.
+    Params:   NoiseHistRequest_t - see below.
+
+******************************************************************************/
+#define NOISE_HIST_LEN 8
+
+typedef enum 
+{
+    NOISE_HIST_STOP,
+    NOISE_HIST_START,
+    NOISE_HIST_INVALID = MAX_POSITIVE16 /* Force to be 16 bits enum*/
+} NoiseHistMode_enum;
+
+#ifdef HOST_COMPILE
+typedef uint16 NoiseHistMode_e;
+#else
+typedef NoiseHistMode_enum NoiseHistMode_e;
+#endif
+
+typedef struct
+{
+    NoiseHistMode_e mode;             /* Start or stop the FW engine. */
+                                      /* Possible values are 1 (Start) and 0 (Stop).*/
+
+    uint16 sampleIntervalUSec;        /* The time interval in usec between measurements.*/
+                                      /* Valid values are between 100us (default) and */
+                                      /* 2ms (with 100us jumps). This parameter is */
+                                      /* relevant only when Mode is Start (1).*/
+        
+    uint8  thresholds[NOISE_HIST_LEN];/* An array of eight 8 bit thresholds. The FW */
+                                      /* takes noise measurements, once every */
+                                      /* SampleIntervalUSec interval. If the measured */
+                                      /* noise level is between the threshold[X] and */
+                                      /* threshold[X 1], then the FW increments the */
+                                      /* noise histogram counter[X]. */
+                                      /* The counters are read via the */
+                                      /* ACXNoiseHistogramResults IE. This parameter is */
+                                      /* relevant only when Mode is Start (1).*/
+} NoiseHistRequest_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_LNA_CONTROL
+    Desc:     This command controls the LNA state. 
+    Params:   LNAControl_t - see below.
+
+******************************************************************************/
+
+typedef enum
+{
+    LNA_MODE_MANUAL,    /* 0: The LNA is set to manual mode and is turned off.*/
+    LNA_MODE_AUTO,      /* 1: The LNA is set to automatic mode.*/
+    LNA_MODE_INVALID = 0xFF
+} LnaMode_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 LnaMode_e;
+#else
+typedef LnaMode_enum LnaMode_e;
+#endif
+
+typedef struct
+{
+    LnaMode_e LNAControlField; /* refer to LnaMode_enum*/
+    uint8     padding[3];      /* for alignment to 32 bits boundry*/
+} LNAControl_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_MEASUREMENT
+    Desc:     This command instructs the WiLink device to begin a basic channel 
+              load measurement on the specified channel. When the measurement 
+              process actually starts running the WilLink device will raise the 
+              Measurement Started event. When the measurement process completes as
+              a result of the end of the measurement duration or a STOP_MEASUREMENT
+              command, the WilLink device will raise a Measurement Complete event. 
+    Params:   MeasurementParameters_t - see below.
+
+******************************************************************************/
+typedef struct 
+{
+    ACXRxConfigStruct rxFilter; /* This field is the Rx filter configuration for the */
+                                /* device while the measurement process is running. */
+                                /* When the process ends the previous Rx filter */
+                                /* configuration is reset. The filter configuration is*/
+                                /* composed of two 32 bit registers. When they are set*/
+                                /* to 0xFFFFFFFF the Rx filter configuration is not*/
+                                /* changed.*/
+    
+    uint32 duration;            /* Specifies the measurement process duration in */
+                                /* microseconds. The value of 0 means infinite duration*/
+                                /* in which only a STOP_MEASUREMENT command can*/
+                                /* stop the measurement process.*/
+    
+    Channel_e channel;          /* Channel number on which the measurement is performed,*/
+                                /* valid range 0-255 (1-14 for 802.11b).*/
+    
+    RadioBand_e band;           /* Specifies the band to which the channel belongs. */
+                                /* 0 - 2.4GHz */
+                                /* 1 - 5GHz , */
+                                /* 0xFF - Current band.*/
+
+    uint8 scanTag;              /* results tag */
+
+    uint8 padding[1];           /* for alignment to 32 bits boundry*/
+} MeasurementParameters_t;
+
+/******************************************************************************
+
+    ID:       CMD_STOP_MEASUREMENT
+    Desc:     This command instructs the WiLink to terminate any measurement in 
+              progress. After processing this command, the WiLink returns to its 
+              previous state (the state before the measurement was started) and 
+              generates the Measurment Complete event. 
+    Params:   None.
+
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_DISCONNECT
+    Desc:     This command instructs the WiLink device to stop all BSS or IBSS activity.
+              The device will cancel all of its TSF dependent events and activities. 
+              Power Save dependent activities are an exception to this, therefore 
+              the host must exit Power Save mode by issuing the SET_PS_MODE command 
+              before calling this command. When this command is complete the Disconnect
+              Complete event is raised to the host and the WiLink device is allowed 
+              to enter the configured low power state. 
+    Params:   DisconnectParameters_t - see below.
+    
+******************************************************************************/
+
+typedef enum
+{
+    DISCONNECT_IMMEDIATE,    /* Disconnect without sending any frame */
+    DISCONNECT_DE_AUTH,      /* Send deauthentication frame upon disconnecting */
+    DISCONNECT_DIS_ASSOC     /* Send disassociation frame upon disconnecting */
+} DisconnectType_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 DisconnectType_e;
+#else
+typedef DisconnectType_enum DisconnectType_e;
+#endif
+
+
+
+typedef struct
+{
+    ACXRxConfigStruct rxFilter;
+    uint16 disconnectReason;
+    DisconnectType_e   disconnectType; 
+    uint8 padding[1];  /* for alignment to 32 bits boundry */
+} DisconnectParameters_t;
+
+
+
+
+/******************************************************************************
+
+    ID:       CMD_SET_PS_MODE
+    Desc:     This command turns ON/OFF Power save protocol on the WiLink. 
+              After HW configuration, FW sends Null data packet to the AP with Power 
+              Management bit set accordingly to the field "Mode" of this command 
+              structure. After processing this command, the FW generates the 
+              PS_COMPLETE event.
+    Params:   PSModeParameters_t - see below.
+
+******************************************************************************/
+
+typedef enum
+{
+    STATION_ACTIVE_MODE,
+    STATION_POWER_SAVE_MODE
+} StationPSMode_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 StationPowerSaveMode_e;
+#else
+typedef StationPSMode_enum StationPowerSaveMode_e;
+#endif
+
+
+typedef struct
+{
+    StationPowerSaveMode_e mode;         /* This field specifies the future Power save*/
+                                         /* protocol mode of the system. */
+                                         /* When set, Power save protocol is enabled. */
+                                         /* When cleared, Power save protocol is */
+                                         /* disabled (refer to StationPSMode_enum).*/
+    
+    uint8                  needToSendNullData;
+    uint8 numberOfRetries;               /* This field specifies the maximum allowed */
+                                         /* number of retries of the Null data packet */
+                                         /* that FW will send after switching the */
+                                         /* Power Save Protocol mode.*/
+
+    uint8 hangOverPeriod;                /* This field specifies the hangover period, */
+                                         /* which is the time in TUs during which the */
+                                         /* WiLink remains awake after sending an MPDU */
+                                         /* with the Power Save bit set, indicating that*/
+                                         /* the station is to go into Power Save mode. */
+                                         /* Setting bit 0 does not affect the hangover */
+                                         /* period.*/
+    
+    EHwRateBitFiled rateToTransmitNullData; /* This EHwBitRate format field specifies the rate and */
+                                         /* modulation to transmit the Null data packet*/
+	                                     /* to the AP. */
+    
+} PSModeParameters_t;
+
+/******************************************************************************
+
+    ID:       CMD_CHANNEL_SWITCH
+    Desc:     This command instructs the WiLink to switch serving channel at the given
+              time. Once the channel switch is performed, the Channel Switch Complete
+              event is raised to the host.  
+    Params:   ChannelSwitchParameters_t - see below.
+
+******************************************************************************/
+typedef struct
+{
+    Channel_e channel;  /* The new serving channel.*/
+    uint8 switchTime;   /* Relative time of the serving channel switch in TBTT units.*/
+    Bool_e txSuspend;   /* 1: Suspend TX till switch time; */
+                        /* 0: Do not suspend TX*/
+    Bool_e flush;       /* 1: Flush TX at switch time; */
+                        /* 0: Do not flush*/
+    
+} ChannelSwitchParameters_t;
+
+/******************************************************************************
+
+    ID:       CMD_STOP_CHANNEL_SWICTH
+    Desc:     This command instructs the WiLink device to cancel performing a 
+              pending channel switch event command. 
+    Params:   None.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_AP_DISCOVERY
+    Desc:     This command instructs the WiLink device to perform an AP discovery 
+              measurement on a single channel. This command can only be issued after 
+              a measurement process has been started by the WiLink device as a result
+              of a previous Measurement command. The Measurement command specifies the 
+              channel on which the AP discovery is performed. Once the "AP discovery" 
+              measurement is completed either by a STOP_AP_DISCOVERY command or when 
+              the duration has expired, it will send an "AP discovery complete event" 
+              to the host.  
+    Params:   ApDiscoveryParameters_t - see below.
+
+******************************************************************************/
+
+
+typedef struct
+{
+    ACXRxConfigStruct rxFilter; /* This field is the Rx filter configuration for the */
+                                /* device while the AP Discovery process is running. */
+                                /* When the process ends the previous Rx filter */
+                                /* configuration is reset. The filter configuration is*/
+                                /* composed of two 32 bit registers. When they are set */
+                                /* to 0xFFFFFFFF the Rx filter configuration is not */
+                                /* changed.*/
+    
+    uint32 scanDuration;        /* This field specifies the amount of time, in time*/
+                                /* units (TUs), to perform the AP discovery. The value*/
+                                /* can range from 0 to 65535 TUs (67.1 seconds). */
+    
+    uint16 scanOptions;         /* This field specifies whether the AP discovery is */
+                                /* performed by an active scan or a passive scan. */
+                                /* 0 - ACTIVE, 1 - PASSIVE.*/
+    
+    uint8  numOfProbRqst;       /* This field indicates the number of probe requests to*/
+                                /* send per channel, when active scan is specified. */
+                                /* Note: for XCC measurement this value should be set */
+                                /*       to 1.*/
+    
+    uint8 txPowerAttenuation;   /* TX power level to be used for sending probe requests*/
+                                /* when active scan is specified. */
+                                /* If 0, leave normal TX power level for this channel. */
+
+    EHwRateBitFiled txdRateSet; /* This EHwBitRate format field specifies the rate and modulation*/
+                                /* to transmit the probe request when an active scan is*/
+	                            /* specified. */
+
+} ApDiscoveryParameters_t;
+
+/******************************************************************************
+
+    ID:       CMD_STOP_AP_DISCOVERY
+    Desc:     This command instructs the WiLink to terminate the AP Discovery 
+              measurement in progress. After processing this command, the WiLink 
+              returns to its previous state  and generates the AP Discovery Complete
+              Event. 
+    Params:   None.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_SPS_SCAN
+    Desc:     This command instructs the WiLink to perform a scheduled passive 
+              scan for BSS/IBSSs. The WiLink monitors the specified channel(s) 
+              for beacons. The WiLink sends Scheduled Scan Complete event to notify
+              the host when it has completed a scan. 
+    Params:   InfoElement_t - see below.
+
+******************************************************************************/
+/* Scheduled - General scan parameters.*/
+typedef struct
+{
+    ACXRxConfigStruct rxCfg;         /* Rx filter to be used for each channel scan. */
+                                     /* The BSSID filter enable will be set (by the scan*/
+                                     /* process) to ON for a specific channel if the*/
+                                     /* BSSID of this channel is a unicast address. */
+                                     /* Otherwise it will be set to OFF (Refer to */
+                                     /* ACXRxConfigStruct).*/
+    
+    uint32            scanCmdTime_h; /* This filed is the latest 32 MSBits of TSF known*/
+                                     /* at the time the SPS command was issued. When the*/
+                                     /* scan process is about to begin, this value is */
+                                     /* used to determine if the AP has performed a */
+                                     /* recovery by comparing this value to the current*/
+                                     /* TSF. (An AP that has performed a recovery should*/
+                                     /* have a lower TSF then the one that was saved).*/
+    
+    uint32            scanCmdTime_l; /* This filed is the latest 32 LSBits of TSF known*/
+                                     /* at the time the SPS command was issued. */
+
+    uint16            scanOptions;   /* This bitwise field indicates the scan options. */
+                                     /* 0 - ACTIVE, 1 - PASSIVE.*/
+    
+    uint8             numChannels;   /* Number of scan channels in the list (minimum */
+                                     /* (minimumis 1, maximum is 30).*/
+    
+    RadioBand_e       band;          /* Band to scan */
+    uint8             scanTag;       /* results tag */
+} ScheduledGeneralParameters_t;
+
+
+/* Scheduled - Per-Channel scan parameters.*/
+typedef struct
+{
+    uint32 scanStartTime;      /* Duration in microseconds of the scan on this channel */
+                               /* (Scan could be aborted before this duration in case of*/
+                               /* early termination condition met on the channel). */
+    
+    uint32 scanMaxDuration;    /* Lower 4 bytes of TSF time in microseconds when the */
+                               /* scan should start listening on the desired channel. */
+
+    uint32 bssIdL;             /* 32 LSBits of BSSID of the AP to scan for. If scanning */
+                               /* on this  channel any BSSID, this field shall be set */
+                               /* to broadcast BSSID. */
+    
+    uint16 bssIdH;             /* 16 MSBits of BSSID of the AP to scan for. */
+
+    ETCondCount_t ETCondCount; /* bit 0-3: Early Termination count - This field */
+                               /*          defines the maximum number of beacons*/
+                               /*          or probe responses or both (according*/
+                               /*          to condition) to collect before ending*/
+                               /*          a scan.*/
+    
+                               /* Bit 4-5: Early Termination Condition (refer */
+                               /*          to ETCondition_enum).*/
+    Channel_e     channel;     /* Channel number to scan, valid range 0-255 */
+                               /* (1-14 for 802.11b).*/
+} ScheduledChannelParameters_t;
+
+
+/* The Scheduled Scan command structure.*/
+typedef struct
+{
+    ScheduledGeneralParameters_t scheduledGeneralParameters;
+    ScheduledChannelParameters_t scheduledChannelParameters[SCAN_MAX_NUM_OF_CHANNELS];
+} ScheduledScanParameters_t;
+
+/******************************************************************************
+
+    ID:       CMD_STOP_SPS_SCAN
+    Desc:     This command instructs the WiLink to terminate a currently running 
+              SPS or a pending SPS.. After processing this command, the WiLink 
+              returns to its previous state and generates the Scheduled Scan 
+              Complete Event. 
+    Params:   None.
+
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_HEALTH_CHECK
+    Desc:     This command instructs the WiLink to raise a MAC status event 
+              which contains the current FCS Error counter. 
+    Params:   None.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_DEBUG
+    Desc:      
+    Params:   debugCommnad_t - see below.
+
+******************************************************************************/
+#define MAX_DEBUG_PARAMETERS 10
+
+typedef struct
+{
+    uint32  id;
+    uint32  params[MAX_DEBUG_PARAMETERS];
+} debugCommnad_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_CONNECTION_SCAN_CFG
+    Desc:     This command configures the periodic connection scan feature 
+    Params:   ConnectionScanParameters_t followed by active and passive channel
+              lists (variable size structure)
+    
+******************************************************************************/
+
+typedef enum
+{
+    BSS_INDEPENDENT                     = 0,
+    BSS_INFRASTRUCTURE                  = 1,
+    BSS_ANY                             = 2,
+    BSS_MAX = 0xFF
+} ScanBssType_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 ScanBssType_e;
+#else
+typedef ScanBssType_enum ScanBssType_e;
+#endif
+
+typedef enum
+{
+    SCAN_SSID_FILTER_TYPE_ANY = 0,
+    SCAN_SSID_FILTER_TYPE_SPECIFIC = 1,
+    SCAN_SSID_FILTER_TYPE_LIST = 2,
+	SCAN_SSID_FILTER_TYPE_LIST_FILTER_DISABLED = 3,
+    MAX_SCAN_SSID_FILTER_TYPE = 0xFF
+} ScanSsidFilterType_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 ScanSsidFilterType_e;
+#else
+typedef ScanSsidFilterType_enum ScanSsidFilterType_e;
+#endif
+
+#define CONN_SCAN_MAX_CHANNELS_BG  14
+#define CONN_SCAN_MAX_CHANNELS_J    4
+#define CONN_SCAN_MAX_CHANNELS_A   23
+#define CONN_SCAN_MAX_CHANNELS_ALL_BANDS        ((CONN_SCAN_MAX_CHANNELS_BG) + (CONN_SCAN_MAX_CHANNELS_A) + (CONN_SCAN_MAX_CHANNELS_J))
+#define CONN_SCAN_MAX_NUM_OF_CYCLES_INTERVALS   (16)        /* Maximum number of configured inter-cycle intervals */
+
+#define CONN_SCAN_MAX_BAND                      (3)         /* Maximum number of bands in scan configuration */
+
+#define CONN_SCAN_DFS_CANDIDATE_CHANNEL     BIT_0
+#define CONN_SCAN_DFS_ENABLED_CHANNEL       BIT_1
+
+typedef struct
+{
+    uint16       scanMinDuration;     /* Min duration (in ms)*/
+    uint16       scanMaxDuration;     /* Max duration (in ms)*/
+    uint16       passiveScanDuration; /* Duration to use for passive scans (in ms)*/
+    uint8        channel;             /* channel number (channel_e) */
+    uint8        txPowerLevelDbm;    /* TX power level in dbm */
+    uint8        channelFlags;        /* BIT 0: DFS channel */
+                                      /* BIT 1: DFS enabled (to be included in active scan) */
+    uint8        padding[3];
+} ConnScanChannelInfo_t;
+
+typedef struct
+{
+    uint32                  cycleIntervals[CONN_SCAN_MAX_NUM_OF_CYCLES_INTERVALS];      /* Intervals between each scan cycle */
+    int8                    rssiThreshold;          /* RSSI threshold */
+    int8                    snrThreshold;           /* SNR threshold */
+    uint8                   maxNumOfCycles;         /* number of cycles to run */
+    uint8                   reportThreshold;        /* Report after N results are received */
+    uint8                   terminateOnReport;      /* Terminate after report */
+    uint8                   resultsTag;             /* Tag for filtered scan results */
+    ScanBssType_e           bssType;                /* BSS type to filter (0 - Infra, 1 - IBSS, 2 - Any) */
+    ScanSsidFilterType_e    ssidFilterType;         /* SSID filter Type (0 - Any, 1 - specified in command, 2 - use SSID list) */
+    uint8                   ssidLength;             /* SSID Length (if ssidType is specified in command) */
+    uint8                   ssid[32];               /* SSID (if ssidType is specified in command) */
+    uint8                   numProbe;               /* Number of probe requests to transmit per (hidden) SSID per channel */
+
+    uint8                   numOfPassive[CONN_SCAN_MAX_BAND];
+    uint8                   numOfActive[CONN_SCAN_MAX_BAND];
+    uint8                   numOfDfs;
+    uint8                   padding[ 3 ];
+    ConnScanChannelInfo_t   channelList[CONN_SCAN_MAX_CHANNELS_ALL_BANDS];
+} ConnScanParameters_t;
+
+/******************************************************************************
+
+    ID:       CMD_CONNECTION_SCAN_SSID_CFG
+    Desc:     This command configures the SSID filter list to be used in the
+              periodic connection scan
+    Params:   None.
+    
+******************************************************************************/
+
+#define CONN_SCAN_MAX_NUMBER_OF_SSID_ENTRIES        (8)
+
+typedef enum
+{
+    SCAN_SSID_TYPE_PUBLIC = 0,
+    SCAN_SSID_TYPE_HIDDEN = 1,
+    MAX_SCAN_SSID_TYPE = 0xFF
+} ScanSsidType_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 ScanSsidType_e;
+#else
+typedef ScanSsidType_enum ScanSsidType_e;
+#endif
+
+typedef struct
+{
+    ScanSsidType_e      ssidType;
+    uint8               ssidLength; 
+    uint8               ssid[32];
+} ConnScanSSID_t;
+
+
+typedef struct
+{
+    uint8               numOfSSIDEntries;
+    ConnScanSSID_t      SSIDList[CONN_SCAN_MAX_NUMBER_OF_SSID_ENTRIES];
+} ConnScanSSIDList_t;
+
+
+/******************************************************************************
+
+    ID:       CMD_START_PERIODIC_SCAN
+    Desc:     This command instructs the WiLink to start a periodic scan
+              process (either connection-scan or discovery)
+    Params:   None.
+    
+******************************************************************************/
+
+typedef struct
+{
+    uint8   scanTag;
+    uint8   uReserved[3];
+} PeriodicScanTag;
+
+/******************************************************************************
+
+    ID:       CMD_STOP_PERIODIC_SCAN
+    Desc:     This command instructs the WiLink to stop a periodic scan
+              process (either connection-scan or discovery)
+    Params:   None.
+    
+******************************************************************************/
+
+/******************************************************************************
+
+    ID:       CMD_SET_STATUS
+    Desc:     This command instructs the station state
+    Params:   None.
+    
+******************************************************************************/
+
+#define STA_STATE_CONNECTED 1
+
+typedef struct
+{
+    uint8   staState;
+    uint8   pad[3];
+} SetStaState_t; 
+
+/* PLT public definitions*/
+#define TEST_CONTINUOUS 0x04       /* transmit frames contimuously */
+
+
+/*This typedef corresponds to the Fig 1 Frame Format for PER test given in PER test doc.*/
+#define PER_MODE_TX 1
+#define PER_MODE_RX 2
+#define INFRA   0x2         /* BSS is in Infrastructure mode */
+#define LOCAL_MEM_LAST      0x02000000
+#define PBCC_MODULATION_MASK 0x80
+#define OFDM_MODULATION_MASK 0x40
+#define BAND_SELECT_5GHZ     0x10
+#define CTL_PREAMBLE         0x01
+
+
+
+#endif /* PUBLIC_COMMANDS_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FirmwareApi/public_descriptors.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,266 @@
+/*
+ * public_descriptors.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/**********************************************************************************************************************
+
+  FILENAME:       public_descriptors.h
+
+  DESCRIPTION:    Contains the host interface descriptor types in use.
+
+
+
+***********************************************************************************************************************/
+#ifndef PUBLIC_DESCRIPTORS_H
+#define PUBLIC_DESCRIPTORS_H
+
+
+#include "public_types.h"
+
+
+
+/******************************************************************************
+
+		TX PATH
+	 
+******************************************************************************/
+
+#define AID_BROADCAST 0x0       /* broadcast frames AID */
+#define AID_GLOBAL    0xFF      /* unassociated STAs AID */
+
+#define TRQ_DEPTH           16      /* depth of TX Result Queue */
+
+#define NUM_TX_DESCRIPTORS  32      /* Total number of Tx descriptors in the FW */
+
+/* TX attributes masks and offset used in the txAttr of TxIfDescriptor_t. */
+#define     TX_ATTR_SAVE_RETRIES          BIT_0
+#define     TX_ATTR_HEADER_PAD            BIT_1
+#define     TX_ATTR_SESSION_COUNTER       (BIT_2 | BIT_3 | BIT_4)
+#define     TX_ATTR_RATE_POLICY           (BIT_5 | BIT_6 | BIT_7 | BIT_8 | BIT_9)
+#define     TX_ATTR_LAST_WORD_PAD         (BIT_10 | BIT_11)
+#define     TX_ATTR_TX_CMPLT_REQ          BIT_12
+
+#define     TX_ATTR_OFST_SAVE_RETRIES     0
+#define     TX_ATTR_OFST_HEADER_PAD       1
+#define     TX_ATTR_OFST_SESSION_COUNTER  2
+#define     TX_ATTR_OFST_RATE_POLICY      5
+#define     TX_ATTR_OFST_LAST_WORD_PAD    10
+#define     TX_ATTR_OFST_TX_CMPLT_REQ     12
+
+/* The packet transmission result, written in the status field of TxResultDescriptor_t */
+typedef enum
+{
+    TX_SUCCESS              = 0,     
+	TX_HW_ERROR             = 1,
+	TX_DISABLED             = 2,
+	TX_RETRY_EXCEEDED       = 3,
+	TX_TIMEOUT              = 4,
+	TX_KEY_NOT_FOUND        = 5,
+	TX_PEER_NOT_FOUND       = 6,
+    TX_SESSION_MISMATCH     = 7 
+} TxDescStatus_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 TxDescStatus_e;
+#else
+typedef TxDescStatus_enum TxDescStatus_e;
+#endif
+
+/* The Tx Descriptor preceding each Tx packet copied to the FW (before the packet). */
+typedef struct TxIfDescriptor_t
+{
+    uint16          length;		/* Length of packet in words, including descriptor+header+data */
+    uint8           extraMemBlks; /* Number of extra memory blocks to allocate for this packet in addition 
+                                       to the number of blocks derived from the packet length */
+    uint8           totalMemBlks;   /* Total number of memory blocks allocated by the host for this packet. 
+                                    Must be equal or greater than the actual blocks number allocated by HW!! */
+    uint32          startTime;  /* Device time (in us) when the packet arrived to the driver */
+    uint16          lifeTime;   /* Max delay in TUs until transmission. The last device time the 
+                                      packet can be transmitted is: startTime+(1024*LifeTime) */ 
+    uint16          txAttr;		/* Bitwise fields - see TX_ATTR... definitions above. */
+    uint8           descID;		/* Packet identifier used also in the Tx-Result. */
+    uint8           tid;		/* The packet TID value (as User-Priority) */
+    uint8           aid;	    /* Identifier of the remote STA in IBSS, 1 in infra-BSS */
+    uint8           reserved;       /* For HW use, set to 0 */
+
+} TxIfDescriptor_t;
+
+
+/* The Tx result retrieved from FW upon TX completion. */
+typedef struct TxResultDescriptor_t
+{
+    uint8			descID;		 /* Packet Identifier - same value used in the Tx descriptor.*/
+	TxDescStatus_e	status;		 /* The status of the transmission, indicating success or one of several
+									 possible reasons for failure. Refer to TxDescStatus_enum above.*/
+    uint16 			mediumUsage; /* Total air access duration including all retrys and overheads.*/
+    uint32 			fwHandlingTime;	/* The time passed from host xfer to Tx-complete.*/
+    uint32 			mediumDelay; /* Total media delay (from 1st EDCA AIFS counter until TX Complete). */
+    uint8  			lsbSecuritySequenceNumber; /* LS-byte of last TKIP seq-num (saved per AC for recovery).*/
+    uint8  			ackFailures; /* Retry count - number of transmissions without successful ACK.*/
+    TxRateIndex_t	rate;		 /* The rate that succeeded getting ACK (Valid only if status=SUCCESS). */
+    uint8  			spare;       /* for 4-byte alignment. */  
+} TxResultDescriptor_t;
+
+/* The Host-FW Tx-Result control counters */
+typedef struct
+{
+	uint32 TxResultFwCounter;	/* FW updates num of results written to results-queue since FW-init. */
+    uint32 TxResultHostCounter;	/* Host updates num of results read from results-queue since FW-init. */
+} TxResultControl_t;
+
+/* The Host-FW Tx-Result Interface */
+typedef struct 
+{
+	TxResultControl_t TxResultControl;  		   /* See above. */
+	TxResultDescriptor_t TxResultQueue[TRQ_DEPTH];
+} TxResultInterface_t;
+
+
+/******************************************************************************
+
+		RX PATH
+
+******************************************************************************/
+/* ------------------------------------- */
+/* flags field in the RxIfDescriptor_t   */
+/* ------------------------------------- */
+/*   Bit5-7: Encryption type:            */
+/*           0 - none                    */
+/*           1 - WEP                     */
+/*           2 - TKIP                    */
+/*           3 - AES                     */
+/*           4 - GEM                     */
+/*   Bit4: HT                            */
+/*   Bit3: Was part of A-MPDU            */
+/*   Bit2: STBC                          */
+/*   Bit0-1: Band the frame was received */
+/*           from (0=2.4, 1=4.9, 2=5.0)  */
+/* ------------------------------------- */
+#define    RX_DESC_BAND_MASK        0x03  /* Band is in Bits 0-1 */
+#define    RX_DESC_BAND_BG          0x00  
+#define    RX_DESC_BAND_J           0x01  
+#define    RX_DESC_BAND_A           0x02
+#define    RX_DESC_STBC             0x04
+#define    RX_DESC_A_MPDU           0x08
+#define    RX_DESC_HT               0x10
+    #define    RX_DESC_ENCRYPT_MASK     0xE0  /* Encryption is in Bits 5-7 */
+#define    RX_DESC_ENCRYPT_WEP      0x20
+#define    RX_DESC_ENCRYPT_TKIP     0x40
+#define    RX_DESC_ENCRYPT_AES      0x60
+    #define    RX_DESC_ENCRYPT_GEM      0x80
+
+
+/* ------------------------------------- */
+/* Status field in the RxIfDescriptor_t  */
+/* ------------------------------------- */
+/*   Bit3-7: reserved (0)                */
+/*   Bit0-2: 0 - Success,                */
+/*           1 - RX_DECRYPT_FAIL,        */
+/*           2 - RX_MIC_FAIL             */ 
+/* ------------------------------------- */
+#define    RX_DESC_STATUS_SUCCESS           0  
+#define    RX_DESC_STATUS_DECRYPT_FAIL      1  
+#define    RX_DESC_STATUS_MIC_FAIL          2
+#define    RX_DESC_STATUS_DRIVER_RX_Q_FAIL  3
+
+#define    RX_DESC_STATUS_MASK              7
+
+
+/**********************************************
+    clasify tagging 
+***********************************************/
+typedef enum
+{
+    TAG_CLASS_UNKNOWN       = 0,
+    TAG_CLASS_MANAGEMENT    = 1, /* other than Beacon or Probe Resp */
+    TAG_CLASS_DATA          = 2,
+    TAG_CLASS_QOS_DATA      = 3,
+    TAG_CLASS_BCN_PRBRSP    = 4,
+    TAG_CLASS_EAPOL         = 5, 
+    TAG_CLASS_BA_EVENT      = 6,
+    TAG_CLASS_AMSDU         = 7
+} PacketClassTag_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 PacketClassTag_e;
+#else
+typedef PacketClassTag_enum PacketClassTag_e;
+#endif
+
+typedef uint8 ProcessIDTag_e;
+
+/******************************************************************************
+
+    RxIfDescriptor_t
+
+    the structure of the Rx Descriptor recieved by HOST.
+
+******************************************************************************/
+typedef struct
+{    
+	uint16              length;             /* Length of payload (including headers)*/
+    
+    uint8               status;             /* 0 = Success, 1 = RX Decrypt Fail, 2 = RX MIC Fail */
+
+    uint8               flags;              /* See RX_DESC_xxx above */
+
+    TxRateIndex_t       rate;               /* Recevied Rate:at ETxRateClassId format */
+
+    uint8               channel;            /* The received channel*/
+    
+    int8                rx_level;           /* The computed RSSI value in db of current frame */  
+    
+    uint8               rx_snr;             /* The computed SNR value in db of current frame */
+                                            
+    uint32              timestamp;          /* Timestamp in microseconds,     */
+
+    PacketClassTag_e    packet_class_tag;   /* Packet classification tagging info */
+
+    ProcessIDTag_e      proccess_id_tag;    /* Driver defined ID */
+
+    uint8               extraBytes;         /* Number of padding bytes added to actual packet length */
+
+    uint8               reserved;
+    
+} RxIfDescriptor_t;
+
+
+
+#endif /* PUBLIC_DESCRIPTORS_H*/
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FirmwareApi/public_event_mbox.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,242 @@
+/*
+ * public_event_mbox.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/**********************************************************************************************************************
+
+  FILENAME:       public_event_mbox.h
+ 
+  DESCRIPTION:    Public header for the Event Mailbox FW<->Driver interface
+
+
+
+***********************************************************************************************************************/
+#ifndef PUBLIC_EVENT_MBOX_H
+#define PUBLIC_EVENT_MBOX_H
+
+/******************************************************************************
+
+	EVENT MBOX
+	 
+    The event mechanism is based on a pair of event buffers (buffers "A" and "B") in fixed locations
+    in the device's memory. The host processes one buffer (buffer "A") while the other buffer 
+    (buffer "B") continues to collect events. When the host is finished, it begins processing the 
+    other buffer ("B") while the first buffer ("A") collects, and so on.
+    If the host is not processing events, an interrupt is issued to the host signaling that a 
+    buffer is ready. The interrupt that the host receives indicates the appropriate event structure
+    buffer. Once the host finishes processing events from one buffer, 
+    it signals with an acknowledge interrupt (bit 0 in the INT_TRIG register) that the event buffer
+    is free. This interrupt triggers the device to send the next event structure if there are any 
+    collected events in it.
+
+    Note: Only one instance (the last) of each type of event is collected.
+       
+******************************************************************************/
+
+
+#include "public_types.h"
+#include "public_commands.h"
+#include "public_infoele.h"
+
+
+
+/*************************************************************************
+
+  Events Enumeration 
+
+**************************************************************************/
+typedef enum 
+{
+    RSSI_SNR_TRIGGER_0_EVENT_ID              = BIT_0, 
+    RSSI_SNR_TRIGGER_1_EVENT_ID              = BIT_1, 
+    RSSI_SNR_TRIGGER_2_EVENT_ID              = BIT_2, 
+    RSSI_SNR_TRIGGER_3_EVENT_ID              = BIT_3, 
+    RSSI_SNR_TRIGGER_4_EVENT_ID              = BIT_4, 
+    RSSI_SNR_TRIGGER_5_EVENT_ID              = BIT_5, 
+    RSSI_SNR_TRIGGER_6_EVENT_ID              = BIT_6, 
+    RSSI_SNR_TRIGGER_7_EVENT_ID              = BIT_7, 
+
+    MEASUREMENT_START_EVENT_ID               = BIT_8,
+    MEASUREMENT_COMPLETE_EVENT_ID            = BIT_9,
+    SCAN_COMPLETE_EVENT_ID                   = BIT_10,
+    SCHEDULED_SCAN_COMPLETE_EVENT_ID         = BIT_11,
+    AP_DISCOVERY_COMPLETE_EVENT_ID           = BIT_12,
+    PS_REPORT_EVENT_ID                       = BIT_13,
+    PSPOLL_DELIVERY_FAILURE_EVENT_ID 	     = BIT_14,
+    DISCONNECT_EVENT_COMPLETE_ID             = BIT_15,
+    JOIN_EVENT_COMPLETE_ID                   = BIT_16,
+    CHANNEL_SWITCH_COMPLETE_EVENT_ID         = BIT_17,
+    BSS_LOSE_EVENT_ID                        = BIT_18,
+    REGAINED_BSS_EVENT_ID                    = BIT_19,
+    ROAMING_TRIGGER_MAX_TX_RETRY_EVENT_ID    = BIT_20,
+    RESERVED_21                              = BIT_21,
+    SOFT_GEMINI_SENSE_EVENT_ID               = BIT_22,
+    SOFT_GEMINI_PREDICTION_EVENT_ID          = BIT_23,
+    SOFT_GEMINI_AVALANCHE_EVENT_ID           = BIT_24,
+    PLT_RX_CALIBRATION_COMPLETE_EVENT_ID     = BIT_25,
+    DBG_EVENT_ID                             = BIT_26,
+    HEALTH_CHECK_REPLY_EVENT_ID              = BIT_27,
+
+    PERIODIC_SCAN_COMPLETE_EVENT_ID          = BIT_28,
+    PERIODIC_SCAN_REPORT_EVENT_ID            = BIT_29,
+
+    BA_SESSION_TEAR_DOWN_EVENT_ID	         = BIT_30,
+
+    EVENT_MBOX_ALL_EVENT_ID                  = MAX_POSITIVE32
+} EventMBoxId_e;
+
+/*************************************************************************
+
+  Specific Event Parameters 
+
+**************************************************************************/
+typedef enum
+{
+    SCHEDULED_SCAN_COMPLETED_OK = 0,
+    SCHEDULED_SCAN_TSF_ERROR    = 1
+} ScheduledScanReportStatus_enum;
+
+
+typedef enum
+{
+    CHANNEL_SWITCH_COMPLETE_OK,
+    CHANNEL_SWITCH_TSF_ERROR
+} ChannelSwitchReportStatus_enum;
+
+
+typedef enum
+{
+    ENTER_POWER_SAVE_FAIL    =  0,
+    ENTER_POWER_SAVE_SUCCESS =  1,
+    EXIT_POWER_SAVE_FAIL     =  2,
+    EXIT_POWER_SAVE_SUCCESS  =  3,
+    POWER_SAVE_STATUS_NUMBER
+} EventsPowerSave_enum;
+
+typedef enum
+{
+    TEST1_DBG_EVENT_ID = 0,
+    TEST2_DBG_EVENT_ID = 0x11,
+    LAST_DBG_EVENT_ID= 0xff
+}dbgEventId_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 ScheduledScanReportStatus_e;
+typedef uint8 ChannelSwitchReportStatus_e;
+typedef uint8 EventsPowerSave_e;
+typedef uint8 dbgEventId_e;
+#else
+typedef ScheduledScanReportStatus_enum ScheduledScanReportStatus_e;
+typedef ChannelSwitchReportStatus_enum ChannelSwitchReportStatus_e;
+typedef EventsPowerSave_enum EventsPowerSave_e;
+typedef dbgEventId_enum dbgEventId_e;
+#endif
+
+
+#define MAX_EVENT_REPORT_PARAMS 5
+typedef struct
+{ 
+    dbgEventId_e dbgEventId;  /*uint8*/
+    uint8       numberOfRelevantParams;
+    uint16      reservedPad16;
+    uint32      eventReportP1;
+    uint32      eventReportP2;
+    uint32      eventReportP3;
+}dbgEventRep_t;
+
+typedef struct 
+{
+	uint8		numberOfScanResults;   /* How many results were parsed */
+	uint8       scanTag;               /* Tag of scan */
+    uint8       padding[2];            /* for alignment to 32 bits boundry*/
+    uint32      scheduledScanStatus;   /* [0-7] scan completed status, [8-23] Attended Channels map, [24-31] reserved. */
+} scanCompleteResults_t;
+
+/*************************************************************************
+
+  The Event Mailbox structure in memory 
+
+**************************************************************************/
+typedef struct EventMailBox_t
+{
+    /* Events Bit Mask */
+    uint32 eventsVector;
+    uint32 eventsMask;
+    uint32 reserved1;
+    uint32 reserved2;
+
+    /* Events Data */
+
+
+    dbgEventRep_t      dbgEventRep;         /* refer to dbgEventRep_t*/
+                                            /* [DBG_EVENT_ID]*/
+    
+    scanCompleteResults_t scanCompleteResults; /* Scan complete results (counter and scan tag) */
+    
+    uint16 scheduledScanAttendedChannels;   /* Channels scanned by the Scheduled Scan. */
+                                            /* [SCHEDULED_SCAN_COMPLETE_EVENT_ID]*/
+
+    uint8  softGeminiSenseInfo;             /* Contains the type of the BT Coexistence sense event.*/
+                                            /* [SOFT_GEMINI_SENSE_EVENT_ID]*/    
+
+    uint8  softGeminiProtectiveInfo;        /* Contains information from the BT activity prediction */
+                                            /* machine [SOFT_GEMINI_PREDICTION_EVENT_ID]*/
+
+    int8   RSSISNRTriggerMetric[NUM_OF_RSSI_SNR_TRIGGERS];   /* RSSI and SNR Multiple Triggers Array */
+                                            /* machine [RSSI_SNR_TRIGGER_0-8_EVENT_ID]*/
+
+    uint8  channelSwitchStatus;             /* Status of channel switch. Refer to*/
+                                            /* ChannelSwitchReportStatus_enum.*/
+                                            /* [CHANNEL_SWITCH_COMPLETE_EVENT_ID]*/
+
+    uint8  scheduledScanStatus;             /* Status of scheduled scan. Refer to */
+                                            /* ScheduledScanReportStatus_enum.*/
+                                            /* [SCHEDULED_SCAN_COMPLETE_EVENT_ID]*/
+    
+    uint8  psStatus;                        /* refer to EventsPowerSave_enum.*/
+                                            /* [PS_REPORT_EVENT_ID].*/
+
+    
+
+    uint8  padding[29];                     /* for alignment to 32 bits boundry*/
+
+    
+} EventMailBox_t;
+
+#endif /* PUBLIC_EVENT_MBOX_H*/
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FirmwareApi/public_host_int.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,150 @@
+/*
+ * public_host_int.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/**********************************************************************************************************************
+
+  FILENAME:       public_host_int.h
+
+  DESCRIPTION:    Contains the host interface fw interrupt structure in use.
+
+
+
+***********************************************************************************************************************/
+#ifndef PUBLIC_HOST_INT_H
+#define PUBLIC_HOST_INT_H
+
+#include "public_types.h"
+
+                
+/*************************************************************************
+
+    Host Interrupt Register (WiLink -> Host)
+ 
+**************************************************************************/
+#define ACX_INTR_WATCHDOG           BIT_0   /* HW Initiated interrupt Watchdog timer expiration */
+#define ACX_INTR_INIT_COMPLETE      BIT_1   /* Init sequence is done (masked interrupt, detection through polling only ) */
+    #define ACX_INTR_EVENT_A            BIT_2   /* Event was entered to Event MBOX #A*/
+    #define ACX_INTR_EVENT_B            BIT_3   /* Event was entered to Event MBOX #B*/
+#define ACX_INTR_CMD_COMPLETE       BIT_4   /* Command processing completion*/
+    #define ACX_INTR_HW_AVAILABLE       BIT_5   /* Signaling the host on HW wakeup */
+    #define ACX_INTR_DATA               BIT_6   /* The MISC bit is used for aggregation of RX, TxComplete and TX rate update */
+    #define ACX_INTR_TRACE_A	        BIT_7   /* Trace meassge on MBOX #A */
+    #define ACX_INTR_TRACE_B            BIT_8   /* Trace meassge on MBOX #B */
+
+#define ACX_INTR_ALL                0xFFFFFFFF
+
+
+/*************************************************************************
+
+    Interrupt Trigger Register (Host -> WiLink)              
+  
+**************************************************************************/
+
+/******** Hardware to Embedded CPU Interrupts - first 32-bit register set ********/ 
+   
+#define INTR_TRIG_CMD       BIT_0   /* Host Command Interrupt. Setting this bit masks*/
+                                    /* the interrupt that the host issues to inform*/
+                                    /* the FW that it has sent a command*/
+                                    /* to the Wlan hardware Command Mailbox.*/
+    
+#define INTR_TRIG_EVENT_ACK BIT_1   /* Host Event Acknowlegde Interrupt. The host */
+                                    /* sets this bit to acknowledge that it received*/
+                                    /* the unsolicited information from the event*/
+                                    /* mailbox.*/
+                                       
+#define INTR_TRIG_TX_PROC0  BIT_2   /* OBSOLETE (automatic end-of-transaction interrupt is used instead) */
+                                       
+#define INTR_TRIG_RX_PROC   BIT_3   /* The host sets this bit to inform the FW that */
+                                    /* it read a packet from the RX cyclic buffer */
+
+#define INTR_TRIG_DEBUG_ACK BIT_4 
+    
+#define INTR_TRIG_STATE_CHANGED BIT_5
+        
+
+/******** Hardware to Embedded CPU Interrupts - second 32-bit register set ********/
+
+#define INTR_TRIG_RX_PROC1  BIT_17  /* OBSOLETE */
+
+#define INTR_TRIG_TX_PROC1  BIT_18  /* OBSOLETE */
+
+
+/*************************************************************************
+
+    FW status registers (Host reads from FW upon interrupt from FW)              
+                                                        
+**************************************************************************/
+#define NUM_TX_QUEUES	    4   /* Number of Tx HW Queues (same as ACs). */
+#define NUM_RX_PKT_DESC     8   /* Number of Rx packets short descriptors in the W status */
+
+/* Get field from FwStatus_t->rxPktsDesc[i] */
+#define RX_DESC_GET_MEM_BLK(desc)            ( (desc & 0x000000FF) >>  0 )  /* The first mem-block of the Rx packet */
+#define RX_DESC_GET_LENGTH(desc)             ( (desc & 0x000FFF00) >>  8 )  /* The length of the packet in words */
+#define RX_DESC_GET_UNALIGNED(desc)          ( (desc & 0x00100000) >> 20 )  /* If set, the payload is not 4 bytes aligned */
+#define RX_DESC_GET_SECURITY(desc)           ( (desc & 0x00E00000) >> 21 )  /* Security flag */
+#define RX_DESC_GET_PACKET_CLASS_TAG(desc)   ( (desc & 0xFF000000) >> 24 )  /* Get the RX packet class tag */
+
+
+/* Set field in FwStatus_t->rxPktsDesc[i] */
+#define RX_DESC_SET_MEM_BLK(desc, value)     ( desc = (desc & ~0x000000FF) | (value <<  0 ) )
+#define RX_DESC_SET_LENGTH(desc, value)      ( desc = (desc & ~0x000FFF00) | (value <<  8 ) )
+#define RX_DESC_SET_UNALIGNED(desc, value)   ( desc = (desc & ~0x00100000) | (value << 20 ) )
+
+/* The content of the "counters" field in FwStatus_t - see below */
+typedef struct 
+{
+    uint8       fwRxCntr;       /* Incremented by FW upon adding pending Rx entry to aRxPktsDesc */
+    uint8       drvRxCntr;      /* Incremented by FW upon RX host slave interrupt (for debug) */
+    uint8       reserved;        
+    uint8       txResultsCntr;  /* Incremented by FW upon adding Tx-Result to the TxResultQueue */
+} FwStatCntrs_t;
+
+/* The FW status registers structure read by the host upon interrupt from the FW */
+typedef struct 
+{
+    uint32      intrStatus;     /* HINT register content (will be cleared upon the read) */
+    uint32      counters;       /* The counters defined in FwStatCntrs_t - see above */
+    uint32      rxPktsDesc[NUM_RX_PKT_DESC];   /* Array of Rx packets short descriptors (see RX_DESC_SET/GET...) */
+	uint32      txReleasedBlks[NUM_TX_QUEUES]; /* Per queue released blocks count since FW-reset */
+    uint32      fwLocalTime;    /* FW time in usec, used for clock synchronization with the host */
+    uint32      spare[2];       /* Total structure size is 68 bytes */
+} FwStatus_t;
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FirmwareApi/public_infoele.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,2513 @@
+/*
+ * public_infoele.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/**********************************************************************************************************************
+
+  FILENAME:       public_infoele.h
+
+  DESCRIPTION:    Contains information element defines/structures used by the FW and host.
+
+
+
+***********************************************************************************************************************/
+#ifndef PUBLIC_INFOELE_H
+#define PUBLIC_INFOELE_H
+
+
+#include "public_types.h"
+#include "public_commands.h"
+#include "public_radio.h" 
+
+typedef enum
+{
+    ACX_WAKE_UP_CONDITIONS      = 0x0002,
+    ACX_MEM_CFG                 = 0x0003,
+    ACX_SLOT                    = 0x0004,
+
+    ACX_AC_CFG                  = 0x0007,
+    ACX_MEM_MAP                 = 0x0008,
+    ACX_AID                     = 0x000A,
+
+    ACX_MEDIUM_USAGE            = 0x000F,
+    ACX_RX_CFG                  = 0x0010,
+    ACX_TX_QUEUE_CFG            = 0x0011,
+    ACX_STATISTICS              = 0x0013, /* Debug API*/
+    ACX_PWR_CONSUMPTION_STATISTICS       =0x0014,
+    ACX_FEATURE_CFG             = 0x0015,
+    ACX_TID_CFG                 = 0x001A,
+    ACX_PS_RX_STREAMING         = 0x001B, 
+    ACX_BEACON_FILTER_OPT       = 0x001F,
+    ACX_NOISE_HIST              = 0x0021,
+    ACX_HDK_VERSION             = 0x0022, /* ???*/
+    ACX_PD_THRESHOLD            = 0x0023,
+    ACX_TX_CONFIG_OPT           = 0x0024,
+    ACX_CCA_THRESHOLD           = 0x0025,
+    ACX_EVENT_MBOX_MASK         = 0x0026,
+    ACX_CONN_MONIT_PARAMS       = 0x002D,
+    ACX_CONS_TX_FAILURE         = 0x002F,
+    ACX_BCN_DTIM_OPTIONS        = 0x0031,
+    ACX_SG_ENABLE               = 0x0032,
+    ACX_SG_CFG                  = 0x0033,
+    ACX_FM_COEX_CFG             = 0x0034,
+
+    ACX_BEACON_FILTER_TABLE     = 0x0038,
+    ACX_ARP_IP_FILTER           = 0x0039,
+    ACX_ROAMING_STATISTICS_TBL  = 0x003B,
+    ACX_RATE_POLICY             = 0x003D, 
+    ACX_CTS_PROTECTION          = 0x003E, 
+    ACX_SLEEP_AUTH              = 0x003F,
+    ACX_PREAMBLE_TYPE           = 0x0040,
+    ACX_ERROR_CNT               = 0x0041,
+    ACX_IBSS_FILTER             = 0x0044,
+    ACX_SERVICE_PERIOD_TIMEOUT  = 0x0045,
+    ACX_TSF_INFO                = 0x0046,
+    ACX_CONFIG_PS_WMM           = 0x0049,
+    ACX_ENABLE_RX_DATA_FILTER   = 0x004A,
+    ACX_SET_RX_DATA_FILTER      = 0x004B,
+    ACX_GET_DATA_FILTER_STATISTICS = 0x004C,
+    ACX_RX_CONFIG_OPT           = 0x004E,
+    ACX_FRAG_CFG                = 0x004F,
+    ACX_BET_ENABLE              = 0x0050,
+	
+#ifdef RADIO_SCOPE  /* RADIO MODULE SECTION START */
+
+	ACX_RADIO_MODULE_START      = 0x0500,
+	ACX_RS_ENABLE				= ACX_RADIO_MODULE_START,
+	ACX_RS_RX					= 0x0501,
+
+    /* Add here ... */
+
+	ACX_RADIO_MODULE_END        = 0x0600,
+
+#endif /* RADIO MODULE SECTION END */
+
+    ACX_RSSI_SNR_TRIGGER        = 0x0051,
+    ACX_RSSI_SNR_WEIGHTS        = 0x0052,
+    ACX_KEEP_ALIVE_MODE         = 0x0053,
+    ACX_SET_KEEP_ALIVE_CONFIG   = 0x0054,
+    ACX_BA_SESSION_RESPONDER_POLICY = 0x0055,
+    ACX_BA_SESSION_INITIATOR_POLICY = 0x0056,
+    ACX_PEER_HT_CAP             = 0x0057,
+    ACX_HT_BSS_OPERATION        = 0x0058,
+    ACX_COEX_ACTIVITY           = 0x0059,
+    ACX_SET_SMART_REFLEX_DEBUG  = 0x005A,
+	ACX_SET_SMART_REFLEX_STATE  = 0x005B,
+	ACX_SET_SMART_REFLEX_PARAMS = 0x005F,
+	ACX_BURST_MODE				= 0x005C,
+
+    ACX_SET_RATE_MAMAGEMENT_PARAMS = 0x005D,
+    ACX_GET_RATE_MAMAGEMENT_PARAMS = 0x005E,
+
+	ACX_SET_RATE_ADAPT_PARAMS 	= 0x0060,
+    ACX_SET_DCO_ITRIM_PARAMS    = 0x0061,
+
+
+    DOT11_RX_MSDU_LIFE_TIME     = 0x1004,
+    DOT11_CUR_TX_PWR            = 0x100D,
+    DOT11_RX_DOT11_MODE         = 0x1012,
+    DOT11_RTS_THRESHOLD         = 0x1013, 
+    DOT11_GROUP_ADDRESS_TBL     = 0x1014,
+    ACX_SET_RADIO_PARAMS		= 0x1015,
+	ACX_PM_CONFIG               = 0x1016,
+     
+    MAX_DOT11_IE = ACX_PM_CONFIG,
+    
+    MAX_IE = 0xFFFF   /*force enumeration to 16bits*/
+} InfoElement_enum;
+
+
+#ifdef HOST_COMPILE
+typedef uint16 InfoElement_e;
+#else
+typedef InfoElement_enum InfoElement_e;
+#endif
+
+
+typedef struct
+{
+    InfoElement_e id;
+    uint16 length;
+    uint32 dataLoc; /*use this to point to for following variable-length data*/
+} InfoElement_t;
+
+
+typedef struct 
+{
+    uint16 id;
+    uint16 len;
+} EleHdrStruct;
+
+#define MAX_NUM_AID     4 /* max number of STAs in IBSS */  
+
+
+#ifdef HOST_COMPILE
+#define INFO_ELE_HDR    EleHdrStruct    EleHdr;
+#else
+#define INFO_ELE_HDR
+#endif
+
+/******************************************************************************
+
+    Name:   ACX_WAKE_UP_CONDITIONS
+    Type:   Configuration
+    Access: Write Only
+    Length: 2
+
+******************************************************************************/
+typedef enum
+{
+    WAKE_UP_EVENT_BEACON_BITMAP     = 0x01, /* Wake on every Beacon*/
+    WAKE_UP_EVENT_DTIM_BITMAP       = 0x02, /* Wake on every DTIM*/
+    WAKE_UP_EVENT_N_DTIM_BITMAP     = 0x04, /* Wake on every Nth DTIM (Listen interval)*/
+    WAKE_UP_EVENT_N_BEACONS_BITMAP  = 0x08, /* Wake on every Nth Beacon (Nx Beacon)*/
+    WAKE_UP_EVENT_BITS_MASK         = 0x0F
+} WakeUpEventBitMask_e;
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8  wakeUpConditionBitmap;   /* The host can set one bit only. */
+                                    /* WakeUpEventBitMask_e describes the Possible */
+                                    /* Wakeup configuration bits*/
+
+    uint8  listenInterval;          /* 0 for Beacon and Dtim, */
+                                    /* xDtims (1-10) for Listen Interval and */
+                                    /* xBeacons (1-255) for NxBeacon*/
+    uint8  padding[2];              /* alignment to 32bits boundry   */
+}WakeUpCondition_t;
+
+/******************************************************************************
+
+    Name:   ACX_MEM_CFG
+    Type:   Configuration
+    Access: Write Only
+    Length: 12
+
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8   rxMemblockNumber;           /* specifies the number of memory buffers that */
+                                        /* is allocated to the Rx memory pool. The */
+                                        /* actual number allocated may be less than*/
+                                        /* this number if there are not enough memory */
+                                        /* blocks left over for the Minimum Number of */
+                                        /* Tx Blocks. Returns the actual number of RX */
+                                        /* buffers allocated in the memory map*/
+
+    uint8   txMinimumMemblockNumber;    /* specifies the minimum number of blocks that */
+                                        /* must be allocated to the TX pool. Follows */
+                                        /* this limit even if the Number of Rx Memory */
+                                        /* Blocks parameter is ignored.*/
+
+    uint8   numStations;                /* The number of STAs supported in IBSS mode. */
+                                        /* The FW uses this field to allocate memory */
+                                        /* for STA context data such as security keys*/
+
+    uint8   numSsidProfiles;            /* The number of SSID profiles used in IBSS mode */
+                                        /* Enables different profiles for different STAs */
+
+    uint32  totalTxDescriptors;         /* Total TX Descriptors - in the past it was configured per AC */
+} ACXConfigMemory_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_SLOT
+    Type:   Configuration
+    Access: Write Only
+    Length: 8
+
+******************************************************************************/
+
+typedef enum
+{
+    SLOT_TIME_LONG = 0,     /* the WiLink uses long (20 us) slots*/
+    SLOT_TIME_SHORT = 1,    /* the WiLink uses short (9 us) slots*/
+    DEFAULT_SLOT_TIME = SLOT_TIME_SHORT,
+    MAX_SLOT_TIMES = 0xFF
+} SlotTime_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 SlotTime_e;
+#else
+typedef SlotTime_enum SlotTime_e;
+#endif
+
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8      woneIndex;   /* reserved*/
+
+    SlotTime_e slotTime;    /* The slot size to be used. refer to SlotTime_enum.    */
+    uint8      reserved[6];
+} ACXSlot_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_AC_CFG
+    Type:   Configuration
+    Access: Write Only
+    Length: 8
+
+******************************************************************************/
+typedef enum
+{
+    AC_BE = 0,          /* Best Effort/Legacy*/
+    AC_BK = 1,          /* Background*/
+    AC_VI = 2,          /* Video*/
+    AC_VO = 3,          /* Voice*/
+    /* AC_BCAST    = 4, */  /* Broadcast dummy access category      */ 
+    AC_CTS2SELF = 4,        /* CTS2Self fictitious AC,              */  
+                            /* uses #4 to follow AC_VO, as          */
+                            /* AC_BCAST does not seem to be in use. */
+        AC_ANY_TID = 0x1F,
+	AC_INVALID = 0xFF,  /* used for gTxACconstraint */
+    NUM_ACCESS_CATEGORIES = 4
+} AccessCategory_enum;
+
+typedef enum
+{
+	TID0 = 0,			/* Best Effort/Legacy*/
+	TID1 = 1,			/* Best Effort/Legacy*/
+	TID2 = 2,			/* Background*/
+	TID3 = 3,			/* Video*/
+	TID4 = 4,			/* Voice*/
+	TID5 = 5,		/* Broadcast dummy access category*/
+	TID6 = 6,
+	TID7 = 7,           /* managment */
+	NUM_TRAFFIC_CATEGORIES = 8
+} TrafficCategory_enum;
+
+
+#define AC_REQUEST                      0xfe    /* Special access category type for */
+                                                /* requests*/
+
+
+/* following are defult values for the IE fields*/
+#define CWMIN_BK  15
+#define CWMIN_BE  15
+#define CWMIN_VI  7
+#define CWMIN_VO  3
+#define CWMAX_BK  1023
+#define CWMAX_BE  63
+#define CWMAX_VI  15
+#define CWMAX_VO  7
+#define AIFS_PIFS 1 /* slot number setting to start transmission at PIFS interval */
+#define AIFS_DIFS 2 /* slot number setting to start transmission at DIFS interval - */
+                    /* normal DCF access */
+
+#define AIFS_MIN AIFS_PIFS
+
+#define AIFSN_BK  7
+#define AIFSN_BE  3
+#define AIFSN_VI  AIFS_PIFS
+#define AIFSN_VO  AIFS_PIFS
+#define TXOP_BK   0
+#define TXOP_BE   0
+#define TXOP_VI   3008
+#define TXOP_VO   1504
+#define DEFAULT_AC_SHORT_RETRY_LIMIT 7
+#define DEFAULT_AC_LONG_RETRY_LIMIT 4
+
+/* rxTimeout values */
+#define NO_RX_TIMEOUT 0
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint8   ac;         /* Access Category - The TX queue's access category */
+                        /* (refer to AccessCategory_enum)*/
+    uint8   cwMin;      /* The contention window minimum size (in slots) for */
+                        /* the access class.*/
+    uint16  cwMax;      /* The contention window maximum size (in slots) for */
+                        /* the access class.*/
+    uint8   aifsn;      /* The AIF value (in slots) for the access class.*/
+    uint8   reserved;
+    uint16  txopLimit;  /* The TX Op Limit (in microseconds) for the access class.*/
+} ACXAcCfg_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_MEM_MAP
+    Type:   Configuration
+    Access: Read Only
+    Length: 72
+    Note:   Except for the numTxMemBlks, numRxMemBlks fields, this is
+            used in MASTER mode only!!!
+    
+******************************************************************************/
+#define MEM_MAP_NUM_FIELDS  24
+
+typedef struct 
+{
+    uint32 *controlBlock; /* array of two 32-bit entries in the following order:
+                            1. Tx-Result entries counter written by the FW
+                            2. Tx-Result entries counter read by the host */
+    void   *txResultQueueStart; /* points t first descriptor in TRQ */
+} TxResultPointers_t;
+
+
+typedef struct
+{
+    INFO_ELE_HDR
+    void *codeStart;                
+    void *codeEnd;                  
+    void *wepDefaultKeyStart;
+    void *wepDefaultKeyEnd;         
+    void *staTableStart;
+    void *staTableEnd;              
+    void *packetTemplateStart;
+    void *packetTemplateEnd;        
+    TxResultPointers_t  trqBlock;             
+ 
+    void *queueMemoryStart;
+    void *queueMemoryEnd; 
+    void *packetMemoryPoolStart;
+    void *packetMemoryPoolEnd;
+    void *debugBuffer1Start;
+    void *debugBuffer1End;
+    void *debugBuffer2Start;
+    void *debugBuffer2End;
+
+    uint32 numTxMemBlks;    /* Number of blocks that FW allocated for TX packets.*/
+    uint32 numRxMemBlks;    /* Number of blocks that FW allocated for RX packets.   */
+
+    /* the following 4 fields are valid in SLAVE mode only */
+    uint8   *txCBufPtr;
+    uint8   *rxCBufPtr;
+    void    *rxControlPtr;
+    void    *txControlPtr;
+
+} MemoryMap_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_AID
+    Type:   Configuration
+    Access: Write Only
+    Length: 2
+    
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint16  Aid;    /* The Association ID to the WiLink. The WiLink uses this */
+                    /* field to determine when the STA's AID bit is set in a */
+                    /* received beacon and when a PS Poll frame should be */
+                    /* transmitted to the AP. The host configures this information */
+                    /* element after it has associated with an AP. This information */
+                    /* element does not need to be set in Ad Hoc mode.*/
+    uint8  padding[2];  /* alignment to 32bits boundry   */
+} ACXAid_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_ERROR_CNT
+    Type:   Operation
+    Access: Read Only
+    Length: 12
+    
+******************************************************************************/
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 PLCPErrorCount;  /* The number of PLCP errors since the last time this */
+                            /* information element was interrogated. This field is */
+                            /* automatically cleared when it is interrogated.*/
+    
+    uint32 FCSErrorCount;   /* The number of FCS errors since the last time this */
+                            /* information element was interrogated. This field is */
+                            /* automatically cleared when it is interrogated.*/
+    
+    uint32 validFrameCount; /* The number of MPDUÂ’s without PLCP header errors received*/
+                            /* since the last time this information element was interrogated. */
+                            /* This field is automatically cleared when it is interrogated.*/
+
+    uint32 seqNumMissCount; /* the number of missed sequence numbers in the squentially */
+                            /* values of frames seq numbers */
+
+} ACXErrorCounters_t;
+
+/******************************************************************************
+
+    Name:   ACX_MEDIUM_USAGE
+    Type:   Configuration
+    Access: Read Only
+    Length: 8
+
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 mediumUsage; /* report to the host the value of medium usage registers*/
+    uint32 period;      /* report to the host the value of medium period registers*/
+} ACXMediumUsage_t;
+
+/******************************************************************************
+
+    Name:   ACX_RX_CFG
+    Type:   Filtering Configuration
+    Access: Write Only
+    Length: 8
+    
+******************************************************************************/
+/*
+ * Rx configuration (filter) information element
+ * ---------------------------------------------
+ */
+/*
+    RX ConfigOptions Table
+    Bit     Definition
+    ===     ==========
+    31:14   Reserved
+    13      Copy RX Status - when set, write three receive status words to top of 
+            rx'd MPDU.
+            When clear, do not write three status words (added rev 1.5)
+    12      Reserved
+    11      RX Complete upon FCS error - when set, give rx complete interrupt for 
+            FCS errors, after the rx filtering, e.g. unicast frames not to us with 
+            FCS error will not generate an interrupt
+    10      SSID Filter Enable - When set, the WiLink discards all beacon, 
+            probe request, and probe response frames with an SSID that does not 
+            match the SSID specified by the host in the START/JOIN command. 
+            When clear, the WiLink receives frames with any SSID.
+    9       Broadcast Filter Enable - When set, the WiLink discards all broadcast 
+            frames. When clear, the WiLink receives all received broadcast frames.
+    8:6     Reserved
+    5       BSSID Filter Enable - When set, the WiLink discards any frames with a 
+            BSSID that does not match the BSSID specified by the host. 
+            When clear, the WiLink receives frames from any BSSID.
+    4       MAC Addr Filter - When set, the WiLink discards any frames with a 
+            destination address that does not match the MAC address of the adaptor. 
+            When clear, the WiLink receives frames destined to any MAC address.
+    3       Promiscuous - When set, the WiLink receives all valid frames 
+            (i.e., all frames that pass the FCS check). 
+            When clear, only frames that pass the other filters specified are received.
+    2       FCS - When set, the WiLink includes the FCS with the received frame. 
+            When clear, the FCS is discarded.
+    1       PLCP header - When set, write all data from baseband to frame buffer 
+            including PHY header.
+    0       Reserved - Always equal to 0.
+
+    RX FilterOptions Table
+    Bit     Definition
+    ===     ==========
+    31:12   Reserved - Always equal to 0.
+    11      Association - When set, the WiLink receives all association related frames 
+            (association request/response, reassocation request/response, and 
+            disassociation). When clear, these frames are discarded.
+    10      Auth/De auth - When set, the WiLink receives all authentication and 
+            de-authentication frames. When clear, these frames are discarded.
+    9       Beacon - When set, the WiLink receives all beacon frames. When clear, 
+            these frames are discarded.
+    8       Contention Free - When set, the WiLink receives all contention free frames. 
+            When clear, these frames are discarded.
+    7       Control - When set, the WiLink receives all control frames. 
+            When clear, these frames are discarded.
+    6       Data - When set, the WiLink receives all data frames.   
+            When clear, these frames are discarded.
+    5       FCS Error - When set, the WiLink receives frames that have FCS errors. 
+            When clear, these frames are discarded.
+    4       Management - When set, the WiLink receives all management frames. 
+            When clear, these frames are discarded.
+    3       Probe Request - When set, the WiLink receives all probe request frames. 
+            When clear, these frames are discarded.
+    2       Probe Response - When set, the WiLink receives all probe response frames. 
+            When clear, these frames are discarded.
+    1       RTS/CTS/ACK - When set, the WiLink receives all RTS, CTS and ACK frames. 
+            When clear, these frames are discarded.
+    0       Rsvd Type/Sub Type - When set, the WiLink receives all frames that 
+            have reserved frame types and sub types as defined by the 802.11 
+            specification. 
+            When clear, these frames are discarded.
+*/
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32          ConfigOptions;  /* The configuration of the receiver in the WiLink. */
+                                    /* "RX ConfigOptions Table" describes the format of */
+                                    /* this field.*/
+    uint32          FilterOptions;  /* The types of frames that the WiLink can receive. */
+                                    /* "RX FilterOptions Table" describes the format of */
+                                    /* this field.*/
+} ACXRxConfig_t;
+
+/******************************************************************************
+
+    Name:   ACX_BEACON_FILTER_OPT
+    Desc:   This information element enables the host to activate beacon filtering. 
+            The filter can only be activated when the STA is in PS mode. 
+            When activated, either the host is not notified about beacons whose 
+            unicast TIM bit is not set, or these beacons are buffered first and 
+            the host is notified only after the buffer reaches a predetermined size.
+            The host should not activate the filter if it configures the firmware 
+            to listen to broadcasts (see the VBM Options field in the 
+            ACXPowerMgmtOptions information element). The filter only affects beacons, 
+            and not other MSDUs - the firmware notifies the host immediately about 
+            their arrival.
+    Type:   Filtering Configuration
+    Access: Write Only
+    Length: 2
+ 
+******************************************************************************/
+typedef struct  
+{
+    INFO_ELE_HDR
+    uint8   enable;                /* Indicates whether the filter is enabled. */
+                                   /* 1 - enabled, 0 - disabled. */
+    uint8   maxNumOfBeaconsStored; /* The number of beacons without the unicast TIM */
+                                   /* bit set that the firmware buffers before */
+                                   /* signaling the host about ready frames. */
+                                   /* When set to 0 and the filter is enabled, beacons */
+                                   /* without the unicast TIM bit set are dropped.*/
+    uint8  padding[2];             /* alignment to 32bits boundry   */
+} ACXBeaconFilterOptions_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_BEACON_FILTER_TABLE
+    Desc:   This information element configures beacon filtering handling for the
+            set of information elements. An information element in a beacon can be 
+            set to be: ignored (never compared, and changes will not cause beacon 
+            transfer), checked (compared, and transferred in case of a change), or 
+            transferred (transferred to the host for each appearance or disappearance).
+            The table contains all information elements that are subject to monitoring 
+            for host transfer. 
+            All information elements that are not in the table should be ignored for 
+            monitoring.
+            This functionality is only enabled when beacon filtering is enabled by 
+            ACX_BEACON_FILTER_OPT.
+    Type:   Filtering Configuration
+    Access: Write Only
+    Length: 101
+    Notes:  the field measuring the value of received beacons for which the device 
+            wakes up the host in ACX_BEACON_FILTER_OPT does not affect 
+            this information element.
+    
+******************************************************************************/
+
+/*
+    ACXBeaconFilterEntry (not 221)
+    Byte Offset     Size (Bytes)    Definition 
+    ===========     ============    ==========
+    0               1               IE identifier
+    1               1               Treatment bit mask
+
+    ACXBeaconFilterEntry (221)
+    Byte Offset     Size (Bytes)    Definition 
+    ===========     ============    ==========
+    0               1               IE identifier
+    1               1               Treatment bit mask
+    2               3               OUI
+    5               1               Type
+    6               2               Version
+
+
+    Treatment bit mask - The information element handling:
+                         bit 0 - The information element is compared and transferred
+                                 in case of change.
+                         bit 1 - The information element is transferred to the host 
+                                 with each appearance or disappearance.
+                         Note that both bits can be set at the same time.
+*/
+#define BEACON_FILTER_TABLE_MAX_IE_NUM                      (32)
+#define BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM      (6)
+#define BEACON_FILTER_TABLE_IE_ENTRY_SIZE                   (2)
+#define BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE   (6)
+#define BEACON_FILTER_TABLE_MAX_SIZE    ((BEACON_FILTER_TABLE_MAX_IE_NUM * BEACON_FILTER_TABLE_IE_ENTRY_SIZE) + \
+                                         (BEACON_FILTER_TABLE_MAX_VENDOR_SPECIFIC_IE_NUM * BEACON_FILTER_TABLE_EXTRA_VENDOR_SPECIFIC_IE_SIZE))
+
+typedef struct ACXBeaconFilterIETableStruct {
+    INFO_ELE_HDR
+    uint8 NumberOfIEs;                          /* The number of IE's in the table*/
+                                                /* 0 - clears the table.*/
+
+    uint8 padding[3];  /* alignment to 32bits boundry   */
+    uint8 IETable[BEACON_FILTER_TABLE_MAX_SIZE];
+} ACXBeaconFilterIETable_t;
+
+/******************************************************************************
+
+    Name:   ACX_COEX_ACTIVITY_TABLE
+    
+******************************************************************************/
+
+typedef enum
+{
+    COEX_IP_BT = 0,
+    COEX_IP_WLAN, 
+    COEX_IP_DUAL_MODE,   /* That define isn't valid value in DR&FW interface and use just in the FW */
+    MAX_COEX_IP
+} CoexIp_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 CoexIp_e;
+#else
+typedef CoexIp_enum CoexIp_e;
+#endif
+
+typedef struct ACXCoexActivityIEStruct {
+    INFO_ELE_HDR
+    CoexIp_e coexIp;         /* 0-BT, 1-WLAN (according to CoexIp_e in FW) */
+    uint8  activityId;       /* According to BT/WLAN activity numbering in FW */ 
+    uint8  defaultPriority;  /* 0-255, activity default priority */
+    uint8  raisedPriority;   /* 0-255, activity raised priority */
+    uint16 minService;       /* 0-65535, The minimum service requested either in
+                                requests or in milliseconds depending on activity ID */
+    uint16 maxService;       /* 0-65535, The maximum service allowed either in
+                            requests or in milliseconds depending on activity ID */
+} ACXCoexActivityIE_t;
+
+/******************************************************************************
+
+    Name:   ACX_ARP_IP_FILTER 
+    Type:   Filtering Configuration
+    Access: Write Only
+    Length: 20
+
+******************************************************************************/
+
+#define ARP_FILTER_DISABLED					(0)
+#define ARP_FILTER_ENABLED					(0x01)
+#define ARP_FILTER_AUTO_ARP_ENABLED			(0x02)
+
+#define ARP_FILTER_SUSPENDED_BY_FW			(0x80)		// Bit set/cleared by FW to indicate temporary suspention of Auto-ARP 
+														// (due to join, before template is configured)
+														// This is NEVER used by the Host itself
+
+#define ARP_FILTER_HOST_ENABLE_MASK			(0x03)		// Take only two lower bits of host configuration
+
+typedef struct  
+{    
+    INFO_ELE_HDR
+    uint8     ipVersion;       /* The IP version of the IP address: 4 - IPv4, 6 - IPv6.*/
+    uint8     arpFilterEnable; /* BITMAP (!) field containing all "enabled" ARP features */
+							   /* 0x00 - No ARP features */
+							   /* 0x01 - Only ARP filtering */
+							   /* 0x02 - Only Auto-ARP */
+	                           /* 0x03 - Both ARP filtering and Auto-ARP */
+    uint8     padding[2];      /* alignment to 32bits boundry   */
+    uint8     address[16];     /* The IP address used to filter ARP packets. ARP packets */
+                               /* that do not match this address are dropped. */
+                               /* When the IP Version is 4, the last 12 bytes of */
+                               /* the address are ignored.*/
+    
+} ACXConfigureIP_t;
+
+
+/******************************************************************************
+
+  Name:     ACX_IBSS_FILTER
+  Type:     Filtering Configuration
+  Access:   Write Only
+  Length:   1
+  
+******************************************************************************/
+typedef struct  
+{
+    INFO_ELE_HDR
+    uint8   enable; /* if set (i.e. IBSS mode), forward beacons from the same SSID*/
+                    /* (also from different BSSID), with bigger TSF then the this of */
+                    /* the current BSS.*/
+    uint8   padding[3]; /* alignment to 32bits boundry   */
+} ACXIBSSFilterOptions_t;
+
+
+/******************************************************************************
+
+  Name:     ACX_SERVICE_PERIOD_TIMEOUT
+  Type:     Configuration
+  Access:   Write Only
+  Length:   1
+  
+******************************************************************************/
+typedef struct 
+{    
+    INFO_ELE_HDR
+    uint16 PsPollTimeout; /* the maximum time that the device will wait to receive */
+                          /* traffic from the AP after transmission of PS-poll.*/
+    
+    uint16 UpsdTimeout;   /* the maximum time that the device will wait to receive */
+                          /* traffic from the AP after transmission from UPSD enabled*/
+                          /* queue.*/
+} ACXRxTimeout_t;
+
+/******************************************************************************
+
+    Name:   ACX_TX_QUEUE_CFG
+    Type:   Configuration
+    Access: Write Only
+    Length: 8
+    
+******************************************************************************/
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8   qID;                        /* The TX queue ID number.*/
+    uint8   padding[3];                 /* alignment to 32bits boundry   */
+    uint16  numberOfBlockHighThreshold; /* The maximum memory blocks allowed in the */
+                                        /* queue.*/
+    uint16  numberOfBlockLowThreshold;  /* The minimum memory blocks that are */
+                                        /* guaranteed for this queue.*/
+} ACXTxQueueCfg_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_STATISTICS
+    Type:   Statistics
+    Access: Write Only
+    Length: 
+    Note:   Debug API
+
+******************************************************************************/
+typedef struct 
+{
+    uint32  debug1;
+    uint32  debug2;
+    uint32  debug3;
+    uint32  debug4;
+    uint32  debug5;
+    uint32  debug6;
+}DbgStatistics_t;
+
+typedef struct 
+{
+    uint32  numOfTxProcs;
+    uint32  numOfPreparedDescs;
+    uint32  numOfTxXfr;
+    uint32  numOfTxDma;    
+    uint32  numOfTxCmplt;
+    uint32  numOfRxProcs;
+    uint32  numOfRxData;
+}RingStatistics_t;
+
+typedef struct
+{
+    uint32 numOfTxTemplatePrepared;
+    uint32 numOfTxDataPrepared;
+    uint32 numOfTxTemplateProgrammed;
+    uint32 numOfTxDataProgrammed;
+	uint32 numOfTxBurstProgrammed;
+    uint32 numOfTxStarts;
+    uint32 numOfTxImmResp;
+    uint32 numOfTxStartTempaltes;
+    uint32 numOfTxStartIntTemplate;
+    uint32 numOfTxStartFwGen;
+    uint32 numOfTxStartData;
+    uint32 numOfTxStartNullFrame;
+	uint32 numOfTxExch;
+    uint32 numOfTxRetryTemplate;
+    uint32 numOfTxRetryData;
+	uint32 numOfTxExchPending;
+    uint32 numOfTxExchExpiry;
+    uint32 numOfTxExchMismatch;
+    uint32 numOfTxDoneTemplate;
+    uint32 numOfTxDoneData;
+    uint32 numOfTxDoneIntTemplate;
+	uint32 numOfTxPreXfr;
+	uint32 numOfTxXfr;
+	uint32 numOfTxXfrOutOfMem;
+	uint32 numOfTxDmaProgrammed;
+	uint32 numOfTxDmaDone;
+} TxStatistics_t;
+
+
+typedef struct
+{
+    uint32 RxOutOfMem;
+    uint32 RxHdrOverflow;
+    uint32 RxHWStuck;
+    uint32 RxDroppedFrame;
+    uint32 RxCompleteDroppedFrame;
+    uint32 RxAllocFrame;
+	uint32 RxDoneQueue;
+	uint32 RxDone;
+	uint32 RxDefrag;
+	uint32 RxDefragEnd;
+	uint32 RxMic;
+	uint32 RxMicEnd;
+	uint32 RxXfr;
+    uint32 RxXfrEnd;
+    uint32 RxCmplt;
+    uint32 RxPreCmplt;
+    uint32 RxCmpltTask;
+	uint32 RxPhyHdr;
+    uint32 RxTimeout;
+} RxStatistics_t;
+
+
+typedef struct
+{
+    uint32 RxDMAErrors;
+    uint32 TxDMAErrors;
+} DMAStatistics_t;
+
+
+typedef struct
+{
+    uint32 IRQs;              /* irqisr() */
+} IsrStatistics_t;
+
+
+typedef struct WepStatistics_t
+{
+    uint32 WepAddrKeyCount;      /* Count of WEP address keys configured*/
+    uint32 WepDefaultKeyCount;   /* Count of default keys configured*/
+    uint32 WepKeyNotFound;       /* count of number of times that WEP key not found on lookup*/
+    uint32 WepDecryptFail;       /* count of number of times that WEP key decryption failed*/
+    uint32 WepEncryptFail;       /* count of number of times that WEP key encryption failed*/
+    uint32 WepDecPackets;        /* WEP Packets Decrypted*/
+    uint32 WepDecInterrupt;      /* WEP Decrypt Interrupts*/
+    uint32 WepEnPackets;         /* WEP Packets Encrypted*/
+    uint32 WepEnInterrupt;       /* WEP Encrypt Interrupts*/
+} WepStatistics_t;
+
+
+#define PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD 10
+typedef struct PwrStatistics_t
+{
+    uint32 MissingBcnsCnt;      /* Count the amount of missing beacon interrupts to the host.*/
+    uint32 RcvdBeaconsCnt;      /* Count the number of received beacons.*/
+    uint32 ConnectionOutOfSync;         /* Count the number of times TSF Out Of Sync occures, meaning we lost more consecutive beacons that defined by the host's threshold.*/
+    uint32 ContMissBcnsSpread[PWR_STAT_MAX_CONT_MISSED_BCNS_SPREAD];  /* Gives statistics about the spread continuous missed beacons.*/
+                                    /* The 16 LSB are dedicated for the PS mode.*/
+                                    /* The 16 MSB are dedicated for the PS mode.*/
+                                    /* ContMissBcnsSpread[0] - single missed beacon.*/
+                                    /* ContMissBcnsSpread[1] - two continuous missed beacons.*/
+                                    /* ContMissBcnsSpread[2] - three continuous missed beacons.*/
+                                    /* ...*/
+                                    /* ContMissBcnsSpread[9] - ten and more continuous missed beacons.*/
+    uint32 RcvdAwakeBeaconsCnt; /* Count the number of beacons in awake mode.*/
+} PwrStatistics_t;
+
+
+typedef struct MicStatistics_t
+{
+    uint32 MicRxPkts;
+    uint32 MicCalcFailure;
+} MicStatistics_t;
+
+
+typedef struct AesStatisticsStruct
+{
+    uint32 AesEncryptFail;
+    uint32 AesDecryptFail;
+    uint32 AesEncryptPackets;
+    uint32 AesDecryptPackets;
+    uint32 AesEncryptInterrupt;
+    uint32 AesDecryptInterrupt;
+} AesStatistics_t;
+
+typedef struct GemStatisticsStruct
+{
+    uint32 GemEncryptFail;
+    uint32 GemDecryptFail;
+    uint32 GemEncryptPackets;
+    uint32 GemDecryptPackets;
+    uint32 GemEncryptInterrupt;
+    uint32 GemDecryptInterrupt;
+} GemStatistics_t;
+
+typedef struct EventStatistics_t
+{
+    uint32 calibration;
+    uint32 rxMismatch;
+    uint32 rxMemEmpty;
+} EventStatistics_t;
+
+
+typedef struct PsPollUpsdStatistics_t
+{
+    uint32 psPollTimeOuts;
+    uint32 upsdTimeOuts;
+    uint32 upsdMaxAPturn;
+    uint32 psPollMaxAPturn;
+    uint32 psPollUtilization;
+    uint32 upsdUtilization;
+} PsPollUpsdStatistics_t;
+
+typedef struct RxFilterStatistics_t
+{
+    uint32 beaconFilter;
+    uint32 arpFilter;
+    uint32 MCFilter;
+    uint32 dupFilter;
+    uint32 dataFilter;
+    uint32 ibssFilter;
+} RxFilterStatistics_t;
+
+typedef struct ClaibrationFailStatistics_t
+{
+	uint32 initCalTotal;
+	uint32 initRadioBandsFail;
+	uint32 initSetParams;
+	uint32 initTxClpcFail;
+	uint32 initRxIqMmFail;
+	uint32 tuneCalTotal;
+	uint32 tuneDrpwRTrimFail;
+	uint32 tuneDrpwPdBufFail;
+	uint32 tuneDrpwTxMixFreqFail;
+	uint32 tuneDrpwTaCal;
+	uint32 tuneDrpwRxIf2Gain;
+	uint32 tuneDrpwRxDac;
+	uint32 tuneDrpwChanTune;
+	uint32 tuneDrpwRxTxLpf;
+	uint32 tuneDrpwLnaTank;
+	uint32 tuneTxLOLeakFail;
+	uint32 tuneTxIqMmFail;
+	uint32 tuneTxPdetFail;
+	uint32 tuneTxPPAFail;
+	uint32 tuneTxClpcFail;
+	uint32 tuneRxAnaDcFail;
+	uint32 tuneRxIqMmFail;
+	uint32 calStateFail;
+}ClaibrationFailStatistics_t;
+
+typedef struct ACXStatisticsStruct
+{
+    INFO_ELE_HDR
+    RingStatistics_t ringStat;
+    DbgStatistics_t  debug;
+    TxStatistics_t   tx;
+    RxStatistics_t   rx;
+    DMAStatistics_t  dma;
+    IsrStatistics_t  isr;
+    WepStatistics_t  wep;
+    PwrStatistics_t  pwr;
+    AesStatistics_t  aes;
+    MicStatistics_t  mic;
+    EventStatistics_t event;
+    PsPollUpsdStatistics_t ps;
+    RxFilterStatistics_t rxFilter;
+	ClaibrationFailStatistics_t radioCal;
+    GemStatistics_t  gem;
+} ACXStatistics_t;
+
+/******************************************************************************
+
+    Name:   ACX_ROAMING_STATISTICS_TBL
+    Desc:   This information element reads the current roaming triggers 
+            counters/metrics. 
+    Type:   Statistics
+    Access: Read Only
+    Length: 6
+
+******************************************************************************/
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint32 MissedBeacons; /* The current number of consecutive lost beacons*/
+	uint8  snrData;       /* The current average SNR in db - For Data Packets*/
+	uint8  snrBeacon;     /* The current average SNR in db - For Beacon Packets*/
+    int8   rssiData;      /* The current average RSSI  - For Data Packets*/
+    int8   rssiBeacon;    /* The current average RSSI - For Beacon Packets*/
+}ACXRoamingStatisticsTable_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_FEATURE_CFG
+    Desc:   Provides expandability for future features
+    Type:   Configuration
+    Access: Write Only
+    Length: 8
+    
+******************************************************************************/
+
+/* bit defines for Option: */
+#define FEAT_PCI_CLK_RUN_ENABLE     0x00000002  /* Enable CLK_RUN on PCI bus */
+
+/* bit defines for dataflowOptions: */
+#define DF_ENCRYPTION_DISABLE       0x00000001  /* When set, enable encription in FW.*/
+                                                /* when clear, disable encription. */
+#define DF_SNIFF_MODE_ENABLE        0x00000080  /* When set, enable decryption in FW.*/
+                                                /* when clear, disable decription. */
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 Options;         /* Data flow options - refer to above definitions*/
+    uint32 dataflowOptions; /* Data flow options - refer to above definitions*/
+} ACXFeatureConfig_t;
+
+
+
+/******************************************************************************
+
+    Name:   ACX_TID_CFG
+    Type:   Configuration
+    Access: Write Only
+    Length: 16
+    
+******************************************************************************/
+typedef enum
+{
+    CHANNEL_TYPE_DCF = 0,   /* DC/LEGACY*/
+    CHANNEL_TYPE_EDCF = 1,  /* EDCA*/
+    CHANNEL_TYPE_HCCA = 2,  /* HCCA*/
+    MAX_CHANNEL_TYPE = CHANNEL_TYPE_HCCA
+} ChannelType_enum;
+
+typedef enum
+{
+    PS_SCHEME_LEGACY         = 0, /* Regular PS: simple sending of packets*/
+    PS_SCHEME_UPSD_TRIGGER   = 1, /* UPSD: sending a packet triggers a UPSD downstream*/
+    PS_SCHEME_LEGACY_PSPOLL  = 2, /* Legacy PSPOLL: a PSPOLL packet will be sent before */
+                                  /* every data packet transmission in this queue.*/
+    PS_SCHEME_SAPSD          = 3, /* Scheduled APSD mode.*/
+    MAX_PS_SCHEME = PS_SCHEME_SAPSD
+} PSScheme_enum;
+
+typedef enum
+{
+    ACK_POLICY_LEGACY = 0,   /* ACK immediate policy*/
+    ACK_POLICY_NO_ACK = 1,   /* no ACK policy*/
+    ACK_POLICY_BLOCK  = 2,   /* block ack policy*/
+    MAX_ACK_POLICY = ACK_POLICY_BLOCK
+} AckPolicy_enum;
+
+
+#ifdef HOST_COMPILE
+typedef uint8 ChannelType_e;
+typedef uint8 PSScheme_e;
+typedef uint8 AckPolicy_e;
+#else
+typedef ChannelType_enum ChannelType_e;
+typedef PSScheme_enum PSScheme_e;
+typedef AckPolicy_enum AckPolicy_e;
+#endif
+
+
+
+/* Michal recommendation:
+   in the ACXTIDConfig_t structure we need only the fields psScheme, and one other field for AC id (queue? tsid?).
+   the rest are obsolete. see IEPsDeliveryTriggerType_t in CE2.0.
+   */
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8   queueID;        /* The TX queue ID number (0-7).*/
+    uint8   channelType;    /* Channel access type for the queue.*/
+                            /* Refer to ChannelType_enum.*/
+    uint8   tsid;           /* for EDCA - the AC Index (0-3, refer to*/
+                            /* AccessCategory_enum).*/
+                            /* For HCCA - HCCA Traffic Stream ID (TSID) of */
+                            /* the queue (8-15).*/
+    PSScheme_e  psScheme;   /* The power save scheme of the specified queue.*/
+                            /* Refer to PSScheme_enum.*/
+    AckPolicy_e ackPolicy;  /* The TX queue ACK policy. */
+    uint8  padding[3];      /* alignment to 32bits boundry   */
+    uint32 APSDConf[2];     /* Not supported in this version !!!*/
+}ACXTIDConfig_t;
+
+
+
+/******************************************************************************
+
+    Name:	ACX_PS_RX_STREAMING
+	Type:	Configuration
+	Access:	Write Only
+	Length: 32
+	
+******************************************************************************/
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8 	TID;            /* The TID index*/
+    Bool_e 	rxPSDEnabled;   /* indicates if this traffic stream requires */
+                            /* employing an RX Streaming delivery mechanism for the TID*/
+
+    uint8   streamPeriod;   /* the time period for which a trigger needs to be transmitted*/
+                            /* in case no data TX triggers are sent by host*/
+    uint8   txTimeout;      /* the timeout from last TX trigger after which FW*/
+                            /* starts generating triggers by itself*/
+}ACXPsRxStreaming_t;
+
+/************************************************************
+*      MULTIPLE RSSI AND SNR                                *
+*************************************************************/
+
+typedef enum
+{
+    RX_QUALITY_EVENT_LEVEL = 0,  /* The event is a "Level" indication which keeps */
+                               /* triggering as long as the average RSSI is below*/
+                               /* the threshold.*/
+
+	RX_QUALITY_EVENT_EDGE = 1    /* The event is an "Edge" indication which triggers*/
+                               /* only when the RSSI threshold is crossed from above.*/
+}rxQualityEventType_enum;
+
+/* The direction in which the trigger is active */
+typedef enum
+{
+    RSSI_EVENT_DIR_LOW = 0,
+    RSSI_EVENT_DIR_HIGH = 1,
+    RSSI_EVENT_DIR_BIDIR = 2
+}RssiEventDir_e;
+
+/******************************************************************************
+
+    RSSI/SNR trigger configuration:
+
+    ACX_RSSI_SNR_TRIGGER
+    ACX_RSSI_SNR_WIGHTS
+
+******************************************************************************/
+#define NUM_OF_RSSI_SNR_TRIGGERS 8
+typedef struct
+{
+    int16  threshold;
+    uint16 pacing; /* Minimum delay between consecutive triggers in milliseconds (0 - 60000) */
+    uint8  metric; /* RSSI Beacon, RSSI Packet, SNR Beacon, SNR Packet */
+    uint8  type;   /* Level / Edge */
+    uint8  direction; /* Low, High, Bidirectional */
+    uint8  hystersis; /* Hysteresis range in dB around the threshold value (0 - 255) */
+    uint8  index; /* Index of Event. Values 0 - 7 */
+    uint8  enable; /* 1 - Configured, 2 - Not Configured;  (for recovery using) */
+    uint8  padding[2];
+}RssiSnrTriggerCfg_t;
+
+typedef struct
+{
+    INFO_ELE_HDR
+    RssiSnrTriggerCfg_t param;
+}ACXRssiSnrTriggerCfg_t;
+
+/* Filter Weight for every one of 4 RSSI /SNR Trigger Metrics  */
+typedef struct
+{
+    uint8 rssiBeaconAverageWeight;
+    uint8 rssiPacketAverageWeight;
+    uint8 snrBeaconAverageWeight;
+    uint8 snrPacketAverageWeight;
+}RssiSnrAverageWeights_t;
+
+typedef struct
+{
+    INFO_ELE_HDR
+    RssiSnrAverageWeights_t param;
+}ACXRssiSnrAverageWeights_t;
+
+typedef enum
+{
+    METRIC_EVENT_RSSI_BEACON = 0,
+    METRIC_EVENT_RSSI_DATA   = 1,
+    METRIC_EVENT_SNR_BEACON  = 2,
+    METRIC_EVENT_SNR_DATA     = 3, 
+	METRIC_EVENT_TRIGGER_SIZE = 4
+}MetricEvent_e;
+
+/******************************************************************************
+
+    Name:   ACX_NOISE_HIST
+    Desc:   Noise Histogram activation is done by special command from host which
+            is responsible to read the results using this IE.
+    Type:   Configuration
+    Access: Read Only
+    Length: 48 (NOISE_HIST_LEN=8)
+    
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 counters[NOISE_HIST_LEN]; /* This array of eight 32 bit counters describes */
+                                     /* the histogram created by the FW noise */
+                                     /* histogram engine.*/
+
+    uint32 numOfLostCycles;          /* This field indicates the number of measurement */
+                                     /* cycles with failure because Tx was active.*/
+
+    uint32 numOfTxHwGenLostCycles;   /* This field indicates the number of measurement */
+                                     /* cycles with failure because Tx (FW Generated)*/
+                                     /* was active.*/
+
+    uint32 numOfRxLostCycles;        /* This field indicates the number of measurement */
+                                     /* cycles because the Rx CCA was active. */
+} NoiseHistResult_t;
+
+/******************************************************************************
+
+    Name:   ACX_PD_THRESHOLD
+    Type:   Configuration
+    Access: Write Only
+    Length: 4
+
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 pdThreshold; /* The packet detection threshold in the PHY.*/
+} ACXPacketDetection_t;
+
+
+/******************************************************************************
+
+    Name:	ACX_RATE_POLICY
+	Type:	Configuration
+	Access:	Write Only
+	Length: 132
+
+******************************************************************************/
+
+#define HOST_MAX_RATE_POLICIES       (8)
+     
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint32        numOfClasses;                    /* The number of transmission rate */
+                                                   /* fallback policy classes.*/
+
+    txAttrClass_t rateClasses[HOST_MAX_RATE_POLICIES];  /* Rate Policies table*/
+}ACXTxAttrClasses_t;
+
+
+
+/******************************************************************************
+
+    Name:   ACX_CTS_PROTECTION
+    Type:   Configuration
+    Access: Write Only
+    Length: 1
+    
+******************************************************************************/
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint8   ctsProtectMode; /* This field is a flag enabling or disabling the*/
+                                /* CTS-to-self protection mechanism:*/
+                                /* 0 - disable, 1 - enable*/
+    uint8  padding[3];          /* alignment to 32bits boundry   */
+}ACXCtsProtection_t;
+
+/******************************************************************************
+
+    ACX_FRAG_CFG
+
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint16  fragThreshold;
+    uint8   padding[2];          /* alignment toIE_RTS_CTS_CFG 32bits boundry   */
+   
+} ACXFRAGThreshold_t;
+
+
+/******************************************************************************
+
+    ACX_RX_CONFIG_OPT
+
+******************************************************************************/
+typedef enum  
+{
+    RX_QUEUE_TYPE_RX_LOW_PRIORITY,    /* All except the high priority */
+    RX_QUEUE_TYPE_RX_HIGH_PRIORITY,   /* Management and voice packets */
+    RX_QUEUE_TYPE_NUM,
+    RX_QUEUE_TYPE_MAX = MAX_POSITIVE8
+} RxQueueType_enum;
+
+
+#ifdef HOST_COMPILE
+    typedef uint8 RxQueueType_e;
+#else
+    typedef RxQueueType_enum RxQueueType_e;
+#endif
+
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint16         rxMblkThreshold;   /* Occupied Rx mem-blocks number which requires interrupting the host (0 = no buffering) */
+    uint16         rxPktThreshold;    /* Rx packets number which requires interrupting the host  (0 = no buffering) */ 
+    uint16         rxCompleteTimeout; /* Max time in msec the FW may delay Rx-Complete interrupt */
+    RxQueueType_e  rxQueueType;       /* see above */   
+    uint8          reserved;
+} ACXRxBufferingConfig_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_SLEEP_AUTH
+    Desc:   configuration of sleep authorization level
+    Type:   System Configuration
+    Access: Write Only
+    Length: 1
+
+******************************************************************************/
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint8   sleepAuth; /* The sleep level authorization of the device. */
+                       /* 0 - Always active*/
+                       /* 1 - Power down mode: light / fast sleep*/
+                       /* 2 - ELP mode: Deep / Max sleep*/
+        
+    uint8  padding[3]; /* alignment to 32bits boundry   */
+}ACXSleepAuth_t;
+
+/******************************************************************************
+
+    Name:	ACX_PM_CONFIG
+	Desc:   configuration of power management
+	Type:	System Configuration
+	Access:	Write Only
+	Length: 1
+
+******************************************************************************/
+
+typedef struct 
+{
+    INFO_ELE_HDR
+	uint32	hostClkSettlingTime;	/* Host CLK settling time (in uSec units) */
+	uint8	hostFastWakeupSupport;	/* 0 - not supported */
+									/* 1 - supported */
+    uint8  padding[3]; 				/* alignment to 32bits boundry   */
+}ACXPMConfig_t;
+
+/******************************************************************************
+
+    Name:   ACX_PREAMBLE_TYPE
+    Type:   Configuration
+    Access: Write Only
+    Length: 1
+    
+******************************************************************************/
+
+typedef enum
+{
+	LONG_PREAMBLE			= 0,
+	SHORT_PREAMBLE			= 1,
+	OFDM_PREAMBLE			= 4,
+	N_MIXED_MODE_PREAMBLE	= 6,
+	GREENFIELD_PREAMBLE		= 7,
+	PREAMBLE_INVALID		= 0xFF
+} Preamble_enum;
+
+
+#ifdef HOST_COMPILE
+typedef uint8 Preamble_e;
+#else
+typedef Preamble_enum Preamble_e;
+#endif
+
+
+typedef struct
+{
+    INFO_ELE_HDR
+    Preamble_e preamble; /* When set, the WiLink transmits beacon, probe response, */
+                         /* RTS and PS Poll frames with a short preamble. */
+                         /* When clear, the WiLink transmits the frame with a long */
+                         /* preamble.*/
+    uint8  padding[3];  /* alignment to 32bits boundry   */
+} ACXPreamble_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_CCA_THRESHOLD
+    Type:   Configuration
+    Access: Write Only
+    Length: 2
+    
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint16 rxCCAThreshold; /* The Rx Clear Channel Assessment threshold in the PHY*/
+                           /* (the energy threshold).*/
+    Bool_e txEnergyDetection;  /* The Tx ED value for TELEC Enable/Disable*/
+    uint8  padding;
+} ACXEnergyDetection_t;
+      
+
+/******************************************************************************
+
+    Name:   ACX_EVENT_MBOX_MASK
+    Type:   Operation
+    Access: Write Only
+    Length: 8
+    
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 lowEventMask;   /* Indicates which events are masked and which are not*/
+                           /* Refer to EventMBoxId_enum in public_event_mbox.h.*/
+    
+    uint32 highEventMask;  /* Not in use (should always be set to 0xFFFFFFFF).*/
+} ACXEventMboxMask_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_CONN_MONIT_PARAMS
+    Desc:   This information element configures the SYNCHRONIZATION_TIMEOUT 
+            interrupt indicator. It configures the number of missed Beacons 
+            before issuing the SYNCHRONIZATION_TIMEOUT event.
+    Type:   Configuration
+    Access: Write Only
+    Length: 8
+
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 TSFMissedThreshold; /* The number of consecutive beacons that can be */
+                               /* lost before the WiLink raises the */
+                               /* SYNCHRONIZATION_TIMEOUT event.*/
+
+    uint32 BSSLossTimeout;     /* The delay (in time units) between the time at */
+                               /* which the device issues the SYNCHRONIZATION_TIMEOUT*/
+                               /* event until, if no probe response or beacon is */
+                               /* received a BSS_LOSS event is issued.*/
+} AcxConnectionMonitorOptions;
+
+/******************************************************************************
+
+    Name:   ACX_CONS_TX_FAILURE
+    Desc:   This information element configures the number of frames transmission
+            failures before issuing the "Max Tx Retry" event. The counter is 
+            incremented only for unicast frames or frames that require Ack 
+    Type:   Configuration
+    Access: Write Only
+    Length: 1
+    
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8 maxTxRetry; /* the number of frames transmission failures before */
+                      /* issuing the "Max Tx Retry" event*/
+    uint8  padding[3];  /* alignment to 32bits boundry   */
+} ACXConsTxFailureTriggerParameters_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_BCN_DTIM_OPTIONS
+    Type:   Configuration
+    Access: Write Only
+    Length: 5
+    
+******************************************************************************/
+
+typedef struct 
+{    
+    INFO_ELE_HDR
+    uint16 beaconRxTimeOut;
+    uint16 broadcastTimeOut;
+    uint8  rxBroadcastInPS;  /* if set, enables receive of broadcast packets */
+                             /* in Power-Save mode.*/
+    uint8  consecutivePsPollDeliveryFailureThr;         /* Consecutive PS Poll Fail before updating the Driver */
+    uint8  padding[2];       /* alignment to 32bits boundry   */
+} ACXBeaconAndBroadcastOptions_t;
+
+
+/******************************************************************************
+
+    Name:   ACX_SG_ENABLE
+    Desc:   This command instructs the WiLink to set the Soft Gemini (BT co-existence)
+            state to either enable/disable or sense mode. 
+    Type:   Configuration
+    Access: Write Only
+    Length: 1
+    
+******************************************************************************/
+typedef struct
+{
+    INFO_ELE_HDR
+	uint8	coexOperationMode; /* 0- Co-ex operation is Disabled
+								  1- Co-ex operation is configured to Protective mode
+								  2- Co-ex operation is configured to Opportunistic mode 
+			                      
+								  Default Value: 0- Co-ex operation is Disabled
+								*/
+
+    uint8  padding[3];  /* alignment to 32bits boundry   */
+
+} ACXBluetoothWlanCoEnableStruct;
+
+
+/* struct TSoftGeminiParams
+ * brief Soft Gemini Parameters
+ * 
+ * Description
+ * Used for Setting/Printing Soft Gemini Parameters
+ * 
+ * 
+ */ 
+typedef enum
+{   
+    SOFT_GEMINI_BT_PER_THRESHOLD = 0,
+    SOFT_GEMINI_HV3_MAX_OVERRIDE,
+    SOFT_GEMINI_BT_NFS_SAMPLE_INTERVAL,
+    SOFT_GEMINI_BT_LOAD_RATIO,
+    SOFT_GEMINI_AUTO_PS_MODE,      
+    SOFT_GEMINI_AUTO_SCAN_PROBE_REQ,
+    SOFT_GEMINI_ACTIVE_SCAN_DURATION_FACTOR_HV3,
+    SOFT_GEMINI_ANTENNA_CONFIGURATION,
+    SOFT_GEMINI_BEACON_MISS_PERCENT,
+    SOFT_GEMINI_RATE_ADAPT_THRESH,
+    SOFT_GEMINI_RATE_ADAPT_SNR, 
+    SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR,
+    SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR,
+    SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR,
+    SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR,
+    SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR,
+    SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR,
+    SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR,
+    SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR,
+    SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR,
+    SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR,
+    SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR,
+    SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR,
+    SOFT_GEMINI_RXT,
+    SOFT_GEMINI_TXT,
+    SOFT_GEMINI_ADAPTIVE_RXT_TXT,
+    SOFT_GEMINI_PS_POLL_TIMEOUT,
+    SOFT_GEMINI_UPSD_TIMEOUT,
+    SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR,
+    SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR,
+    SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR,
+    SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR,
+    SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR,
+    SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR,
+    SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MIN_BR,
+    SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MAX_BR,
+    SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_BR,
+    SOFT_GEMINI_PASSIVE_SCAN_DURATION_FACTOR_HV3,
+    SOFT_GEMINI_PASSIVE_SCAN_DURATION_FACTOR_A2DP,
+    SOFT_GEMINI_PASSIVE_SCAN_BT_TIME,
+    SOFT_GEMINI_PASSIVE_SCAN_WLAN_TIME,
+    SOFT_GEMINI_HV3_MAX_SERVED, 
+    SOFT_GEMINI_DHCP_TIME,
+    SOFT_GEMINI_ACTIVE_SCAN_DURATION_FACTOR_A2DP,
+    SOFT_GEMINI_TEMP_PARAM_1,
+    SOFT_GEMINI_TEMP_PARAM_2,
+    SOFT_GEMINI_TEMP_PARAM_3,
+    SOFT_GEMINI_TEMP_PARAM_4,
+    SOFT_GEMINI_TEMP_PARAM_5,
+    SOFT_GEMINI_PARAMS_MAX
+} softGeminiParams;
+
+ 
+typedef struct
+{	
+  uint32   coexParams[SOFT_GEMINI_PARAMS_MAX];
+  uint8    paramIdx;       /* the param index which the FW should update, if it equals to 0xFF - update all */ 
+  uint8       padding[3];
+} TSoftGeminiParams;
+
+
+/******************************************************************************
+
+    Name:   ACX_SG_CFG
+    Desc:   This command instructs the WiLink to set the Soft Gemini (BT co-existence) 
+            parameters to the desired values. 
+    Type:   Configuration
+	Access:	Write (Read For GWSI - disable for now)
+    Length: 1
+    
+******************************************************************************/
+typedef struct
+
+{
+    INFO_ELE_HDR
+	
+	TSoftGeminiParams softGeminiParams;
+
+} ACXBluetoothWlanCoParamsStruct;
+  
+/******************************************************************************
+
+    Name:   ACX_FM_COEX_CFG
+    Desc:   This command instructs the WiLink to set the FM co-existence
+            parameters to the desired values. 
+    Type:   Configuration
+	Access:	Write
+    Length: 
+    
+******************************************************************************/
+typedef struct
+
+{
+    INFO_ELE_HDR
+	
+    uint8   enable;                     /* enable(1) / disable(0) the FM Coex feature */
+
+    uint8   swallowPeriod;              /* Swallow period used in COEX PLL swallowing mechanism, range 1-7 */
+
+    uint8   nDividerFrefSet1;           /* The N divider used in COEX PLL swallowing mechanism for Fref of 38.4/19.2 Mhz.  
+                                           Range: 0-0xFF,  0xFF = use FW default
+                                        */
+
+    uint8   nDividerFrefSet2;           /* The N divider used in COEX PLL swallowing mechanism for Fref of 26/52 Mhz.
+                                           Range: 0-0xFF,  0xFF = use FW default
+                                        */
+
+    uint16  mDividerFrefSet1;           /* The M divider used in COEX PLL swallowing mechanism for Fref of 38.4/19.2 Mhz.
+                                           Range: 0-0x1FF,  0xFFFF = use FW default
+                                        */
+
+    uint16  mDividerFrefSet2;           /* The M divider used in COEX PLL swallowing mechanism for Fref of 26/52 Mhz.
+                                           Range: 0-0x1FF,  0xFFFF = use FW default
+                                        */
+
+    uint32  coexPllStabilizationTime;   /* The time duration in uSec required for COEX PLL to stabilize.
+                                           0xFFFFFFFF = use FW default
+                                        */
+
+    uint16  ldoStabilizationTime;       /* The time duration in uSec required for LDO to stabilize.
+                                           0xFFFFFFFF = use FW default
+                                        */
+
+    uint8   fmDisturbedBandMargin;      /* The disturbed frequency band margin around the disturbed 
+                                             frequency center (single sided). 
+                                           For example, if 2 is configured, the following channels 
+                                             will be considered disturbed channel: 
+                                             80 +- 0.1 MHz, 91 +- 0.1 MHz, 98 +- 0.1 MHz, 102 +- 0.1 MHz
+                                           0xFF = use FW default
+                                        */
+
+	uint8	swallowClkDif;              /* The swallow clock difference of the swallowing mechanism.
+                                           0xFF = use FW default
+                                        */
+
+} ACXWlanFmCoexStruct;
+  
+
+
+/******************************************************************************
+
+    Name:   ACX_TSF_INFO
+    Type:   Operation
+    Access: Read Only
+    Length: 20
+
+******************************************************************************/
+typedef struct ACX_fwTSFInformation
+{
+    INFO_ELE_HDR
+    uint32 CurrentTSFHigh;
+    uint32 CurrentTSFLow;
+    uint32 lastTBTTHigh;
+    uint32 lastTBTTLow;
+    uint8 LastDTIMCount;
+    uint8  padding[3];  /* alignment to 32bits boundry   */
+}ACX_fwTSFInformation_t;
+
+ 
+/******************************************************************************
+
+Name:   ACX_BET_ENABLE
+Desc:   Enable or Disable the Beacon Early Termination module. In addition initialized the
+        Max Dropped beacons parameter
+Type:   Configuration
+Access: Write 
+Length: 6
+Note:  
+******************************************************************************/
+typedef struct
+
+{
+    INFO_ELE_HDR
+    uint8           Enable;                                     /* specifies if beacon early termination procedure is enabled or disabled: 0 – disabled, 1 – enabled */
+    uint8           MaximumConsecutiveET;           /* specifies the maximum number of consecutive beacons that may be early terminated. After this number is reached 
+                                                       at least one full beacon must be correctly received in FW before beacon ET resumes.  Legal range: 0 – 255 */
+    uint8           padding[2];
+}ACXBet_Enable_t;
+
+
+/******************************************************************************
+
+    Name:   DOT11_RX_MSDU_LIFE_TIME
+    Type:   Operation
+    Access: Write Only
+    Length: 4
+    
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 RxMsduLifeTime; /* The maximum amount of time, in TU, that the WiLink */
+                           /* should attempt to collect fragments of an MSDU before */
+                           /* discarding them. */
+                           /* The default value for this field is 512.*/
+} dot11RxMsduLifeTime_t;
+
+
+/******************************************************************************
+
+    Name:   DOT11_CUR_TX_PWR
+    Desc:   This IE indicates the maximum TxPower in Dbm/10 currently being used to transmit data.
+    Type:   Operation
+    Access: Write Only
+    Length: 1
+    
+******************************************************************************/
+
+typedef struct
+{ 
+    INFO_ELE_HDR
+    uint8 dot11CurrentTxPower; /* the max Power in Dbm/10 to be used to transmit data.*/
+    uint8  padding[3];  /* alignment to 32bits boundry   */
+} dot11CurrentTxPowerStruct ;
+
+
+/******************************************************************************
+
+    Name:   DOT11_RX_DOT11_MODE
+    Desc:   This IE indicates the current Rx Mode used by DSSS PHY.
+    Type:   Configuration
+    Access: Write Only
+    Length: 4
+    
+******************************************************************************/
+/*
+Possible values for Rx DOT11 Mode are the following:
+Value   Description
+=====   ===========
+3       11g - processing of both a and b packet formats is enabled
+2       11b - processing of b packet format is enabled
+1       11a - processing of a packet format is enabled
+0       undefined
+*/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 dot11RxDot11Mode; /* refer to above table*/
+} dot11RxDot11ModeStruct;
+
+
+/******************************************************************************
+
+    Name:   DOT11_RTS_THRESHOLD 
+    Type:   Configuration
+    Access: Write Only
+    Length: 2
+
+******************************************************************************/
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint16  RTSThreshold; /* The number of octets in an MPDU, below which an */
+                          /* RTS/CTS handshake is not performed.*/
+    
+    uint8  padding[2];  /* alignment to 32bits boundry   */
+}dot11RTSThreshold_t;
+
+
+/******************************************************************************
+
+    Name:   DOT11_GROUP_ADDRESS_TBL
+    Desc:   The variable lengths of MAC addresses that are define as listening for
+            multicast. The field Number of groups identifies how many MAC Addresses 
+            are relevant in that information element.
+    Type:   Configuration
+    Access: Write Only
+    Length: up to 50 bytes
+
+******************************************************************************/
+#define ADDRESS_GROUP_MAX       (8)
+#define ADDRESS_GROUP_MAX_LEN   (6 * ADDRESS_GROUP_MAX)
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint8   fltrState;                           /* 1 - multicast filtering is enabled. */
+                                                 /* 0 - multicast filtering is disabled.*/
+
+    uint8   numOfGroups;                         /* number of relevant multicast */
+                                                 /* addresses.*/
+
+    uint8   padding[2];  /* alignment to 32bits boundary   */
+    uint8   dataLocation[ADDRESS_GROUP_MAX_LEN]; /* table of MAC addresses.*/
+}dot11MulticastGroupAddrStart_t;
+
+/******************************************************************************
+
+   ACX_CONFIG_PS_WMM (Patch for Wi-Fi Bug)
+
+******************************************************************************/
+
+typedef struct 
+{    
+    INFO_ELE_HDR
+    uint32      ConfigPsOnWmmMode;  /* TRUE  - Configure PS to work on WMM mode - do not send the NULL/PS_POLL 
+                                               packets even if TIM is set.
+                                       FALSE - Configure PS to work on Non-WMM mode - work according to the 
+                                               standard. */
+} ACXConfigPsWmm_t;
+
+/******************************************************************************
+
+      
+    Name:   ACX_SET_RX_DATA_FILTER
+    Desc:   This IE configure one filter in the data filter module. can be used 
+            for add / remove / modify filter.
+    Type:   Filtering Configuration
+    Access: Write Only
+    Length: 4 + size of the fields of the filter (can vary between filters)
+
+******************************************************************************/
+/* data filter action */
+
+#ifdef HOST_COMPILE
+
+#define FILTER_DROP  0          /* Packet will be dropped by the FW and wont be delivered to the driver. */
+#define FILTER_SIGNAL  1        /* Packet will be delivered to the driver. */
+#define FILTER_FW_HANDLE  2     /* Packet will be handled by the FW and wont be delivered to the driver. */
+
+#else
+
+typedef enum {
+    FILTER_DROP = 0,
+    FILTER_SIGNAL  ,
+    FILTER_FW_HANDLE, 
+    FILTER_MAX  = 0xFF
+}filter_enum;
+
+#endif
+
+#ifdef HOST_COMPILE
+typedef uint8 filter_e;
+#else
+typedef filter_enum filter_e;
+#endif
+
+/* data filter command */
+#define REMOVE_FILTER   0       /* Remove filter */
+#define ADD_FILTER      1       /* Add filter */
+
+/* limitation */
+#define MAX_DATA_FILTERS 4
+#define MAX_DATA_FILTER_SIZE 90
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint8                command;   /* 0-remove, 1-add */
+    uint8                index;     /* range 0-MAX_DATA_FILTERS */
+    filter_e             action;    /* action: FILTER_DROP, FILTER_SIGNAL, FILTER_FW_HANDLE */  
+    uint8                numOfFields; /* number of field in specific filter */
+    uint8                FPTable;   /* filter fields starts here. variable size. */
+} DataFilterConfig_t;
+
+/******************************************************************************
+      
+    Name:   ACX_ENABLE_RX_DATA_FILTER
+    Desc:   This IE disable / enable the data filtering feature. in case the
+            featue is enabled - default action should be set as well.
+    Type:   Filtering Configuration
+    Access: Write Only
+    Length: 2
+
+******************************************************************************/
+
+typedef struct  
+{
+    INFO_ELE_HDR
+    uint8       enable;     /* 1 - enable, 0 - disable the data data filtering feature */
+    filter_e    action;     /* default action that should be implemented for packets that wont
+                               match any of the filters, or in case no filter is configured */
+} DataFilterDefault_t;
+
+
+/******************************************************************************
+      
+    Name:   ACX_GET_DATA_FILTER_STATISTICS
+    Desc:   get statistics of the data filtering module.
+    Type:   Statistics
+    Access: Read Only
+    Length: 20
+
+******************************************************************************/
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint32  unmatchedPacketsCount;                  /* number of packets didn't match any filter (when the feature was enabled). */
+    uint32  matchedPacketsCount[MAX_DATA_FILTERS];  /* number of packets matching each of the filters */
+} ACXDataFilteringStatistics_t;
+
+
+#ifdef RADIO_SCOPE
+/******************************************************************************
+
+******************************************************************************
+
+    Name:	ACX_RS_ENABLE
+	Desc:   This command instructs the WiLink to set the Radio Scope functionality
+	        state to either enable/disable. 
+	Type:	Configuration
+	Access:	Write Only
+	Length: 1
+	
+******************************************************************************/
+typedef struct
+{
+    INFO_ELE_HDR
+	uint8   Enable; /* RadioScope feature will be enabled (1) or disabled(0) */
+    uint8  padding[3];  /* alignment to 32 bits  */
+} ACXRadioScopeEnableStruct;
+
+/******************************************************************************
+
+    Name:	ACX_RS_RX
+	Desc:   This command instructs the WiLink to set the Radio Scope 
+	        parameters to the desired values. 
+	Type:	Configuration
+	Access:	Read/Write 
+	Length: 1
+
+	We have the following available memory area:
+		
+			Information Element ID -		2 bytes
+			Information Element Length -	2 bytes			
+			
+				Now the rest is MAX_CMD_PARAMS
+				but 4 bytes must be subtracted
+				because of the IE in Buffer.
+			
+	
+******************************************************************************/
+typedef struct
+{	    
+	uint16  service;
+	uint16	length;
+	uint8	channel;
+	uint8	band;
+	uint8	status;
+	uint8   padding[1]; /*32 bit padding */
+}RxPacketStruct;
+
+typedef struct 
+{		
+    /*  We have the following available memory area:        */
+    /*                                                      */
+    /*  Information Element ID -        2 bytes             */
+    /*  Information Element Length -    2 bytes             */
+    /*  Number Of Packets in Buffer -    2 bytes            */
+    /*                                                      */
+    /*        Now the rest is MAX_CMD_PARAMS                */
+    /*        but 2 bytes must be subtracted                */
+    /*        because of the Number Of Packets in Buffer.   */
+	RxPacketStruct packet[(MAX_CMD_PARAMS-2)/sizeof(RxPacketStruct)];
+}RxCyclicBufferStruct;
+
+typedef struct
+
+{
+    INFO_ELE_HDR
+    /*uint8   padding[MAX_CMD_PARAMS-4]; */
+	RxCyclicBufferStruct buf;
+} ACXRadioScopeRxParamsStruct;
+
+#endif /* RADIO_SCOPE */
+/******************************************************************************
+    Name:   ACX_KEEP_ALIVE_MODE
+    Desc:   Set/Get the Keep Alive feature mode.
+    Type:   Configuration
+	Access:	Write
+    Length: 4 - 1 for the mode + 3 for padding.
+
+******************************************************************************/
+
+typedef struct
+{
+INFO_ELE_HDR
+    Bool_e  modeEnabled;
+    uint8 padding [3];
+}AcxKeepAliveMode;
+
+
+/******************************************************************************
+
+    Name:	ACX_SET_KEEP_ALIVE_CONFIG
+    Desc:   Configure a KLV template parameters.
+    Type:   Configuration
+    Access: Write Only
+    Length: 8
+
+******************************************************************************/
+
+typedef enum
+{
+    NO_TX = 0,
+    PERIOD_ONLY
+} KeepAliveTrigger_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 KeepAliveTrigger_e;
+#else
+typedef KeepAliveTrigger_enum KeepAliveTrigger_e;
+#endif
+
+typedef enum
+{
+    KLV_TEMPLATE_INVALID = 0,
+    KLV_TEMPLATE_VALID,
+    KLV_TEMPLATE_PENDING /* this option is FW internal only. host can only configure VALID or INVALID*/
+} KeepAliveTemplateValidation_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 KeepAliveTemplateValidation_e;
+#else
+typedef KeepAliveTemplateValidation_enum KeepAliveTemplateValidation_e;
+#endif
+
+typedef struct
+{
+    INFO_ELE_HDR
+	uint32 period; /*at range 1000-3600000 (msec). (To allow better range for debugging)*/
+    uint8 index;
+    KeepAliveTemplateValidation_e   valid;
+    KeepAliveTrigger_e  trigger;
+    uint8 padding;
+} AcxSetKeepAliveConfig_t;
+
+/*
+ * BA sessen interface structure
+ */
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8 aMacAddress[6];           /* Mac address of: SA as receiver / RA as initiator */
+    uint8 uTid;                     /* TID */
+    uint8 uPolicy;                  /* Enable / Disable */
+    uint16 uWinSize;                /* windows size in num of packet */
+    uint16 uInactivityTimeout;      /* as initiator inactivity timeout in time units(TU) of 1024us / 
+                                       as receiver reserved */
+} TAxcBaSessionInitiatorResponderPolicy;
+
+/******************************************************************************
+
+    Name:	ACX_PEER_HT_CAP
+	Desc:   Configure HT capabilities - declare the capabilities of the peer 
+            we are connected to.
+	Type:	Configuration
+	Access:	Write Only
+    Length: 
+
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 uHtCapabilites;      /* 
+                                 * bit 0 – Allow HT Operation
+                                 * bit 1 - Allow Greenfield format in TX
+                                 * bit 2 – Allow Short GI in TX 
+                                 * bit 3 – Allow L-SIG TXOP Protection in TX
+                                 * bit 4 – Allow HT Control fields in TX. 
+                                 *         Note, driver will still leave space for HT control in packets regardless 
+                                 *         of the value of this field. FW will be responsible to drop the HT field 
+                                 *         from any frame when this Bit is set to 0.
+                                 * bit 5 - Allow RD initiation in TXOP. FW is allowed to initate RD. Exact policy 
+                                 *         setting for this feature is TBD.
+                                 *         Note, this bit can only be set to 1 if bit 3 is set to 1.
+                                 */
+
+     uint8  aMacAddress[6];     /*
+                                 * Indicates to which peer these capabilities are relevant.
+                                 * Note, currently this value will be set to FFFFFFFFFFFF to indicate it is 
+                                 * relevant for all peers since we only support HT in infrastructure mode. 
+                                 * Later on this field will be relevant to IBSS/DLS operation
+                                 */
+
+     uint8  uAmpduMaxLength;    /* 
+                                 * This the maximum a-mpdu length supported by the AP. The FW may not 
+                                 * exceed this length when sending A-MPDUs
+                                 */
+
+     uint8  uAmpduMinSpacing;   /* This is the minimal spacing required when sending A-MPDUs to the AP. */
+     
+} TAxcHtCapabilitiesIeFwInterface;
+
+/* EHtCapabilitesFwBitMask mapping */
+typedef enum
+{
+    FW_CAP_BIT_MASK_HT_OPERATION                      =  BIT_0,
+    FW_CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT           =  BIT_1,
+    FW_CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS        =  BIT_2,
+    FW_CAP_BIT_MASK_LSIG_TXOP_PROTECTION              =  BIT_3,
+    FW_CAP_BIT_MASK_HT_CONTROL_FIELDS                 =  BIT_4,
+    FW_CAP_BIT_MASK_RD_INITIATION                     =  BIT_5
+} EHtCapabilitesFwBitMask;
+
+
+/******************************************************************************
+
+    Name:	ACX_HT_BSS_OPERATION
+	Desc:   Configure HT capabilities - AP rules for behavior in the BSS.
+	Type:	Configuration
+	Access:	Write Only
+    Length: 
+
+******************************************************************************/
+
+typedef struct
+{
+    INFO_ELE_HDR
+    uint8 uRifsMode;            /* Values: 0 – RIFS not allowed, 1 – RIFS allowed */
+    uint8 uHtProtection;        /* Values: 0 – 3 like in spec */
+    uint8 uGfProtection;        /* Values: 0 - GF protection not required, 1 – GF protection required */
+    uint8 uHtTxBurstLimit;      /* Values: 0 – TX Burst limit not required, 1 – TX Burst Limit required */
+    uint8 uDualCtsProtection;   /* 
+                                 * Values: 0 – Dual CTS protection not required, 1 Dual CTS Protection required
+                                 *             Note: When this value is set to 1 FW will protect all TXOP with RTS 
+                                 *             frame and will not use CTS-to-self regardless of the value of the 
+                                 *             ACX_CTS_PROTECTION information element 
+                                 */
+    uint8 padding[3];
+
+} TAxcHtInformationIeFwInterface;
+
+/******************************************************************************
+ FwStaticData_t - information stored in command mailbox area after the Init 
+                  process is complete
+
+ Note:  This structure is passed to the host via the mailbox at Init-Complete
+        without host request!!
+        The host reads this structure before sending any configuration to the FW.
+******************************************************************************/
+
+typedef struct
+{
+	/* dot11StationIDStruct */
+	uint8 dot11StationID[6]; /* The MAC address for the STA.*/
+    uint8 padding[2];       /* alignment to 32bits boundry   */
+	/* ACXRevision_t */
+	char FWVersion[20];		/* The WiLink firmware version, an ASCII string x.x.x.x.x */
+							/* that uniquely identifies the current firmware. */
+							/* The left most digit is incremented each time a */
+							/* significant change is made to the firmware, such as */
+							/* WLAN new project.*/
+							/* The second and third digit is incremented when major enhancements*/
+							/* are added or major fixes are made.*/
+							/* The fourth digit is incremented for each SP release */
+                            /* and it indicants the costumer private branch */
+							/* The fifth digit is incremented for each build.*/
+		
+    uint32 HardWareVersion; /* This 4 byte field specifies the WiLink hardware version. */
+							/* bits 0  - 15: Reserved.*/
+							/* bits 16 - 23: Version ID - The WiLink version ID  */
+							/*              (1 = first spin, 2 = second spin, and so on).*/
+							/* bits 24 - 31: Chip ID - The WiLink chip ID. */
+        uint8 txPowerTable[NUMBER_OF_SUB_BANDS_E][NUM_OF_POWER_LEVEL]; /* Maximun Dbm in Dbm/10 units */
+} FwStaticData_t;
+
+/******************************************************************************
+
+
+
+    ACX_TX_CONFIG_OPT
+
+ 
+
+******************************************************************************/
+
+typedef struct 
+{
+    INFO_ELE_HDR
+    uint16  txCompleteTimeout;   /* Max time in msec the FW may delay frame Tx-Complete interrupt */
+    uint16  txCompleteThreshold; /* Tx-Complete packets number which requires interrupting the host (0 = no buffering) */
+} ACXTxConfigOptions_t;
+
+
+/******************************************************************************
+
+Name:	ACX_PWR_CONSUMPTION_STATISTICS
+Desc:   Retrieve time statistics of the different power states.
+Type:	Configuration
+Access:	Read Only
+Length: 20 
+
+******************************************************************************/
+
+// Power Statistics
+typedef struct
+{
+    INFO_ELE_HDR
+    uint32 awakeTimeCnt_Low;
+    uint32 awakeTimeCnt_Hi;
+    uint32 powerDownTimeCnt_Low;
+    uint32 powerDownTimeCnt_Hi;
+    uint32 elpTimeCnt_Low;
+    uint32 elpTimeCnt_Hi;
+    uint32 ListenMode11BTimeCnt_Low;
+    uint32 ListenMode11BTimeCnt_Hi;
+    uint32 ListenModeOFDMTimeCnt_Low;
+    uint32 ListenModeOFDMTimeCnt_Hi;
+}ACXPowerConsumptionTimeStat_t;
+
+
+/******************************************************************************
+    Name:   ACX_BURST_MODE
+    Desc:   enable/disable burst mode in case TxOp limit != 0.
+    Type:   Configuration
+    Access:    Write
+    Length: 1 - 2 for the mode + 3 for padding.
+
+******************************************************************************/
+
+typedef struct
+{
+INFO_ELE_HDR
+    Bool_e  enable;
+    uint8 padding [3];
+}AcxBurstMode;
+
+
+/******************************************************************************
+    Name:   ACX_SET_RATE_MAMAGEMENT_PARAMS
+    Desc:   configure one of the configurable parameters in rate management module.
+    Type:   Configuration
+    Access:    Write
+    Length: 8 bytes
+
+******************************************************************************/
+typedef enum
+{
+    RATE_MGMT_RETRY_SCORE_PARAM,
+	RATE_MGMT_PER_ADD_PARAM,
+	RATE_MGMT_PER_TH1_PARAM,
+	RATE_MGMT_PER_TH2_PARAM,
+	RATE_MGMT_MAX_PER_PARAM,
+	RATE_MGMT_INVERSE_CURIOSITY_FACTOR_PARAM,
+	RATE_MGMT_TX_FAIL_LOW_TH_PARAM,
+	RATE_MGMT_TX_FAIL_HIGH_TH_PARAM,
+	RATE_MGMT_PER_ALPHA_SHIFT_PARAM,
+	RATE_MGMT_PER_ADD_SHIFT_PARAM,
+	RATE_MGMT_PER_BETA1_SHIFT_PARAM,
+	RATE_MGMT_PER_BETA2_SHIFT_PARAM,
+	RATE_MGMT_RATE_CHECK_UP_PARAM,
+	RATE_MGMT_RATE_CHECK_DOWN_PARAM,
+	RATE_MGMT_RATE_RETRY_POLICY_PARAM,
+	RATE_MGMT_PER_WEIGHT_SHIFT_PARAM,
+	RATE_MGMT_TP_WEIGHT_SHIFT_PARAM,
+	RATE_MGMT_ALL_PARAMS = 0xff
+} rateAdaptParam_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 rateAdaptParam_e;
+#else
+typedef rateAdaptParam_enum rateAdaptParam_e;
+#endif
+
+#define RATE_MGMT_NUM_OF_UC		(2)
+#define RATE_MGMT_NUM_OF_RATES  (13)
+
+/* OLD STRUCTURE - OBSOLETE but kept for backwards compatibility with M3 compliant hosts */
+typedef struct
+{
+    INFO_ELE_HDR
+	rateAdaptParam_e paramIndex;
+	uint16 RateRetryScore;
+	uint16 PerAdd;
+	uint16 PerTh1;
+	uint16 PerTh2;
+	uint16 MaxPer;
+	uint8 InverseCuriosityFactor;
+	uint8 TxFailLowTh;
+	uint8 TxFailHighTh;
+	uint8 PerAlphaShift;
+	uint8 PerAddShift;
+	uint8 PerBeta1Shift;
+	uint8 PerBeta2Shift;
+	uint8 RateCheckUp;
+	uint8 RateCheckDown;
+	uint8 RateRetryPolicy[RATE_MGMT_NUM_OF_RATES]; 
+}AcxRateMangeParams;
+
+/* NEW STRUCTURE */
+typedef struct
+{
+    INFO_ELE_HDR
+	rateAdaptParam_e paramIndex;
+	uint16 RateRetryScore;
+	uint16 PerAdd;
+	uint16 PerTh1;
+	uint16 PerTh2;
+	uint16 MaxPer;
+	uint8 InverseCuriosityFactor[RATE_MGMT_NUM_OF_UC];
+	uint8 TxFailLowTh;
+	uint8 TxFailHighTh;
+	uint8 PerAlphaShift;
+	uint8 PerAddShift;
+	uint8 PerBeta1Shift;
+	uint8 PerBeta2Shift;
+	uint8 RateCheckUp;
+	uint8 RateCheckDown;
+	uint8 RateRetryPolicy[RATE_MGMT_NUM_OF_RATES]; 
+	uint8 PerWeightShift[RATE_MGMT_NUM_OF_UC];			// 2 weights, 1 per UC
+	uint8 TpWeightShift[RATE_MGMT_NUM_OF_UC];				// 2 weights, 1 per UC
+}AcxRateAdaptParams;
+
+/******************************************************************************
+    Name:   ACX_GET_RATE_MAMAGEMENT_PARAMS
+    Desc:   read the configurable parameters of rate management module.
+    Type:   
+    Access: read
+    Length: 8 bytes
+
+******************************************************************************/
+typedef struct
+{
+    INFO_ELE_HDR
+    int32  SNRCorrectionHighLimit;
+    int32  SNRCorrectionLowLimit;
+    int32  PERErrorTH;
+    int32  attemptEvaluateTH;
+    int32  goodAttemptTH;
+    int32  curveCorrectionStep;
+}AcxRateMangeReadParams;
+
+
+
+/******************************************************************************
+
+    Name:	ACX_SET_SMART_REFLEX_STATE
+    Desc:   Configure smart reflex state (enable/disable).
+    Type:   Configuration
+    Access: Write Only
+    Length: 
+
+******************************************************************************/
+
+typedef struct
+{
+	INFO_ELE_HDR
+    Bool_e  enable;
+    uint8 padding [3];
+}ACXSmartReflexState_t;
+
+
+/******************************************************************************
+
+    Name:	ACX_SET_SMART_REFLEX_DEBUG
+    Desc:   Configure smart reflex mechanism parameters - for debug mode.
+    Type:   Configuration
+    Access: Write Only
+    Length: 
+
+******************************************************************************/
+typedef struct 
+{
+	uint8 len; //maximum length is 14
+	int8 upperLimit;
+	int8 values[14]; //this is the maximum length (in rows) of the error table
+}SmartReflexErrTable_t;
+
+typedef struct
+{
+	INFO_ELE_HDR
+	SmartReflexErrTable_t errorTable; 
+	uint16 senN_P;
+	uint16 senNRN;
+	uint16 senPRN;
+	uint16 senN_P_Gain;
+}ACXSmartReflexDebugParams_t;
+
+
+/******************************************************************************
+
+    Name:	ACX_SET_SMART_REFLEX_PARAMS
+    Desc:   Configure smart reflex mechanism tables - 1 for each FAB.
+			The FW will choose the correct FAB, according to what is burned in the Efuse.
+    Type:   Configuration
+    Access: Write Only
+    Length: 
+
+******************************************************************************/
+
+typedef struct
+{
+	INFO_ELE_HDR
+	SmartReflexErrTable_t errorTable[3]; 
+}ACXSmartReflexConfigParams_t;
+
+/******************************************************************************
+
+    Name:	ACX_SET_DCO_ITRIM_PARAMS    
+    Desc:   Configure DCO Itrim operational parameters:               
+			1. Enable/disable of the entire feature.                                     
+			2. Moderation timeout (usec) - how much time to wait from last TX
+               until DCO Itrim can be set low.
+    Type:   Configuration
+    Access: Write Only
+    Length: 
+
+******************************************************************************/
+
+typedef struct
+{
+	INFO_ELE_HDR
+
+    Bool_e  enable                  ;
+    uint32  moderation_timeout_usec ;
+
+}ACXDCOItrimParams_t ;
+
+
+
+#endif /* PUBLIC_INFOELE_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FirmwareApi/public_radio.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1768 @@
+/*
+ * public_radio.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/**********************************************************************************************************************
+  FILENAME:       public_radio.h
+
+  DESCRIPTION:    Contains information element defines/structures used by the TNETxxxx and host and Radio Module.
+                  This is a PUBLIC header, which customers will use.
+***********************************************************************************************************************/
+/*
+=======================================================================================================================
+                      R E V I S I O N    H I S T O R Y
+
+  04/29/05  BRK  1. retrieved from ClearCase and added this rev. history
+                 2. added two new entries to RadioParamType_e  enum
+                 3. increased MAX_RADIO_PARAM_POWER_TABLE (from 20 to 56)
+                    - this is sort of a kludge, struct RadioParam_t  should have used an
+                      array pointer instead of an actual data block
+  06/10/05  BRK  changed MAX_RADIO_PARAM_POWER_TABLE for 1251 support (sort of a KLUDGE)
+  07/15/05  BRK  added RADIO_PABIAS_TABLE entry to RadioParamType_e  enum
+  04/12/06  MH   Added new run-time calibration state: RFPLL_CALIBRATION_NEEDED
+
+  Note: This code should only be edited with TAB stops set at 4
+=======================================================================================================================
+ */
+#ifndef PUBLIC_RADIO
+#define PUBLIC_RADIO
+
+#include "public_types.h"
+#define MAC_ADDR_SIZE 6
+/* typedef uint8 TMacAddr[MAC_ADDR_SIZE]; */
+/************************************************************************/
+/*																		*/	
+/*							Definitions section                         */
+/*																		*/
+/************************************************************************/
+/* radio parameter to set */
+#ifdef TNETW1251
+#define MAX_RADIO_PARAM_POWER_TABLE  			(4*48)		/* cPowLmtTbl[] max size for ABG radios */
+#else
+#define MAX_RADIO_PARAM_POWER_TABLE  			(56)     	/* cPowLmtTbl[] max size for BG radios*/
+#endif
+#define MAX_RADIO_PARAM_LEN          			(MAX_RADIO_PARAM_POWER_TABLE)
+
+#define RADIO_PARAM_POWER_TABLE_ENABLE        	(0x01)  	/* mask for RADIO_PARAM_POWER_ENABLES usage*/
+#define RADIO_PARAM_POWER_LIMIT_TABLE_ENABLE  	(0x02)  	/* mask for RADIO_PARAM_POWER_ENABLES usage*/
+#define RADIO_PARAM_POWER_ADJ_TABLE_ENABLE    	(0x04)  	/* mask for RADIO_PARAM_POWER_ENABLES usage*/
+
+#define NUM_OF_POWER_LEVEL      				(4)
+
+
+#define TX_TEMPLATE_MAX_BUF_LEN					(512)
+
+#define RX_PLT_LNA_STEPS_BUF_LEN				(4)
+#define RX_PLT_TA_STEPS_BUF_LEN					(4)
+
+#define RX_STAT_PACKETS_PER_MESSAGE           	(20) 
+
+#define MULTIPLE_PACKET_SIZE		1024
+#define MAX_TX_PACKET_SIZE_11_B		(2 * MULTIPLE_PACKET_SIZE)
+#define MAX_TX_PACKET_SIZE_11_G		(4 * MULTIPLE_PACKET_SIZE)
+#define MAX_TX_PACKET_SIZE_11_N		(8 * MULTIPLE_PACKET_SIZE) /* must be PDU */
+
+/* Radio Band */
+typedef enum
+{
+	eELEVEN_A_B,
+	eELEVEN_A_G,
+	eELEVEN_N,
+
+	MAX_MODULATION
+}Modulation;
+
+/************************************************************************/
+/*																		*/	
+/*							Enumerations section                        */
+/*																		*/
+/************************************************************************/
+
+/* Radio band types. */
+typedef enum RADIO_BAND_TYPE_ENMT
+{		
+	FIRST_BAND_TYPE_E,
+/*______________________________________*/
+
+	_2_4_G_BAND_TYPE_E = FIRST_BAND_TYPE_E,
+	_5_G_BAND_TYPE_E,
+/*_______________________________________________*/
+    UNUSED_BAND_TYPE_E,
+	NUMBER_OF_BANDS_E = UNUSED_BAND_TYPE_E,				
+	LAST_BAND_TYPE_E = (NUMBER_OF_BANDS_E - 1)
+
+}RADIO_BAND_TYPE_ENM;
+
+
+#define RADIO_BAND_2_4GHZ_BASE_FREQUENCY					2407
+#define RADIO_BAND_JAPAN_4_9_GHZ_BASE_FREQUENCY				5000
+#define RADIO_BAND_5GHZ_BASE_FREQUENCY						5000
+
+#define RADIO_BAND_2_4GHZ_MULTIPLE_BASE_FREQUENCY			5
+#define RADIO_BAND_JAPAN_4_9_GHZ_MULTIPLE_BASE_FREQUENCY	(-5)
+#define RADIO_BAND_5GHZ_MULTIPLE_BASE_FREQUENCY				5
+
+#define GIGA_HZ_TO_MEGA_HZ									1000
+
+
+
+/* Radio sub-band types. */
+typedef enum RADIO_SUB_BAND_TYPE_ENMT
+{
+	FIRST_SUB_BAND_TYPE_E,
+/*______________________________________*/
+
+	_2_4_G_SUB_BAND_TYPE_E = FIRST_SUB_BAND_TYPE_E, /* band b/g */
+	FIRST_SUB_BANDS_IN_5G_BAND_E,
+	LOW_JAPAN_4_9_G_SUB_BAND_TYPE_E = FIRST_SUB_BANDS_IN_5G_BAND_E,	/* band 4.9Ghz (Japan) low sub-band (J1-J4) */
+	MID_JAPAN_4_9_G_SUB_BAND_TYPE_E,                /* band 4.9Ghz (Japan) mid sub-band(J8,J12,J16) */
+	HIGH_JAPAN_4_9_G_SUB_BAND_TYPE_E,               /* band 4.9Ghz (Japan) high sub-band(J34,36,J38,40, J42, 44, J46,48) */
+	_5_G_FIRST_SUB_BAND_TYPE_E,                     /* band 5GHz 1st sub-band(52->64 in steps of 4) */
+	_5_G_SECOND_SUB_BAND_TYPE_E,                    /* band 5GHz 2nd sub-band(100->116 in steps of 4) */
+	_5_G_THIRD_SUB_BAND_TYPE_E,                     /* band 5GHz 3rd sub-band(120->140 in steps of 4) */
+    _5_G_FOURTH_SUB_BAND_TYPE_E,                    /* band 5GHz 4th sub-band(149->165 in steps of 4) */
+	LAST_SUB_BANDS_IN_5G_BAND_E = _5_G_FOURTH_SUB_BAND_TYPE_E,
+/*_______________________________________________*/
+    UNUSED_SUB_BAND_TYPE_E,
+	NUMBER_OF_SUB_BANDS_E = UNUSED_SUB_BAND_TYPE_E,				
+	LAST_SUB_BAND_TYPE_E = (NUMBER_OF_SUB_BANDS_E - 1)
+
+}RADIO_SUB_BAND_TYPE_ENM;
+
+#define NUMBER_OF_SUB_BANDS_IN_5G_BAND_E	(LAST_SUB_BANDS_IN_5G_BAND_E - FIRST_SUB_BANDS_IN_5G_BAND_E + 1)	
+
+typedef struct
+{
+	uint8					uDbm[NUMBER_OF_SUB_BANDS_E][NUM_OF_POWER_LEVEL]; 
+} TpowerLevelTable_t;
+
+/* Channel number */
+typedef enum RADIO_CHANNEL_NUMBER_ENMT
+{
+	/*---------------------------------*/
+	/* _2_4_G_SUB_BAND_TYPE_E          */
+	/*---------------------------------*/
+	
+	/* index 0 */ RADIO_CHANNEL_INDEX_0_NUMBER_1_E = 1,
+	/* index 1 */ RADIO_CHANNEL_INDEX_1_NUMBER_2_E = 2,	
+	/* index 2 */ RADIO_CHANNEL_INDEX_2_NUMBER_3_E = 3,	
+	/* index 3 */ RADIO_CHANNEL_INDEX_3_NUMBER_4_E = 4,	
+	/* index 4 */ RADIO_CHANNEL_INDEX_4_NUMBER_5_E = 5,	
+	/* index 5 */ RADIO_CHANNEL_INDEX_5_NUMBER_6_E = 6,	
+	/* index 6 */ RADIO_CHANNEL_INDEX_6_NUMBER_7_E = 7,	
+	/* index 7 */ RADIO_CHANNEL_INDEX_7_NUMBER_8_E = 8,	
+	/* index 8 */ RADIO_CHANNEL_INDEX_8_NUMBER_9_E = 9,	
+	/* index 9 */ RADIO_CHANNEL_INDEX_9_NUMBER_10_E = 10,	
+	/* index 10 */ RADIO_CHANNEL_INDEX_10_NUMBER_11_E = 11,	
+	/* index 11 */ RADIO_CHANNEL_INDEX_11_NUMBER_12_E = 12,	
+	/* index 12 */ RADIO_CHANNEL_INDEX_12_NUMBER_13_E = 13,	
+	/* index 13 */ RADIO_CHANNEL_INDEX_13_NUMBER_14_E = 14,	
+	
+	/*---------------------------------*/
+	/* LOW_JAPAN_4_9_G_SUB_BAND_TYPE_E */
+	/*---------------------------------*/
+	/* index 14 */ RADIO_CHANNEL_INDEX_14_NUMBER_J1_E = 16,	
+	/* index 15 */ RADIO_CHANNEL_INDEX_15_NUMBER_J2_E = 12,	
+	/* index 16 */ RADIO_CHANNEL_INDEX_16_NUMBER_J3_E = 8,		
+	/* index 17 */ RADIO_CHANNEL_INDEX_17_NUMBER_J4_E = 4,	
+    
+	/*---------------------------------*/
+	/* MID_JAPAN_4_9_G_SUB_BAND_TYPE_E */
+	/*---------------------------------*/
+	/* index 18 */ RADIO_CHANNEL_INDEX_18_NUMBER_J8_E = 8,
+	/* index 19 */ RADIO_CHANNEL_INDEX_19_NUMBER_J12_E = 12,
+	/* index 20 */ RADIO_CHANNEL_INDEX_20_NUMBER_J16_E = 16,
+
+	/*----------------------------------*/
+	/* HIGH_JAPAN_4_9_G_SUB_BAND_TYPE_E */
+	/*----------------------------------*/
+	/* index 21 */ RADIO_CHANNEL_INDEX_21_NUMBER_J34_E = 34,
+	/* index 22 */ RADIO_CHANNEL_INDEX_22_NUMBER_36_E = 36,
+	/* index 23 */ RADIO_CHANNEL_INDEX_23_NUMBER_J38_E = 38,
+	/* index 24 */ RADIO_CHANNEL_INDEX_24_NUMBER_40_E = 40,
+	/* index 25 */ RADIO_CHANNEL_INDEX_25_NUMBER_J42_E = 42,
+	/* index 26 */ RADIO_CHANNEL_INDEX_26_NUMBER_44_E = 44,
+	/* index 27 */ RADIO_CHANNEL_INDEX_27_NUMBER_J46_E = 46,
+	/* index 28 */ RADIO_CHANNEL_INDEX_28_NUMBER_48_E = 48, 
+
+	/*---------------------------------*/
+	/* _5_G_FIRST_SUB_BAND_TYPE_E      */
+	/*---------------------------------*/
+	/* index 29 */ RADIO_CHANNEL_INDEX_29_NUMBER_52_E = 52,
+	/* index 30 */ RADIO_CHANNEL_INDEX_30_NUMBER_56_E = 56,
+	/* index 31 */ RADIO_CHANNEL_INDEX_31_ENUMBER_60_E = 60,
+	/* index 32 */ RADIO_CHANNEL_INDEX_32_ENUMBER_64_E = 64,
+
+	/*---------------------------------*/
+	/* _5_G_SECOND_SUB_BAND_TYPE_E     */
+	/*---------------------------------*/
+	/* index 33 */ RADIO_CHANNEL_INDEX_33_NUMBER_100_E = 100,
+	/* index 34 */ RADIO_CHANNEL_INDEX_34_NUMBER_104_E = 104,
+	/* index 35 */ RADIO_CHANNEL_INDEX_35_NUMBER_108_E = 108,
+	/* index 36 */ RADIO_CHANNEL_INDEX_36_NUMBER_112_E = 112,
+	/* index 37 */ RADIO_CHANNEL_INDEX_37_NUMBER_116_E = 116,
+
+	/*---------------------------------*/
+	/* _5_G_THIRD_SUB_BAND_TYPE_E      */
+	/*---------------------------------*/
+	/* index 38 */ RADIO_CHANNEL_INDEX_38_NUMBER_120_E = 120,
+	/* index 39 */ RADIO_CHANNEL_INDEX_39_NUMBER_124_E = 124,
+	/* index 40 */ RADIO_CHANNEL_INDEX_40_NUMBER_128_E = 128,
+	/* index 41 */ RADIO_CHANNEL_INDEX_41_NUMBER_132_E = 132,
+	/* index 42 */ RADIO_CHANNEL_INDEX_42_NUMBER_136_E = 136,
+	/* index 43 */ RADIO_CHANNEL_INDEX_43_NUMBER_140_E = 140,
+
+
+	/*---------------------------------*/
+	/* _5_G_FOURTH_SUB_BAND_TYPE_E     */
+	/*---------------------------------*/
+	/* index 44 */ RADIO_CHANNEL_INDEX_44_NUMBER_149_E = 149,
+	/* index 45 */ RADIO_CHANNEL_INDEX_45_NUMBER_153_E = 153,
+	/* index 46 */ RADIO_CHANNEL_INDEX_46_NUMBER_157_E = 157,
+	/* index 47 */ RADIO_CHANNEL_INDEX_47_NUMBER_161_E = 161,
+	/* index 48 */ RADIO_CHANNEL_INDEX_48_NUMBER_165_E = 165
+
+}RADIO_CHANNEL_NUMBER_ENM;
+
+/* Radio channels */
+typedef enum RADIO_CHANNEL_INDEX_ENMT
+{		
+	FIRST_RADIO_CHANNEL_INDEX_E,
+/*______________________________________*/
+
+	/*---------------------------------*/
+	/* _2_4_G_SUB_BAND_TYPE_E          */
+	/*---------------------------------*/
+	FIRST_2_4_G_BAND_RADIO_CHANNEL_INDEX_E = FIRST_RADIO_CHANNEL_INDEX_E,					/* 0 */
+	FIRST_2_4_G_SUB_BAND_RADIO_CHANNEL_INDEX_E = FIRST_2_4_G_BAND_RADIO_CHANNEL_INDEX_E,	/* 0 */
+	
+	/* Channels 0-13 indexes in the FW are 1-14 channels number in the RS */
+	RADIO_CHANNEL_INDEX_0_E = FIRST_2_4_G_SUB_BAND_RADIO_CHANNEL_INDEX_E,/* 0 */
+	RADIO_CHANNEL_INDEX_1_E,	/* 1 */
+	RADIO_CHANNEL_INDEX_2_E,	/* 2 */
+	RADIO_CHANNEL_INDEX_3_E,	/* 3 */
+	RADIO_CHANNEL_INDEX_4_E,	/* 4 */
+	RADIO_CHANNEL_INDEX_5_E,	/* 5 */
+	RADIO_CHANNEL_INDEX_6_E,	/* 6 */
+	RADIO_CHANNEL_INDEX_7_E,	/* 7 */
+	RADIO_CHANNEL_INDEX_8_E,	/* 8 */
+	RADIO_CHANNEL_INDEX_9_E,	/* 9 */
+	RADIO_CHANNEL_INDEX_10_E,	/* 10 */
+	RADIO_CHANNEL_INDEX_11_E,	/* 11 */
+	RADIO_CHANNEL_INDEX_12_E,	/* 12 */
+	RADIO_CHANNEL_INDEX_13_E,	/* 13 */	
+	LAST_2_4_G_SUB_BAND_RADIO_CHANNEL_INDEX_E = RADIO_CHANNEL_INDEX_13_E,				/* 13 */
+    LAST_2_4_G_BAND_RADIO_CHANNEL_INDEX_E = LAST_2_4_G_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 13 */
+	NUMBER_OF_2_4_G_CHANNEL_INDICES_E = LAST_2_4_G_BAND_RADIO_CHANNEL_INDEX_E,			/* 13 */
+
+	/*---------------------------------*/
+	/* LOW_JAPAN_4_9_G_SUB_BAND_TYPE_E */
+	/*---------------------------------*/
+	FIRST_5_G_BAND_RADIO_CHANNEL_INDEX_E,	/* 14 */
+	FIRST_LOW_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E = FIRST_5_G_BAND_RADIO_CHANNEL_INDEX_E,	/* 14 */
+
+	/* Channels 14-17 indexes in the FW are J1-J4 channels number in the RS */
+	RADIO_CHANNEL_INDEX_14_E = FIRST_LOW_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E,				/* 14 */
+	RADIO_CHANNEL_INDEX_15_E,	/* 15 */
+	RADIO_CHANNEL_INDEX_16_E,	/* 16 */
+	RADIO_CHANNEL_INDEX_17_E,	/* 17 */
+    LAST_LOW_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E = RADIO_CHANNEL_INDEX_17_E,	/* 17 */
+	
+	/*---------------------------------*/
+	/* MID_JAPAN_4_9_G_SUB_BAND_TYPE_E */
+	/*---------------------------------*/
+	FIRST_MID_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 18 */
+
+	/* Channel 18 index in the FW is channel number J8 in the RS */
+    RADIO_CHANNEL_INDEX_18_E = FIRST_MID_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 18 */ 
+
+	/* Channel 19 index in the FW is channel number J12 in the RS */
+	RADIO_CHANNEL_INDEX_19_E,	/* 19 */
+	
+	/* Channel 20 index in the FW is channel number J16 in the RS */
+	RADIO_CHANNEL_INDEX_20_E,	/* 20 */
+    LAST_MID_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E = RADIO_CHANNEL_INDEX_20_E,		/* 20 */
+    
+	/*----------------------------------*/
+	/* HIGH_JAPAN_4_9_G_SUB_BAND_TYPE_E */
+	/*----------------------------------*/
+	FIRST_HIGH_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 21 */
+
+	/* Channel 21 index in the FW is channel number J34 in the RS */
+    RADIO_CHANNEL_INDEX_21_E = FIRST_HIGH_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E, /* 21 */
+
+	/* Channel 22 index in the FW is channel number 36 in the RS */
+	RADIO_CHANNEL_INDEX_22_E,	/* 22 */
+
+	/* Channel 23 index in the FW is channel number J38 in the RS */
+	RADIO_CHANNEL_INDEX_23_E,	/* 23 */
+
+	/* Channel 24 index in the FW is channel number 40 in the RS */
+	RADIO_CHANNEL_INDEX_24_E,	/* 24 */
+
+	/* Channel 25 index in the FW is channel number J42 in the RS */
+	RADIO_CHANNEL_INDEX_25_E,	/* 25 */
+
+	/* Channel 26 index in the FW is channel number 44 in the RS */
+	RADIO_CHANNEL_INDEX_26_E,	/* 26 */
+
+	/* Channel 27 index in the FW is channel number J46 in the RS */
+	RADIO_CHANNEL_INDEX_27_E,	/* 27 */
+
+	/* Channel 28 index in the FW is channel number 48 in the RS */
+	RADIO_CHANNEL_INDEX_28_E,	/* 28 */
+    LAST_HIGH_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E = RADIO_CHANNEL_INDEX_28_E, /* 28 */
+    LAST_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E = LAST_HIGH_JAPAN_4_9_G_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 28 */
+	/*---------------------------------*/
+	/* _5_G_FIRST_SUB_BAND_TYPE_E      */
+	/*---------------------------------*/
+	FIRST_5_G_FIRST_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 29 */
+
+	/* Channel 29 index in the FW is channel number 52 in the RS */
+	RADIO_CHANNEL_INDEX_29_E = FIRST_5_G_FIRST_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 29 */
+
+	/* Channel 30 index in the FW is channel number 56 in the RS */
+	RADIO_CHANNEL_INDEX_30_E,	/* 30 */
+
+	/* Channel 31 index in the FW is channel number 60 in the RS */
+	RADIO_CHANNEL_INDEX_31_E,	/* 31 */
+
+	/* Channel 32 index in the FW is channel number 64 in the RS */
+	RADIO_CHANNEL_INDEX_32_E,	/* 32 */
+	LAST_5_G_FIRST_SUB_BAND_RADIO_CHANNEL_INDEX_E = RADIO_CHANNEL_INDEX_32_E,	/* 32 */
+	
+	/*---------------------------------*/
+	/* _5_G_SECOND_SUB_BAND_TYPE_E     */
+	/*---------------------------------*/
+	FIRST_5_G_SECOND_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 33 */
+
+	/* Channel 33 index in the FW is channel number 100 in the RS */
+	RADIO_CHANNEL_INDEX_33_E = FIRST_5_G_SECOND_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 33 */
+
+	/* Channel 34 index in the FW is channel number 104 in the RS */
+	RADIO_CHANNEL_INDEX_34_E,	/* 34 */
+
+	/* Channel 35 index in the FW is channel number 108 in the RS */
+	RADIO_CHANNEL_INDEX_35_E,	/* 35 */
+
+	/* Channel 36 index in the FW is channel number 112 in the RS */
+	RADIO_CHANNEL_INDEX_36_E,	/* 36 */
+
+	/* Channel 37 index in the FW is channel number 116 in the RS */
+	RADIO_CHANNEL_INDEX_37_E,	/* 37 */
+	LAST_5_G_SECOND_SUB_BAND_RADIO_CHANNEL_INDEX_E = RADIO_CHANNEL_INDEX_37_E,	/* 37 */
+	
+	/*---------------------------------*/
+	/* _5_G_THIRD_SUB_BAND_TYPE_E      */
+	/*---------------------------------*/
+	FIRST_5_G_THIRD_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 38 */
+
+	/* Channel 38 index in the FW is channel number 120 in the RS */
+	RADIO_CHANNEL_INDEX_38_E = FIRST_5_G_THIRD_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 38 */
+
+	/* Channel 39 index in the FW is channel number 124 in the RS */
+	RADIO_CHANNEL_INDEX_39_E,	/* 39 */
+
+	/* Channel 40 index in the FW in the FW is channel number 128 in the RS */
+	RADIO_CHANNEL_INDEX_40_E,	/* 40 */
+
+	/* Channel 41 index in the FW is channel number 132 in the RS */
+	RADIO_CHANNEL_INDEX_41_E,	/* 41 */
+
+	/* Channel 42 index in the FW is channel number 136 in the RS */
+	RADIO_CHANNEL_INDEX_42_E,	/* 42 */
+
+	/* Channel 43 index in the FW is channel number 140 in the RS */
+	RADIO_CHANNEL_INDEX_43_E,	/* 43 */
+	LAST_5_G_THIRD_SUB_BAND_RADIO_CHANNEL_INDEX_E = RADIO_CHANNEL_INDEX_43_E,	/* 43 */
+	
+	/*---------------------------------*/
+	/* _5_G_FOURTH_SUB_BAND_TYPE_E     */
+	/*---------------------------------*/
+	FIRST_5_G_FOURTH_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 44 */
+
+	/* Channel 44 index in the FW is channel number 149 in the RS */
+    RADIO_CHANNEL_INDEX_44_E = FIRST_5_G_FOURTH_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 44 */
+
+	/* Channel 45 index in the FW is channel number 153 in the RS */
+	RADIO_CHANNEL_INDEX_45_E,	/* 45 */
+
+	/* Channel 46 index in the FW is channel number 157 in the RS */
+	RADIO_CHANNEL_INDEX_46_E,	/* 46 */
+
+	/* Channel 47 index in the FW is channel number 161 in the RS */
+	RADIO_CHANNEL_INDEX_47_E,	/* 47 */
+
+	/* Channel 48 index in the FW is channel number 165 in the RS */
+	RADIO_CHANNEL_INDEX_48_E,	/* 48 */
+	LAST_5_G_FOURTH_SUB_BAND_RADIO_CHANNEL_INDEX_E = RADIO_CHANNEL_INDEX_48_E,	/* 48 */
+	LAST_5_G_BAND_RADIO_CHANNEL_INDEX_E = LAST_5_G_FOURTH_SUB_BAND_RADIO_CHANNEL_INDEX_E,	/* 48 */	
+/*_______________________________________________*/
+
+    UNUSED_RADIO_CHANNEL_INDEX_E,               /* 49 */
+	NUMBER_OF_RADIO_CHANNEL_INDEXS_E = UNUSED_RADIO_CHANNEL_INDEX_E,	/* 49 */
+	LAST_RADIO_CHANNEL_INDEX_E = (NUMBER_OF_RADIO_CHANNEL_INDEXS_E - 1)	/* 48 */
+
+}RADIO_CHANNEL_INDEX_ENM;
+
+#define NUMBER_OF_2_4_G_CHANNELS    (NUMBER_OF_2_4_G_CHANNEL_INDICES_E + 1)
+#define NUMBER_OF_5G_CHANNELS       (NUMBER_OF_RADIO_CHANNEL_INDEXS_E - NUMBER_OF_2_4_G_CHANNELS)
+
+typedef enum RADIO_RATE_GROUPS_ENMT
+{		
+	FIRST_RATE_GROUP_E,
+/*______________________________________*/
+
+	MCS7_RATE_GROUP_E = FIRST_RATE_GROUP_E,
+	_54_48_RATE_GROUP_E,                /* band 4.9Ghz (Japan) low sub-band (J1-J4) */
+	_36_24_RATE_GROUP_E,                /* band 4.9Ghz (Japan) mid sub-band(J8,J12,J16) */
+	_18_12_RATE_GROUP_E,                /* band 4.9Ghz (Japan) high sub-band(J34,36,J38,40, J42, 44, J46,48) */
+	_9_6_RATE_GROUP_E,                  /* band 5GHz 1st sub-band(52->64 in steps of 4) */
+	_11b_RATE_GROUP_E,                  /* band 5GHz 2nd sub-band(100->116 in steps of 4) */
+/*_______________________________________________*/
+    UNUSED_RATE_GROUPS_E,
+	NUMBER_OF_RATE_GROUPS_E = UNUSED_RATE_GROUPS_E,				
+	LAST_RATE_GROUP_E = (NUMBER_OF_RATE_GROUPS_E - 1)
+
+}RADIO_RATE_GROUPS_ENM;
+
+
+typedef enum
+{
+    RADIO_BAND_2_4_GHZ                  = 0,
+    RADIO_BAND_5_0_GHZ                  = 1,
+    RADIO_BAND_DUAL                     = 2,
+    RADIO_BAND_NUM_OF_BANDS             = 2
+
+} ERadioBand;
+
+
+/******************************************************************************
+ TTestCmdRunCalibration - Calibration manager message
+                  
+ Note:  
+******************************************************************************/
+
+typedef enum CALIBRATION_COMMANDS_ENMT
+{
+	/* RX */
+	CM_space1_e,
+	CM_RX_IQ_MM_calibration_e,
+	CM_RX_IQ_MM_correction_upon_channel_change_e,
+	CM_RX_IQ_MM_correction_upon_temperature_change_e,
+	CM_RX_IQ_MM_duplicate_VGA_e,
+	CM_space2_e,
+
+	CM_RX_analog_DC_Correction_calibration_e,
+	CM_RX_DC_AUX_cal_mode_e,
+	CM_RX_DC_AUX_normal_mode_e,
+	CM_space3_e,
+
+	CM_RX_BIP_enter_mode_e,
+	CM_RX_BIP_perform_e,
+	CM_RX_BIP_exit_mode_e,
+	CM_space4_e,
+
+	/* TX */
+	CM_TX_power_detector_calibration_e,
+	CM_TX_power_detector_buffer_calibration_e,
+	CM_space5_e,
+
+	CM_TX_LO_Leakage_calibration_e,
+	CM_TX_PPA_Steps_calibration_e,
+	CM_TX_CLPC_calibration_e,
+	CM_TX_IQ_MM_calibration_e,
+	CM_TX_BIP_calibration_e,
+    /* DRPw */
+	CM_RX_TANK_TUNE_calibration_e,
+/*    CM_PD_BUFF_TUNE_calibration_e,*/
+        CM_RX_DAC_TUNE_calibration_e,
+        CM_RX_IQMM_TUNE_calibration_e,
+        CM_RX_LPF_TUNE_calibration_e,
+        CM_TX_LPF_TUNE_calibration_e,
+        CM_TA_TUNE_calibration_e,
+        CM_TX_MIXERFREQ_calibration_e,
+        CM_RX_IF2GAIN_calibration_e,
+    CM_RTRIM_calibration_e,
+    CM_RX_LNAGAIN_calibration_e,
+
+	CM_SMART_REFLEX_calibration_e,
+	CM_CHANNEL_RESPONSE_calibration_e
+
+}CALIBRATION_COMMANDS_ENM;
+
+
+typedef enum CALIBRATIONS_ENMT
+{
+	FIRST_CALIBRATION_TYPE_E,
+/*----------------------------------------------------------*/
+	/**** GENERAL ****/
+	DRPW_RFCALIBFXN_RXTXLPF_TYPE_E = FIRST_CALIBRATION_TYPE_E,
+	DRPW_TUNE_TYPE_E,	/* TUNE will perform DCO_freq, AB/TB, KDCO, TDC_inverter */
+	DRPW_RFCALIBFXN_RTRIM_TYPE_E,
+	/**** TX ****/
+	CM_TX_LO_LEAKAGE_CALIBRATION_TYPE_E,
+	DRPW_RFCALIBFXN_TXMIXERFREQ_TYPE_E,
+    CM_TX_IQ_MM_CALIBRATION_TYPE_E,
+	/**** RX ****/
+	DRPW_RFCALIBFXN_TA_TYPE_E,
+	DRPW_RFCALIBFXN_RXLNAGAIN_TYPE_E,
+	DRPW_RFCALIBFXN_RXIF2GAIN_TYPE_E,
+	DRPW_RFCALIBFXN_RXDAC_TYPE_E,
+	DRPW_RFCALIBFXN_LNATANK_TYPE_E,
+	RX_ANALOG_DC_CORRECTION_CALIBRATION_TYPE_E,
+	CM_RX_IQ_MM_CORRECTION_CALIBRATION_TYPE_E,
+    SMART_REFLEX_CALIBRATION_TYPE_E,
+	/* ... */
+/*----------------------------------------------------------*/
+	NUMBER_OF_CALIBRATIONS_E,
+	LAST_CALIBRATION_TYPE_E = (NUMBER_OF_CALIBRATIONS_E - 1)
+} CALIBRATIONS_ENMT;
+
+/******************************************************************************
+
+    Name:	ACX_CAL_ASSESSMENT
+	Type:	Configuration
+	Access:	Write Only
+	Length: 4
+	Note:	OBSOLETE !!! (DO_CALIBRATION_IN_DRIVER is not defined)
+	
+******************************************************************************/
+typedef enum
+{
+    RUNTIME_CALIBRATION_NOT_NEEDED = 1,
+    RUNTIME_CALIBRATION_NEEDED = 2,
+    RFPLL_CALIBRATION_NEEDED = 3,
+    MAX_RUNTIME_CALIBRATION_OPTIONS = 0x7FFFFFFF /* force this enum to be uint32 */
+} RadioRuntimeCalState_enum;
+
+
+#ifdef HOST_COMPILE
+typedef uint32 RadioRuntimeCalState_e;
+#else
+typedef RadioRuntimeCalState_enum RadioRuntimeCalState_e;
+#endif
+
+/************************************************************************/
+/*																		*/	
+/*							Commands section                            */
+/*																		*/
+/************************************************************************/
+typedef struct PltGainGet_t
+{
+            uint8 TxGain;            /*Total TX chain gain according to the current setting*/
+            uint8 TxUpperBound;      /*the max gain setting allowed*/
+            uint8 TxLowerBound;      /*the min gain setting allowed*/
+            uint8 padding;           /* padding to 32 bit */
+}PltGainGet_t;
+
+typedef struct 
+{
+    uint8 refTxPower;
+    uint8 band;
+    uint8 channel;
+    uint8 padding;
+}RadioPltTxCalibrationRequest_t;
+
+
+/******************************************************************************
+
+Name:	PowerLevelTable_t
+Desc:   Retrieve Maximum Dbm per power level and sub-band.
+Type:	Configuration
+Access:	Read Only
+Length: 20 
+
+******************************************************************************/
+typedef struct
+{
+	uint8 txPowerTable[NUMBER_OF_SUB_BANDS_E][NUM_OF_POWER_LEVEL]; /* Maximun Dbm in Dbm/10 units */
+} PowerLevelTable_t;
+
+/* DORONS [4/27/2008] testing the 2nd auxiliary function */
+typedef struct
+{
+    int8 desiredTone;
+    int8 desiredGain;
+    uint8 mode;
+    uint8 padding;
+} TestToneParams_t;
+
+typedef enum
+{
+	ePM_AWAKE,
+	ePM_LISTEN_ENTER,
+	ePM_LISTEN_EXIT,
+	ePM_POWER_DOWN_ENTER,
+	ePM_POWER_DOWN_EXIT,
+	ePM_ELP_ENTER,
+	ePM_ELP_EXIT,
+	ePM_CORTEX_GATE_ENTER,
+	ePM_CORTEX_GATE_EXIT
+}PowerMode;
+
+typedef struct 
+
+{
+	uint8	iPowerMode;		/* Awake					- 0 */
+							/* Enter Listen Mode		- 1 */
+							/* Exit Listen Mode			- 2 */
+							/* Enter Power Down Mode	- 3 */
+							/* Exit Power Down Mode		- 4 */
+							/* ELP Mode					- 5 */							
+							/* Enter Cortex Gate Mode	- 6 */
+							/* Exit Cortex Gate Mode	- 7 */
+	uint8	  padding[3];
+}TTestCmdPowerMode;
+
+/************************************************************************
+                PLT  DBS
+				To modify these DBs Latter - according to Architecture Document, 
+				and move it to public_commands.h
+************************************************************************/
+
+/******************************************************************************
+
+      ID:     CMD_TEST
+    Desc:   The TEST command can be issued immediately after the firmware has 
+          been downloaded, with no further configuration of the WiLink required.
+          Full initialization of the WiLink is not required to invoke the TEST 
+          command and perform the radio test function.
+          After testing, the system must be reset.
+          Test parameters can be modified while a test is executing. 
+          For instance, the host program can change the channel without resetting
+          the system.
+    
+      Params:     TestCmdID_enum - see below.
+          The returned values are copied to the cmd/sts MB replacing  the command
+          (similar to the interrogate mechanism).
+
+******************************************************************************/
+/* Efil -	when adding parameter here fill the switch case sentence in function
+			"cmdBld_CmdIeTest" in module "TWD\Ctrl\CmdBldCmdIE.c" */
+typedef enum
+{	
+/*	0x01	*/  TEST_CMD_PD_BUFFER_CAL = 0x1,	/* TX PLT */
+/*	0x02	*/  TEST_CMD_P2G_CAL,				/* TX BiP */
+/*	0x03	*/  TEST_CMD_RX_PLT_ENTER,
+/*	0x04	*/  TEST_CMD_RX_PLT_CAL,			/* RSSI Cal */
+/*	0x05	*/  TEST_CMD_RX_PLT_EXIT,
+/*	0x06	*/  TEST_CMD_RX_PLT_GET,
+/*	0x07	*/  TEST_CMD_FCC,					/* Continuous TX */ 
+/*	0x08	*/  TEST_CMD_TELEC,					/* Carrier wave in a specific channel and band */
+/*	0x09	*/  TEST_CMD_STOP_TX,				/* Stop FCC or TELEC */
+/*	0x0A	*/  TEST_CMD_PLT_TEMPLATE,			/* define Template for TX */
+/*	0x0B	*/  TEST_CMD_PLT_GAIN_ADJUST,
+/*	0x0C	*/  TEST_CMD_PLT_GAIN_GET,
+/*	0x0D	*/	TEST_CMD_CHANNEL_TUNE,
+/*	0x0E	*/	TEST_CMD_FREE_RUN_RSSI,         /* Free running RSSI measurement */
+/*	0x0F	*/  TEST_CMD_DEBUG,					/* test command for debug using the struct: */
+/*	0x10	*/  TEST_CMD_CLPC_COMMANDS,
+/*	0x11	*/  RESERVED_4,
+/*	0x12	*/  TEST_CMD_RX_STAT_STOP,
+/*	0x13	*/  TEST_CMD_RX_STAT_START,
+/*	0x14	*/  TEST_CMD_RX_STAT_RESET,
+/*	0x15	*/  TEST_CMD_RX_STAT_GET,
+/*	0x16	*/	TEST_CMD_LOOPBACK_START,		/* for FW Test Debug */
+/*	0x17	*/  TEST_CMD_LOOPBACK_STOP,			/* for FW Test Debug */
+/*	0x18	*/	TEST_CMD_GET_FW_VERSIONS,
+/*  0x19    */  TEST_CMD_INI_FILE_RADIO_PARAM,
+/*  0x1A	*/  TEST_CMD_RUN_CALIBRATION_TYPE,
+/*  0x1B    */	TEST_CMD_TX_GAIN_ADJUST,
+/*	0x1C	*/	TEST_CMD_UPDATE_PD_BUFFER_ERRORS,
+/*	0x1D	*/	TEST_CMD_UPDATE_PD_REFERENCE_POINT,
+/*  0x1E    */	TEST_CMD_INI_FILE_GENERAL_PARAM,
+/*	0x1F	*/	TEST_CMD_SET_EFUSE,
+/*	0x20	*/	TEST_CMD_GET_EFUSE, 
+/* DORONS [4/27/2008] testing the 2nd auxiliary function */
+/*0x21 */   TEST_CMD_TEST_TONE,
+/*	0x22	*/	TEST_CMD_POWER_MODE,
+/*	0x23	*/	TEST_CMD_SMART_REFLEX,
+/*	0x24	*/	TEST_CMD_CHANNEL_RESPONSE,
+/*	0x25	*/	TEST_CMD_DCO_ITRIM_FEATURE,
+
+    MAX_TEST_CMD_ID = 0xFF	/* Dummy - must be last!!! (make sure that Enum variables are type of int) */
+
+} TestCmdID_enum;
+
+/************************************************************************/
+/* radio test result information struct									*/
+/************************************************************************/	
+#define DEFAULT_MULTIPLE_ACTIVATION_TIME		5
+
+#define MULTIPLE_ACTIVATION_TIME				1000000		
+
+#define DEFAULT_RSMODE_CALIBRATION_INTERVAL		(DEFAULT_MULTIPLE_ACTIVATION_TIME * MULTIPLE_ACTIVATION_TIME)	/* RadioScope calibration interval - 5 sec */
+
+typedef enum
+{
+	eCMD_GET_CALIBRAIONS_INFO,
+	eCMD_GET_CLPC_VBAT_TEMPERATURE_INFO
+}TTestCmdDeubug_enum;
+
+/* struct of calibration status, indication if RM performed calibration */
+typedef struct  
+{
+	uint8		operateCalibration;									/* RM performed calibration */
+	int8		calibrationsResult[NUMBER_OF_CALIBRATIONS_E];		/* Calibrations status	*/
+}CalibrationInfo;
+
+/* struct of CLPC output, temperature, battery voltage */
+typedef struct  
+{
+	int					ClpcOffset[NUMBER_OF_RATE_GROUPS_E];		 /* CLPC */
+	int8				CurrentTemperature;							 /* current temperature in Celsius */
+	uint16				CurrentVbat;								 /* VBat	*/
+	uint8				enableCalibration;							 /* enableCalibration */
+	
+}CLPCTempratureVbatStruct;
+
+typedef struct  
+{
+	int16			oRadioStatus;
+	uint8			iCommand; /* command to check */
+	
+	CalibrationInfo				oCalibInfo;			/* for eCMD_GET_CALIBRAIONS_INFO */
+	CLPCTempratureVbatStruct	oCLPCTempVbatInfo;	/* for eCMD_GET_CLPC_VBAT_TEMPERATURE_INFO */
+
+	uint8			padding[3];
+	
+}TTestCmdDebug;
+
+/************************************************************************/
+/* end radio test result information struct								*/
+/************************************************************************/	
+
+
+#ifdef HOST_COMPILE
+typedef uint8 TestCmdID_e;
+#else
+typedef TestCmdID_enum TestCmdID_e;
+#endif
+
+/******************************************************************************/
+typedef enum
+{
+    TEST_MODE_HOST_ORIGINATED_DATA      = 0x00,
+    TEST_MODE_FIXED_SEQ_NUMBER          = 0x00,
+    TEST_MODE_FW_ORIGINATED_DATA     	= 0x01,
+    TEST_MODE_RANDOM_DATA               = 0x05,
+    TEST_MODE_ZOZO_DATA                 = 0x09,
+    TEST_MODE_FILLING_PATERN_MASK       = 0x0F,
+    TEST_MODE_DELAY_REQUIRED            = 0x10,
+    TEST_MODE_DISABLE_SRCRAMBLING_FLAG  = 0x20
+}TestModeCtrlTypes_e;
+
+#ifdef HOST_COMPILE
+typedef uint8 FccTestType_e;
+#else
+typedef TestModeCtrlTypes_e FccTestType_e;
+#endif
+
+/******************************************************************************/
+#define     TEST_SEQ_NUM_MODE_FIXED             (0)
+#define     TEST_SEQ_NUM_MODE_INCREMENTED       (1)
+
+/******************************************************************************/
+/* DORONS [4/23/2008] RX Tone activation for DRPw cals */
+#define     ACTIVE_TONE_CAL_MODE                (0)
+#define     ACTIVE_TONE_NORM_MODE               (1)
+/******************************************************************************
+
+  TestCmdId :   TEST_CMD_FCC - Tx continuous test
+
+  Description:  Continuous transmit series of numbers with a valid MAC header
+                as was received from driver.
+                However there is no 802.11 air access compliance. 
+
+  Params:       PERTxCfg_t fcc - see below.
+
+******************************************************************************/
+#define NUM_OF_MAC_ADDR_ELEMENTS 6
+typedef struct PERTxCfg_t
+{
+            /*input parameters*/
+            uint32 numFrames;       				/* number of frams to transmit, 0 = endless*/
+            uint32 interFrameGap;   				/* time gap in uSec */          
+            uint32 seqNumMode;      				/* Fixed / Incremented */
+            uint32 frameBodySize;    				/* length of Mac Payload */       
+            uint8 channel;          				/*channel number*/
+            uint8 dataRate;         				/* MBps 1,2,11,22,... 54           */
+            uint8 modPreamble;      				/* CTL_PREAMBLE 0x01 */           
+            uint8 band;             				/* {BAND_SELECT_24GHZ 0x00 | BAND_SELECT_5GHZ 0x01} */          
+            uint8 modulation;       				/* {PBCC_MODULATION_MASK |OFDM_MODULATION_MASK }*/      
+            FccTestType_e testModeCtrl;     
+            uint8 dest[NUM_OF_MAC_ADDR_ELEMENTS];  	/* set to hard codded default {0,0,0xde,0xad,0xbe,0xef}; */        
+} PERTxCfg_t;
+
+/******************************************************************************
+
+  TestCmdId :   TEST_CMD_SET_EFUSE, TEST_CMD_GET_EFUSE
+
+  Description:  Get and set the eFuse parameters 
+
+******************************************************************************/
+typedef enum EFUSE_PARAMETER_TYPE_ENMT
+{
+	EFUSE_FIRST_PARAMETER_E,
+/*_______________________________________________*/
+
+	/* RX PARAMETERS */
+    EFUSE_FIRST_RX_PARAMETER_E = EFUSE_FIRST_PARAMETER_E,
+	RX_BIP_MAX_GAIN_ERROR_BAND_B_E = EFUSE_FIRST_RX_PARAMETER_E,		/* MaxGainErrBandB */
+																		
+	RX_BIP_MAX_GAIN_ERROR_J_LOW_MID_E,									/* MaxGainErrJLowMid */
+	RX_BIP_MAX_GAIN_ERROR_J_HIGH_E,										/* MaxGainErrJHigh  */
+																		
+	RX_BIP_MAX_GAIN_ERROR_5G_1ST_E,										/* MaxGainErr5G1st  */
+	RX_BIP_MAX_GAIN_ERROR_5G_2ND_E,										/* MaxGainErr5G2nd  */
+	RX_BIP_MAX_GAIN_ERROR_5G_3RD_E,										/* MaxGainErr5G3rd  */
+	RX_BIP_MAX_GAIN_ERROR_5G_4TH_E,										/* MaxGainErr5G4th  */
+																		
+	RX_BIP_LNA_STEP_CORR_BAND_B_4TO3_E,									/* LnaStepCorrBandB (Step 4To3) */
+	RX_BIP_LNA_STEP_CORR_BAND_B_3TO2_E,									/* LnaStepCorrBandB (Step 3To2) */
+	RX_BIP_LNA_STEP_CORR_BAND_B_2TO1_E,									/* LnaStepCorrBandB (Step 2To1) */
+	RX_BIP_LNA_STEP_CORR_BAND_B_1TO0_E,									/* LnaStepCorrBandB (Step 1To0) */
+																		
+	RX_BIP_LNA_STEP_CORR_BAND_A_4TO3_E,									/* LnaStepCorrBandA (Step 4To3) */
+	RX_BIP_LNA_STEP_CORR_BAND_A_3TO2_E,									/* LnaStepCorrBandA (Step 3To2) */
+	RX_BIP_LNA_STEP_CORR_BAND_A_2TO1_E,									/* LnaStepCorrBandA (Step 2To1) */
+	RX_BIP_LNA_STEP_CORR_BAND_A_1TO0_E,									/* LnaStepCorrBandA (Step 1To0) */
+																		
+	RX_BIP_TA_STEP_CORR_BAND_B_2TO1_E,									/* TaStepCorrBandB (Step 2To1) */
+	RX_BIP_TA_STEP_CORR_BAND_B_1TO0_E,									/* TaStepCorrBandB (Step 1To0) */
+																		
+	RX_BIP_TA_STEP_CORR_BAND_A_2TO1_E,									/* TaStepCorrBandA (Step 2To1) */
+	RX_BIP_TA_STEP_CORR_BAND_A_1TO0_E,									/* TaStepCorrBandA (Step 1To0) */
+																		
+	NUMBER_OF_RX_BIP_EFUSE_PARAMETERS_E,								/* Number of RX parameters */
+
+	/* TX PARAMETERS */
+	TX_BIP_PD_BUFFER_GAIN_ERROR_E = NUMBER_OF_RX_BIP_EFUSE_PARAMETERS_E,/* PD_Buffer_Gain_error */
+	TX_BIP_PD_BUFFER_VBIAS_ERROR_E,										/* PD_Buffer_Vbias_error */
+
+/*_______________________________________________*/
+	EFUSE_NUMBER_OF_PARAMETERS_E,
+    EFUSE_LAST_PARAMETER_E = (EFUSE_NUMBER_OF_PARAMETERS_E - 1)
+
+}EFUSE_PARAMETER_TYPE_ENM;
+
+typedef struct 
+{
+	int8	EfuseParameters[EFUSE_NUMBER_OF_PARAMETERS_E];
+
+	int16	oRadioStatus;
+    int8	padding[3];     /* Align to 32bit */
+
+} EfuseParameters_t;
+
+/******************************************************************************/
+
+/******************************************************************************
+
+  TestCmdId :       TEST_CMD_PLT_GAIN_GET
+
+    Description: Retrieves the TX chain gain settings.         
+
+  Params:           PltGainGet_t       gainGet - see public_radio.h
+
+
+******************************************************************************/
+
+/******************************************************************************
+
+    TestCmdId:  TEST_CMD_PLT_GET_NVS_UPDATE_BUFFER
+    
+    Description: This PLT function provides the all information required by 
+                    the upper driver in order to update the NVS image.
+                    It received a parameter defining the type of update 
+                    information required and provides an array of elements 
+                    defining the data bytes to be written to the NVS image 
+                    and the byte offset in which they should be written.         
+ Params:     PltNvsResultsBuffer_t nvsUpdateBuffer  - see public_radio.h
+    
+
+*****************************************************************************/
+
+
+/******************************************************************************
+
+  TestCmdId :   TEST_CMD_PLT_GAIN_ADJUST
+
+    Description: retrieves the TX chain gain settings.                        
+
+    Params:     int32                txGainAdjust
+
+*****************************************************************************/
+
+/******************************************************************************
+
+  TestCmdId :   TEST_CMD_PLT_RX_CALIBRATION
+
+    Description: Used as part of the  RX calibration procedure, call this 
+            function for every calibration channel. 
+            The response for that function indicates only that command had been received by th FW,
+            and not that the calibration procedure had been finished.
+            The upper layer need to wait amount of ((numOfSamples*intervalBetweenSamplesUsec).
+            To make sure that the RX  calibration  completed. before calling to the next command.
+            
+    Params:     PltRxCalibrationRequest_t    rxCalibration 
+  
+  ******************************************************************************/
+
+typedef struct
+{
+	uint8 iBand;
+	uint8 iChannel;
+	int16 oRadioStatus;
+} TTestCmdChannel;
+
+typedef struct TTestCmdPdBufferCalStruct
+{
+	uint8   iGain;
+	uint8   iVBias; 
+	int16	oAdcCodeword;
+	int16	oRadioStatus;
+	uint8	Padding[2];
+} TTestCmdPdBufferCal;
+
+typedef struct
+{
+	int8	vBIASerror;
+	int8	gainError;
+	uint8	padding[2];
+}TTestCmdPdBufferErrors;
+
+typedef struct 
+{
+	int32     iReferencePointPower;
+	int32     iReferencePointDetectorValue;
+	uint8     isubBand;
+	uint8     padding[3];
+}TTestCmdUpdateReferncePoint;
+
+typedef struct
+{
+	int16 oRadioStatus;
+	uint8 iCalibratonType;
+	uint8 Padding;
+
+} TTestCmdRunCalibration;
+
+typedef struct 
+{
+    uint8   DCOItrimONOff;
+	uint8	padding[3];
+}TTestCmdDCOItrimOnOff;
+
+typedef enum
+{
+	eDISABLE_LIMIT_POWER,
+	eENABLE_LIMIT_POWER
+}UseIniFileLimitPower;
+
+typedef struct 
+{
+	int32	iTxGainValue;
+	int16	oRadioStatus;
+	uint8	iUseinifilelimitPower;
+	uint8	padding;
+} TTxGainAdjust;
+
+/* TXPWR_CFG0__VGA_STEP_GAIN_E */
+typedef enum TXPWR_CFG0__VGA_STEP_ENMT
+{
+	TXPWR_CFG0__VGA_STEP__FIRST_E,					
+/*_______________________________________________*/
+	TXPWR_CFG0__VGA_STEP__MINIMUM_E = TXPWR_CFG0__VGA_STEP__FIRST_E,
+	TXPWR_CFG0__VGA_STEP__0_E = TXPWR_CFG0__VGA_STEP__MINIMUM_E,	
+	TXPWR_CFG0__VGA_STEP__1_E,						
+	TXPWR_CFG0__VGA_STEP__2_E,						
+	TXPWR_CFG0__VGA_STEP__3_E,						
+	TXPWR_CFG0__VGA_STEP__4_E,					
+	TXPWR_CFG0__VGA_STEP__MAXIMUM_E = TXPWR_CFG0__VGA_STEP__4_E,
+/*_______________________________________________*/
+	TXPWR_CFG0__VGA_STEP__NUMBER_OF_STEPS_E,				
+	TXPWR_CFG0__VGA_STEP__LAST_E = (TXPWR_CFG0__VGA_STEP__NUMBER_OF_STEPS_E - 1)
+
+} TXPWR_CFG0__VGA_STEP_ENM;
+
+/******************************************************************************
+
+	Name:	ACX_PLT_NVS_BUFFER_UPDATE 
+	TestCmdId:	TEST_CMD_PLT_GET_NVS_UPDATE_BUFFER
+	Description: This PLT function provides the all information required by 
+					the upper driver in order to update the NVS image.
+					It received a parameter defining the type of update 
+					information required and provides an array of elements defining 
+					the data bytes to be written to the NVS image and the byte 
+					offset in which they should be written.         
+	Type:	PLT
+	Access:	Read Only
+	Length: 420
+
+******************************************************************************/
+
+/* default efuse value */
+#define DEFAULT_EFUSE_VALUE				0
+
+/* Default hard-coded power to gain offsets (these values will be overridden by NVS) */
+#define DB_FACTOR						1000			/* factor because we can't use float */
+
+/* TX BIP default parameters */
+#define CALIBRATION_STEP_SIZE			1000
+#define CALIBRATION_POWER_HIGHER_RANGE	22000
+#define CALIBRATION_POWER_LOWER_RANGE	(-3000)
+
+#define FIRST_PD_CURVE_TO_SET_2_OCTET	(10 * CALIBRATION_STEP_SIZE)/* dBm */
+
+#define SIZE_OF_POWER_DETECTOR_TABLE	((((CALIBRATION_POWER_HIGHER_RANGE) - (CALIBRATION_POWER_LOWER_RANGE))\
+	                                      / (CALIBRATION_STEP_SIZE)) + 1)
+
+/* default PPA steps value */
+#define DEFAULT_PPA_STEP_VALUE			(-6000)
+
+#define P2G_TABLE_TO_NVS				(-1) * 8 / DB_FACTOR
+
+#define DEF_2_4_G_SUB_BAND_P2G_OFFSET           (-25000)
+#define DEF_LOW_JAPAN_4_9_G_SUB_BAND_P2G_OFFSET (-25*DB_FACTOR)
+#define DEF_MID_JAPAN_4_9_G_SUB_BAND_OFFSET     (-25*DB_FACTOR)
+#define DEF_HIGH_JAPAN_4_9_G_SUB_BAND_OFFSET    (-25*DB_FACTOR)
+#define DEF_5_G_FIRST_SUB_BAND_P2G_OFFSET       (-25*DB_FACTOR)
+#define DEF_5_G_SECOND_SUB_BAND_P2G_OFFSET      (-25*DB_FACTOR)
+#define DEF_5_G_THIRD_SUB_BAND_P2G_OFFSET       (-25*DB_FACTOR)
+#define DEF_5_G_FOURTH_SUB_BAND_P2G_OFFSET      (-25*DB_FACTOR)
+
+#define START_TYPE_INDEX_IN_TLV	0
+#define TLV_TYPE_LENGTH			1
+#define START_LENGTH_INDEX		(START_TYPE_INDEX_IN_TLV + TLV_TYPE_LENGTH) /* 1 */
+#define TLV_LENGTH_LENGTH		2
+#define START_PARAM_INDEX		(START_LENGTH_INDEX + TLV_LENGTH_LENGTH) /* 3 */
+
+#define	NVS_VERSION_1			1
+#define	NVS_VERSION_2			2
+
+#define	NVS_MAC_FIRST_LENGTH_INDEX			0
+#define	NVS_MAC_FIRST_LENGHT_VALUE			1
+
+#define NVS_MAC_L_ADDRESS_INDEX				((NVS_MAC_FIRST_LENGTH_INDEX) + 1) /* 1*/
+#define NVS_MAC_L_ADDRESS_LENGTH			2
+
+#define NVS_MAC_L_VALUE_INDEX				((NVS_MAC_L_ADDRESS_INDEX) + (NVS_MAC_L_ADDRESS_LENGTH)) /* 3 */
+#define NVS_MAC_L_VALUE_LENGTH				4
+
+#define	NVS_MAC_SECONDE_LENGTH_INDEX		((NVS_MAC_L_VALUE_INDEX) + 4) /* 7 */
+#define	NVS_MAC_SECONDE_LENGHT_VALUE		1
+
+#define NVS_MAC_H_ADDRESS_INDEX				((NVS_MAC_SECONDE_LENGTH_INDEX) + 1) /* 8*/
+#define NVS_MAC_H_ADDRESS_LENGTH			2
+
+#define NVS_MAC_H_VALUE_INDEX				((NVS_MAC_H_ADDRESS_INDEX) + (NVS_MAC_H_ADDRESS_LENGTH)) /* 10 */
+#define NVS_MAC_H_VALUE_LENGTH				4
+
+#define NVS_END_BURST_TRANSACTION_INDEX		((NVS_MAC_H_VALUE_INDEX) + (NVS_MAC_H_VALUE_LENGTH))	/* 14 */
+#define NVS_END_BURST_TRANSACTION_VALUE		0
+#define NVS_END_BURST_TRANSACTION_LENGTH	7
+
+#define NVS_ALING_TLV_START_ADDRESS_INDEX	((NVS_END_BURST_TRANSACTION_INDEX) + (NVS_END_BURST_TRANSACTION_LENGTH))	/* 21 */
+#define NVS_ALING_TLV_START_ADDRESS_VALUE	0
+#define NVS_ALING_TLV_START_ADDRESS_LENGTH	3
+
+
+/* NVS pre TLV length */
+#define NVS_PRE_PARAMETERS_LENGTH			((NVS_ALING_TLV_START_ADDRESS_INDEX) + (NVS_ALING_TLV_START_ADDRESS_LENGTH)) /* 24 */
+
+/* NVS P2G table */
+#define NVS_TX_P2G_TABLE_LENGTH			((NUMBER_OF_SUB_BANDS_E) * 1 /* byte */) /* 8 */
+
+/* NVS PPA table */
+#define NVS_TX_PPA_STEPS_TABLE_LENGTH	((NUMBER_OF_SUB_BANDS_E) * \
+                                         ((TXPWR_CFG0__VGA_STEP__NUMBER_OF_STEPS_E) \
+                                          - 1) * 1 /* byte */) 	/* 32 */
+
+/* NVS version 1 TX PD curve table length */
+#define NVS_TX_PD_TABLE_LENGTH_NVS_V1	(1 /* byte to set size of table */ + \
+                                         ((NUMBER_OF_SUB_BANDS_E) * (2 /* 1 byte offset, 1 byte low range */ + \
+                                          2 /* first index in table */ + (((SIZE_OF_POWER_DETECTOR_TABLE) - 1) * 1 /* 1 byte */)))) /* 233 */
+
+/* NVS version 2 TX PD curve table length */ 
+#define NVS_TX_PD_TABLE_LENGTH_NVS_V2	((NUMBER_OF_SUB_BANDS_E) * (12 /* 12index of one byte -2 dBm - 9dBm */ +\
+                                        28 /* 14 indexes of 2 byte -3dBm, 10dBm - 22 dBm */)) /* 320 */
+
+/* NVS version 1 TX parameters Length */
+#define	NVS_TX_PARAM_LENGTH_NVS_V1		((NVS_TX_P2G_TABLE_LENGTH) + (NVS_TX_PPA_STEPS_TABLE_LENGTH) +\
+                                         (NVS_TX_PD_TABLE_LENGTH_NVS_V1)) /* 273 */
+
+/* NVS version 2 TX parameters Length */
+#define NVS_TX_PARAM_LENGTH_NVS_V2		((NVS_TX_P2G_TABLE_LENGTH) + (NVS_TX_PPA_STEPS_TABLE_LENGTH) +\
+                                         (NVS_TX_PD_TABLE_LENGTH_NVS_V2) +\
+                                         (NUMBER_OF_RADIO_CHANNEL_INDEXS_E /* for Per Channel power Gain Offset table */)) /* 409 */
+
+/* NVS TX version */
+#define NVS_TX_PARAM_LENGTH				NVS_TX_PARAM_LENGTH_NVS_V2
+
+/* NVS RX version */
+#define	NVS_RX_PARAM_LENGTH				NUMBER_OF_RX_BIP_EFUSE_PARAMETERS_E				/* 19		 */
+
+/* NVS version parameter length */
+#define NVS_VERSION_PARAMETER_LENGTH	3
+
+/* NVS max length */
+#define NVS_TOTAL_LENGTH				500 /* original ((NVS_TOTAL_LENGTH) + 4 - ((NVS_TOTAL_LENGTH) % 4)) */
+
+/* TLV max length */
+#define  MAX_TLV_LENGTH 				NVS_TOTAL_LENGTH  
+
+#define	 MAX_NVS_VERSION_LENGTH			12
+
+/* type to set in the NVS for each mode of work */ 
+typedef enum
+{
+	eNVS_VERSION = 0xaa,
+	eNVS_RADIO_TX_PARAMETERS = 1,
+	eNVS_RADIO_RX_PARAMETERS = 2,
+
+	eNVS_RADIO_INI = 16,
+
+
+	eNVS_NON_FILE = 0xFE,
+
+	/* last TLV type */
+	eTLV_LAST = 0xFF
+}NVSType;
+
+/* type to set parameter type buffers for each mode of work */
+typedef enum
+{
+	eFIRST_RADIO_TYPE_PARAMETERS_INFO,											/* 0 */
+	eNVS_RADIO_TX_TYPE_PARAMETERS_INFO = eFIRST_RADIO_TYPE_PARAMETERS_INFO,		/* 0 */
+	eNVS_RADIO_RX_TYPE_PARAMETERS_INFO,											/* 1 */
+	eLAST_RADIO_TYPE_PARAMETERS_INFO = eNVS_RADIO_RX_TYPE_PARAMETERS_INFO,		/* 1 */
+	UNUSED_RADIO_TYPE_PARAMETERS_INFO,											/* 2 */
+	eNUMBER_RADIO_TYPE_PARAMETERS_INFO = UNUSED_RADIO_TYPE_PARAMETERS_INFO,		/* 2 */
+	LAST_RADIO_TYPE_PARAMETERS_INFO = (eNUMBER_RADIO_TYPE_PARAMETERS_INFO - 1)	/* 1 */
+}NVSTypeInfo;
+
+
+typedef enum
+{
+	eCURRENT_SUB_BAND,
+	eALL_SUB_BANDS	
+}TxBipCurrentAllSubBand;
+
+typedef struct 
+{
+	uint16 	Length;			       	/* TLV length in bytes */
+	uint8 	Buffer[MAX_TLV_LENGTH]; /* TLV buffer content to be burned */
+	uint8 	Type;					/* TLV Type Index */ 
+	uint8   padding;
+}TNvsStruct;
+
+typedef struct
+{
+	uint32		oNVSVersion;
+	TNvsStruct	oNvsStruct; 	/* output (P2G array) */
+	int16		oRadioStatus;
+    uint8             iSubBandMask;             /* 7 sub-band bit mask (asserted bit - calibration required) */
+    uint8             Padding;
+} TTestCmdP2GCal;
+
+typedef struct
+{
+	int16			oRadioStatus;
+	uint16			Pad;
+	uint32			iDelay;			/* between packets (usec) */
+	uint32	     	iRate; 			/* 1MBPS	= 0x00000001,
+										2MBPS   = 0x00000002,
+										5.5MBPS	= 0x00000004,
+										6MBPS   = 0x00000008,
+										9MBPS   = 0x00000010,
+										11MBPS  = 0x00000020,
+										12MBPS  = 0x00000040,
+										18MBPS  = 0x00000080,
+										24MBPS  = 0x00000200,
+										36MBPS  = 0x00000400,
+										48MBPS  = 0x00000800,
+										54MBPS  = 0x00001000,
+										MCS_0  	= 0x00002000,
+										MCS_1  	= 0x00004000,
+										MCS_2  	= 0x00008000,
+										MCS_3  	= 0x00010000,
+										MCS_4  	= 0x00020000,
+										MCS_5  	= 0x00040000,
+										MCS_6  	= 0x00080000,
+										MCS_7  	= 0x00100000 */
+	uint16	     	iSize; 			/* size of packet (bytes) */
+	uint16			iAmount; 		/* in case of multiple (# of packets) */
+	int32			iPower;			/* upper power limit (dBm) */
+	uint16			iSeed;	
+	uint8			iPacketMode; 	/* single, multiple, InfiniteLength, Continuous, FCC */
+	uint8	     	iDcfOnOff; 		/* use DCF access (1) */
+	uint8	     	iGI;			/* Guard Interval: long:800ns (0), short:400ns (1) */
+	uint8	     	iPreamble;		/* long (0), short (1),  OFDM (4), GF (7), Mixed (6) */
+	uint8	     	iType;			/* Data (0), Ack (1), Probe-request(2), Random (3), User-defined (4), PER (5) */
+	uint8	     	iScrambler;		/* Off (0), On (1) */
+	uint8	     	iEnableCLPC; 	/* range 0-100. 0 - disable calibration										/
+									   range 1-99 - enable Cal asses periodic time, every step is 200msecond 
+	                                   periodic of cal assess for example: 1.2 second put the value 6.
+									   if the value is out of range it will be change to 25 represent 
+	                                   5 second of cal assess periodical */	
+	uint8 	     	iSeqNumMode; 	/* Fixed sequence number (0), incremental (1) - used for PER test only */
+	TMacAddr	 	iSrcMacAddr; 	/* Source address (BSSID) - used for PER test only */
+	TMacAddr	    iDstMacAddr; 	/* Destination address - used for PER test only */
+	
+} TPacketParam;
+
+typedef struct
+{
+	int16			 oRadioStatus;
+	uint16			 Pad;
+	int32		     iPower;
+	uint8	    	 iToneType;
+	uint8		     iPpaStep;
+	uint8		     iToneNumberSingleTones;
+	uint8 	    	 iToneNumberTwoTones;
+	uint8		     iUseDigitalDC;
+	uint8 		     iInvert;
+	uint8	    	 iElevenNSpan;
+	uint8		     iDigitalDC;
+	uint8		     iAnalogDCFine;
+	uint8	    	 iAnalogDCCoarse;
+} TToneParam;
+
+typedef  struct 
+{
+	uint16 	bufferOffset;
+	uint16 	bufferLength;
+	int16	oRadioStatus;
+	int8 	buffer[TX_TEMPLATE_MAX_BUF_LEN];
+	uint8	padding[2];
+} TTxTemplate;
+
+typedef enum
+{
+	eDISABLE_CLPC,
+	eENABLE_CLPC,
+	eRESET_CLPC_TABLES,
+	eINIDCATE_CLPC_ACTIVATION_TIME,
+	eENABLE_CALIBRATIAONS,
+	eDISABLE_CALIBRATIAONS
+}CLPCCommands;
+
+typedef struct 
+{
+	int16	oStatus;
+	uint8	iCLPCActivationTime; /* range 0-100. 0 - disable calibration										/
+									range 1-99 - enable Cal asses periodic time, every step is 200msecond 
+	                                periodic of cal assess for example: 1.2 second put the value 6.
+									if the value is out of range it will be change to 25 represent 
+	                                5 second of cal assess periodical */
+	uint8	iCLPCCommands;
+}TTestCmdCLPCCommands;
+
+
+/************************************************************************
+                PLT  DBS
+				Theses DBs were moved from the TWDExternalIf.h because of
+				redundency.
+************************************************************************/
+typedef struct 
+{
+	uint8   oAbsoluteGain; 	/* Per Sub-Band (output) */
+	uint8   oLNASteps[RX_PLT_LNA_STEPS_BUF_LEN]; 	/* 4 steps per Band (output) */
+	uint8   oTASteps[RX_PLT_TA_STEPS_BUF_LEN]; 	/* 2 steps per Band (output) */
+	uint8   Padding; 
+} TTestCmdRxPlt;
+
+typedef struct 
+{
+	uint32  ReceivedValidPacketsNumber;
+    uint32  ReceivedFcsErrorPacketsNumber;
+    uint32  ReceivedPlcpErrorPacketsNumber;
+    uint32 	SeqNumMissCount; /* For PER calculation */
+    int16   AverageSnr;
+    int16   AverageRssi;
+    int16  AverageEvm;
+    uint8   Padding[2];
+} RxPathStatistics_t;
+
+typedef struct 
+{
+	uint16  Length; 
+    uint16  EVM; 
+    uint16  RSSI;
+    uint16  FrequencyDelta; 
+    uint16  Flags;
+    int8	Type;
+    uint8   Rate;
+    uint8   Noise;
+    uint8   AgcGain;
+    uint8   Padding[2];
+} RxPacketStatistics_t;
+
+#define RX_STAT_PACKETS_PER_MESSAGE           (20) 
+typedef struct 
+{
+	RxPathStatistics_t		oRxPathStatistics;
+    uint32           		oBasePacketId; 
+    uint32           		ioNumberOfPackets; 			/* input/output: number of following packets */
+	uint32					oNumberOfMissedPackets;		/* number of following packet statistic entries that were dropped */
+    /*RxPacketStatistics_t    RxPacketStatistics[RX_STAT_PACKETS_PER_MESSAGE];*/
+	int16					oRadioStatus;
+} RadioRxStatistics;
+
+/* RX RF gain values */
+typedef enum PHY_RADIO_RX_GAIN_VALUES_ENMT
+{
+	FIRST_RX_GAIN_VALUE_E,					
+/*_______________________________________________*/
+	RX_GAIN_VALUE_0_E = FIRST_RX_GAIN_VALUE_E,	
+	RX_GAIN_VALUE_1_E,						
+	RX_GAIN_VALUE_2_E,						
+	RX_GAIN_VALUE_3_E,						
+	RX_GAIN_VALUE_4_E,					
+	RX_GAIN_VALUE_5_E,					
+	RX_GAIN_VALUE_6_E,					
+	RX_GAIN_VALUE_7_E,					
+/*_______________________________________________*/
+	NUMBER_OF_RX_GAIN_VALUES_E,				
+	LAST_RX_GAIN_VALUE_E = (NUMBER_OF_RX_GAIN_VALUES_E - 1)
+
+}PHY_RADIO_RX_GAIN_VALUES_ENM;
+
+/* RX BIP */
+typedef struct 
+{
+	uint32		oNVSVersion;
+	int32		iExternalSignalPowerLevel;
+	int32		oLnaTaCompensationValues[NUMBER_OF_RX_GAIN_VALUES_E-1];
+	TNvsStruct	oNvsStruct; 
+	int16		oRadioStatus;
+	int8		padding[2];
+}RadioRxPltCal;
+
+
+typedef enum
+{
+	eSINGLE_BAND_INI_FILE,
+	eDUAL_BAND_INI_FILE
+}IniFileSingleDualBand;
+
+#define SMART_REFLEX_LENGTH_INDEX				0
+#define SMART_REFLEX_UPPER_LIMIT_INDEX			1	
+#define SMART_REFLEX_START_ERROR_VALUE_INDEX	2
+
+#define MAX_SMART_REFLEX_FUB_VALUES		14
+/* 1. first index is the number of param	*/
+/* 2. second is the higher value			*/
+/* 3. 14 parameter of the correction		*/
+#define MAX_SMART_REFLEX_PARAM					(MAX_SMART_REFLEX_FUB_VALUES + SMART_REFLEX_START_ERROR_VALUE_INDEX)	
+
+
+
+typedef struct 
+{
+	uint8	RefClk;                                 
+	uint8	SettlingTime;                                                                 
+	uint8	ClockValidOnWakeup;                      
+	uint8	DC2DCMode;                               
+	uint8	Single_Dual_Band_Solution;  
+	uint8	TXBiPFEMAutoDetect;
+	uint8	TXBiPFEMManufacturer;                    
+/*	GeneralSettingsByte	Settings; */
+    uint8               GeneralSettings;
+	/* smart reflex state*/
+	uint8				SRState;
+	/* FUB parameters */
+	int8				SRF1[MAX_SMART_REFLEX_PARAM];
+	int8				SRF2[MAX_SMART_REFLEX_PARAM];
+	int8				SRF3[MAX_SMART_REFLEX_PARAM];
+	/* FUB debug parameters */
+	int8				SR_Debug_Table[MAX_SMART_REFLEX_PARAM];
+	uint8				SR_SEN_N_P;
+	uint8				SR_SEN_N_P_Gain;
+	uint8				SR_SEN_NRN;
+	uint8				SR_SEN_PRN;
+
+	uint8				padding[3];
+}IniFileGeneralParam;  
+
+typedef enum 
+{		
+	FEM_MANUAL_DETECT_MODE_E,
+	FEM_AUTO_DETECT_MODE_E
+
+}FEM_DETECT_MODE_ENM;
+
+typedef enum 
+{		
+	FEM_RFMD_TYPE_E,
+	FEM_TRIQUINT_TYPE_E,
+	NUMBER_OF_FEM_TYPES_E
+
+}FEM_TYPE_ENM;
+
+typedef enum 
+{		
+	eREF_CLK_19_2_E,
+	eREF_CLK_26_E,
+	eREF_CLK_38_4_E,
+	eREF_CLK_52_E,
+	eREF_CLK_XTAL
+	
+
+}REF_CLK_ENM;
+
+typedef enum 
+{		
+	REF_CLK_NOT_VALID_E,
+	REF_CLK_VALID_AND_STABLE_E
+
+}CLK_VALID_ON_WAKEUP_ENM;
+
+typedef enum 
+{		
+	BT_SPI_IS_NOT_USED_E,
+	MUX_DC2DC_TO_BT_FUNC2_E
+
+}DC2DC_MODE_ENM;
+
+typedef enum 
+{		
+	SINGLE_BAND_SOLUTION_E,
+	DUAL_BAND_SOLUTION_E
+
+}SINGLE_DUAL_BAND_SOLUTION_ENM;
+
+/* General settings byte */
+typedef enum 
+{		
+	TELEC_CHAN_14_OFF_E,
+	TELEC_CHAN_14_ON_E
+
+}TELEC_CHAN_14_ENM;
+
+typedef enum 
+{		
+	NBI_OFF_E,
+	NBI_ON_E
+
+}NBI_ENM;
+
+#define RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE   (15)
+
+typedef struct 
+{
+	/* SECTION 1: 2.4G parameters */
+	uint8 RxTraceInsertionLoss_2_4G;																							
+	uint8 TXTraceLoss_2_4G;																							
+	int8  RxRssiAndProcessCompensation_2_4G[RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE];						
+	
+	/* SECTION 2: 5G parameters */										 
+	uint8 RxTraceInsertionLoss_5G[NUMBER_OF_SUB_BANDS_IN_5G_BAND_E];																
+	uint8 TXTraceLoss_5G[NUMBER_OF_SUB_BANDS_IN_5G_BAND_E];																
+	int8  RxRssiAndProcessCompensation_5G[RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE];									
+
+}TStatRadioParams;  
+
+typedef struct 
+{
+	/* SECTION 1: 2.4G parameters */
+	uint16 TXBiPReferencePDvoltage_2_4G;									
+	uint8  TxBiPReferencePower_2_4G;																				
+	int8  TxBiPOffsetdB_2_4G;																							
+	int8  TxPerRatePowerLimits_2_4G_Normal[NUMBER_OF_RATE_GROUPS_E];							
+	int8  TxPerRatePowerLimits_2_4G_Degraded[NUMBER_OF_RATE_GROUPS_E];							
+	int8  TxPerRatePowerLimits_2_4G_Extreme[NUMBER_OF_RATE_GROUPS_E];							
+	int8  TxPerChannelPowerLimits_2_4G_11b[NUMBER_OF_2_4_G_CHANNELS];	
+	int8  TxPerChannelPowerLimits_2_4G_OFDM[NUMBER_OF_2_4_G_CHANNELS];	
+	int8  TxPDVsRateOffsets_2_4G[NUMBER_OF_RATE_GROUPS_E];												
+	uint8 TxIbiasTable_2_4G[NUMBER_OF_RATE_GROUPS_E];														
+	uint8 RxFemInsertionLoss_2_4G;																			
+    uint8 DegradedLowToNormalThr_2_4G;
+    uint8 NormalToDegradedHighThr_2_4G;
+
+	/* SECTION 2: 5G parameters */
+	uint16 TXBiPReferencePDvoltage_5G[NUMBER_OF_SUB_BANDS_IN_5G_BAND_E];
+	uint8  TxBiPReferencePower_5G[NUMBER_OF_SUB_BANDS_IN_5G_BAND_E];				
+	int8  TxBiPOffsetdB_5G[NUMBER_OF_SUB_BANDS_IN_5G_BAND_E];								
+	int8  TxPerRatePowerLimits_5G_Normal[NUMBER_OF_RATE_GROUPS_E];							
+	int8  TxPerRatePowerLimits_5G_Degraded[NUMBER_OF_RATE_GROUPS_E];						
+	int8  TxPerRatePowerLimits_5G_Extreme[NUMBER_OF_RATE_GROUPS_E];						
+	int8  TxPerChannelPowerLimits_5G_OFDM[NUMBER_OF_5G_CHANNELS];                         
+	int8  TxPDVsRateOffsets_5G[NUMBER_OF_RATE_GROUPS_E];										
+	int8  TxIbiasTable_5G[NUMBER_OF_RATE_GROUPS_E];											
+	uint8  RxFemInsertionLoss_5G[NUMBER_OF_SUB_BANDS_IN_5G_BAND_E];									
+    uint8 DegradedLowToNormalThr_5G;
+    uint8 NormalToDegradedHighThr_5G;
+ 
+}TDynRadioParams;  
+
+typedef struct 
+{
+	TStatRadioParams	tStatRadioParams;
+	TDynRadioParams		tDynRadioParams;
+    uint8				Padding[2];
+
+}IniFileRadioParam;  
+
+/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
+
+/* Describes a reference design supported by the HDK Module */
+typedef struct HDKReferenceDesign_t
+{
+    uint16  referenceDesignId;          /* Reference design Id supported */
+    uint8   nvsMajorVersion;            /* First EEPROM version supported */
+    uint8   nvsMinorVersion;
+    uint8   nvsMinorMinorVersion;
+} THDKReferenceDesign;
+
+typedef struct HDKModuleVersion_t
+{
+    uint8               ProductName;				/* '6' for WiLink6, '4' for WiLink4 */
+    uint8               PgNumber;                   /* Hardware tag */
+    uint8               SoftwareVersionLevel;       /* SW level number (Major SW change) */
+    uint8               SoftwareVersionDelivery;    /* Delivery number inside any (Inside any level) */
+
+    uint8					radioModuleType;                    /* The radio that is currently supported by the HDK module */
+    uint8					numberOfReferenceDesignsSupported;  /* The number of reference designs supported by the HDK module */
+    THDKReferenceDesign*   referenceDesignsSupported;			/* Array of reference_design supported */
+	
+} THDKModuleVersion;
+
+#define FW_VERSION_LENGTH 5
+
+typedef struct 
+{	
+	THDKModuleVersion	hdkVersion;
+	uint8				FWVersion[FW_VERSION_LENGTH];		
+    uint32               drpwVersion;
+	int16				oRadioStatus;
+	uint8				padding[3];		
+}TFWVerisons;
+
+typedef struct
+{
+    int16       RSSIVal;      /* free running RSSI value, 1dB resolution */
+    int16		oRadioStatus;   
+}TTestCmdFreeRSSI;
+
+typedef struct
+{
+    TestCmdID_e     testCmdId;
+	int8            padding[3];
+
+	/* Efil -	when adding parameter here fill the switch case sentence in function
+			"cmdBld_CmdIeTest" in module "TWD\Ctrl\CmdBldCmdIE.c" */
+    union
+    {
+		TTestCmdChannel 			Channel;
+		RadioRxPltCal 					RxPlt;          
+		TTestCmdPdBufferCal 		PdBufferCal;
+		TTestCmdP2GCal 				P2GCal;             
+		TTestCmdPdBufferErrors			PdBufferErrors;
+		TTestCmdUpdateReferncePoint		PdBufferCalReferencePoint;
+		TPacketParam 				TxPacketParams;
+		TToneParam 					TxToneParams;
+		TTxTemplate					TxTemplateParams;
+		/*uint32               			txGainAdjust; */
+		TTxGainAdjust				txGainAdjust;
+		RadioRxStatistics			Statistics;
+		TFWVerisons					fwVersions;
+		TTestCmdRunCalibration		RunCalibration;
+        IniFileRadioParam           IniFileRadioParams;
+        IniFileGeneralParam				IniFileGeneralParams;
+		EfuseParameters_t				EfuseParams;
+        TestToneParams_t				TestToneParams;
+		TTestCmdPowerMode				powerMode;
+        TTestCmdFreeRSSI                freeRSSI;
+		TTestCmdCLPCCommands			clpcCommands;
+        TTestCmdDCOItrimOnOff              DCOitrimFeatureOnOff;
+
+		TTestCmdDebug					testDebug;
+    }testCmd_u;
+}TTestCmd;
+
+
+#ifndef HOST_IF_ENUMS_DISABLED
+typedef enum RadioParamType_e
+{
+    RADIO_PARAM_POWER_TABLE = 1,
+    RADIO_PARAM_POWER_LIMIT_TABLE,
+    RADIO_PARAM_POWER_ADJ_TABLE,
+    RADIO_PARAM_POWER_ENABLES,
+    RADIO_PABIAS_TABLE,
+    RADIO_PARAM_POWER_LEVELS,
+
+    MAX_RADIO_PARAM_TYPE = 0x7FFFFFFF /* force this enum to be uint32 */
+    
+} RadioParamType_e;
+#else
+typedef uint32 RadioParamType_e;
+#endif
+
+typedef struct RadioParam_t
+{
+    RadioParamType_e parameterType;
+    int8  parameter[MAX_RADIO_PARAM_LEN];
+} RadioParam_t;
+
+typedef enum RadioState_e
+{
+    RADIO_STATE_INIT = 1,           /* Completed radio initialization */
+    RADIO_STATE_TUNE = 2,           /* Completed channel tuning */
+    RADIO_STATE_DC_CAL = 3,         /* Completed radio DC calibration */
+    RADIO_STATE_AFE_DC_CAL =4,      /* Completed AFE DC calibration */
+    RADIO_STATE_TX_MM = 5,          /* Completed transmit IQ mismatch calibration */
+    RADIO_STATE_TX_EQUAL = 6,       /* Completed transmit equalization  calibration */
+    RADIO_STATE_CARR_SUPP = 7,      /* Completed carrier suppression calibration */
+    RADIO_STATE_TX_PWR_CTRL = 8     /* Completed transmit power control calibration (only for bg and abg radios) */
+
+} RadioState_e;
+
+typedef enum
+{
+    PS_MODE_ENTER_ELP = 0x0,
+    PS_MODE_ENTER_PD = 0x1,
+    PS_MODE_EXIT_FROM_ELP = 0x2,
+    PS_MODE_EXIT_FROM_PD = 0x4,
+    PS_MODE_ENTER_ELP_SG_EN = 0x10,
+    PS_MODE_ENTER_PD_SG_EN = 0x11,
+    PS_MODE_EXIT_FROM_ELP_SG_EN = 0x12,
+    PS_MODE_EXIT_FROM_PD_SG_EN = 0x14,
+    PS_MODE_INVALID = 0xFF
+
+}PowerSaveMode_e;
+
+typedef struct RadioTune_t
+{
+    Channel_e   channel;
+    RadioBand_e band;
+} RadioTune_t;
+
+typedef struct RadioRSSIAndSNR_t
+{
+    int16   rssi;
+    int16   snr;
+}RadioRSSIAndSNR_t;
+
+/* VBIAS values (in mili-volts) */
+typedef enum PHY_RADIO_VBIAS_MV_ENMT
+{
+	FIRST_VBIAS_VALUE_E = -1,
+
+	VBIAS_0MV_E = FIRST_VBIAS_VALUE_E,
+	VBIAS_100MV_E = 0,
+	VBIAS_200MV_E = 1,
+	VBIAS_300MV_E = 2,
+	VBIAS_400MV_E = 3,
+	VBIAS_500MV_E = 4,
+	VBIAS_600MV_E = 5,
+	VBIAS_700MV_E = 6,
+	VBIAS_800MV_E = 7,
+
+	NUMBER_OF_VBIAS_VALUES_E = 9,
+    LAST_VBIAS_VALUE_E = (NUMBER_OF_VBIAS_VALUES_E - 1)
+
+}PHY_RADIO_VBIAS_MV_ENM;
+
+/* Gain monitor values */
+typedef enum PHY_RADIO_GAIN_MONITOR_TYPES_ENMT
+{
+	FIRST_GAIN_MONITOR_TYPE_E,
+	GAIN_MONITOR_DISABLE = 0,
+	GAIN_MONITOR_RESERVED = 1,
+/*_______________________________________________*/
+	GAIN_MONITOR_X0_5_E = 2,
+	GAIN_MONITOR_X1_E = 3,
+	GAIN_MONITOR_X2_E = 4,
+	GAIN_MONITOR_X4_E = 5,
+	GAIN_MONITOR_X8_E = 6,
+	GAIN_MONITOR_X16_E = 7,
+/*_______________________________________________*/
+	NUMBER_OF_GAIN_MONITOR_TYPES_E = GAIN_MONITOR_X16_E,				
+	LAST_GAIN_MONITOR_TYPE_E = (NUMBER_OF_GAIN_MONITOR_TYPES_E - 1)	
+
+}PHY_RADIO_GAIN_MONITOR_TYPES_ENM;
+
+
+/* TX Packet Mode; */
+typedef enum
+{
+	eTX_MODE_SINGLE_PACKET,              /* 0 */
+	eTX_MODE_MULTIPLE_PACKET,            /* 1 */
+	eTX_MODE_INFINITE_LENGTH_PACKET,     /* 2 */
+	eTX_MODE_CONTINUES_PACKET,           /* 3 */
+	eTX_MODE_FCC_PACKET,                 /* 4 */
+	eTX_MODE_SENARIO_PACKET,	     /* 5 */
+
+	eMAX_PACKET_MODE_PACKET
+}PacketTypeMode;
+
+/* TX tone mode */
+typedef enum
+{
+	eSILENCE_TONE_MODE,
+	eCARRIER_FEED_THROUGH_MODE,
+	eSINGLE_TONE_MODE,
+	eTWO_TONE_MODE,
+	eMULTI_TONE_MODE,
+
+	eMax_TONE_MODE
+}ToneTypeMode;
+
+
+/**********************************************************************/
+/*		For RSSI Calculation - Save Parameters						  */
+/**********************************************************************/
+
+typedef struct 
+{
+	uint16 linerEvmVal;
+	uint16 ccaEcalcMonReg;
+	uint16 ccaEcalcRssi;
+	uint16 linerEvmPilVal;
+	uint8 lanTableIndex;
+	uint8 taTableIndex;
+	uint8 lnaTableIndex;
+	RADIO_SUB_BAND_TYPE_ENM currSubBand;
+	RADIO_BAND_TYPE_ENM		currBand;
+}rssiParamSave_t;
+
+
+
+#endif	/* #ifndef PUBLIC_RADIO */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/FirmwareApi/public_types.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,352 @@
+/*
+ * public_types.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/**********************************************************************************************************************
+
+  FILENAME:       public_types.h
+
+  DESCRIPTION:    Basic types and general macros, bit manipulations, etc.
+
+
+
+***********************************************************************************************************************/
+#ifndef PUBLIC_TYPES_H
+#define PUBLIC_TYPES_H
+ 
+
+/******************************************************************************
+
+    Basic definitions
+
+******************************************************************************/
+#ifndef uint8
+typedef unsigned char   uint8;
+#endif
+#ifndef uint16
+typedef unsigned short  uint16;
+#endif
+#ifndef uint32
+typedef unsigned long int    uint32;
+#endif
+#ifndef uint64
+typedef unsigned long long    uint64;
+#endif
+
+
+#ifndef int8
+typedef signed char     int8;
+#endif
+#ifndef int16
+typedef short           int16;
+#endif
+#ifndef int32
+typedef long int        int32;
+#endif
+#ifndef int64
+typedef long long       int64;
+#endif
+
+
+#ifdef HOST_COMPILE
+    #ifndef TI_TRUE
+    #define TI_TRUE  1
+    #endif
+    #ifndef TI_FALSE
+    #define TI_FALSE 0
+    #endif
+#else
+    #ifndef TRUE
+    #define TRUE  1
+    #endif
+    #ifndef FALSE
+    #define FALSE 0
+    #endif
+    #define STATIC			static
+    #define INLINE			inline
+#endif
+
+/* !! LAC - NULL definition conflicts with the compilers version.
+   I redid this definition to the ANSI version....
+    #define NULL 0
+*/
+#if !defined( NULL )
+#if defined( __cplusplus )
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+/* Bool_e should be used when we need it to be a byte. */
+typedef uint8           Bool_e;
+
+/* Bool32 should be used whenever possible for efficiency */
+typedef uint32          Bool32;
+
+/* to align enum to 32/16 bits */
+#define MAX_POSITIVE32 0x7FFFFFFF
+#define MAX_POSITIVE16 0x7FFF
+#define MAX_POSITIVE8  0x7F
+
+#define MAC_ADDR_SIZE							6   /* In Bytes */
+#define MAC_ADDRESS_MANUFACTURE_TYPE_LENGHT		3   /* In Bytes */
+#define MAC_ADDRESS_STATION_ID_LENGHT			3   /* In Bytes */
+
+#ifdef HOST_COMPILE
+#else
+typedef struct macAddress_t
+{
+    uint8 addr[MAC_ADDR_SIZE];
+}macAddress_t;
+#endif
+
+
+#define  BIT_0    0x00000001
+#define  BIT_1    0x00000002
+#define  BIT_2    0x00000004
+#define  BIT_3    0x00000008
+#define  BIT_4    0x00000010
+#define  BIT_5    0x00000020
+#define  BIT_6    0x00000040
+#define  BIT_7    0x00000080
+#define  BIT_8    0x00000100
+#define  BIT_9    0x00000200
+#define  BIT_10   0x00000400
+#define  BIT_11   0x00000800
+#define  BIT_12   0x00001000
+#define  BIT_13   0x00002000
+#define  BIT_14   0x00004000
+#define  BIT_15   0x00008000
+#define  BIT_16   0x00010000
+#define  BIT_17   0x00020000
+#define  BIT_18   0x00040000
+#define  BIT_19   0x00080000
+#define  BIT_20   0x00100000
+#define  BIT_21   0x00200000
+#define  BIT_22   0x00400000
+#define  BIT_23   0x00800000
+#define  BIT_24   0x01000000
+#define  BIT_25   0x02000000
+#define  BIT_26   0x04000000
+#define  BIT_27   0x08000000
+#define  BIT_28   0x10000000
+#define  BIT_29   0x20000000
+#define  BIT_30   0x40000000
+#define  BIT_31   0x80000000
+
+#define  BIT_32   0x00000001
+#define  BIT_33   0x00000002
+#define  BIT_34   0x00000004
+#define  BIT_35   0x00000008
+#define  BIT_36   0x00000010
+#define  BIT_37   0x00000020
+#define  BIT_38   0x00000040
+#define  BIT_39   0x00000080
+#define  BIT_40   0x00000100
+#define  BIT_41   0x00000200
+#define  BIT_42   0x00000400
+#define  BIT_43   0x00000800
+#define  BIT_44   0x00001000
+#define  BIT_45   0x00002000
+#define  BIT_46   0x00004000
+#define  BIT_47   0x00008000
+#define  BIT_48   0x00010000
+#define  BIT_49   0x00020000
+#define  BIT_50   0x00040000
+#define  BIT_51   0x00080000
+#define  BIT_52   0x00100000
+#define  BIT_53   0x00200000
+#define  BIT_54   0x00400000
+#define  BIT_55   0x00800000
+#define  BIT_56   0x01000000
+#define  BIT_57   0x02000000
+#define  BIT_58   0x04000000
+#define  BIT_59   0x08000000
+#define  BIT_60   0x10000000
+#define  BIT_61   0x20000000
+#define  BIT_62   0x40000000
+#define  BIT_63   0x80000000
+
+
+/******************************************************************************
+
+    CHANNELS, BAND & REG DOMAINS definitions
+
+******************************************************************************/
+
+
+typedef uint8 Channel_e;
+
+typedef enum
+{
+    RADIO_BAND_2_4GHZ = 0,  /* 2.4 Ghz band */
+    RADIO_BAND_5GHZ = 1,    /* 5 Ghz band */
+    RADIO_BAND_JAPAN_4_9_GHZ = 2,
+    DEFAULT_BAND = RADIO_BAND_2_4GHZ,
+    INVALID_BAND = 0x7E,
+    MAX_RADIO_BANDS = 0x7F
+} RadioBand_enum;
+
+#ifdef HOST_COMPILE
+typedef uint8 RadioBand_e;
+#else
+typedef RadioBand_enum RadioBand_e;
+#endif
+
+/* The following enum is used in the FW for HIF interface only !!!!! */
+typedef enum
+{
+    HW_BIT_RATE_1MBPS   = BIT_0 ,
+    HW_BIT_RATE_2MBPS   = BIT_1 ,
+    HW_BIT_RATE_5_5MBPS = BIT_2 ,
+    HW_BIT_RATE_6MBPS   = BIT_3 ,
+    HW_BIT_RATE_9MBPS   = BIT_4 ,
+    HW_BIT_RATE_11MBPS  = BIT_5 ,
+    HW_BIT_RATE_12MBPS  = BIT_6 ,
+    HW_BIT_RATE_18MBPS  = BIT_7 ,
+    HW_BIT_RATE_22MBPS  = BIT_8 ,
+    HW_BIT_RATE_24MBPS  = BIT_9 ,
+    HW_BIT_RATE_36MBPS  = BIT_10,
+    HW_BIT_RATE_48MBPS  = BIT_11,
+    HW_BIT_RATE_54MBPS  = BIT_12,
+    HW_BIT_RATE_MCS_0  	= BIT_13,
+    HW_BIT_RATE_MCS_1  	= BIT_14,
+    HW_BIT_RATE_MCS_2  	= BIT_15,
+    HW_BIT_RATE_MCS_3  	= BIT_16,
+    HW_BIT_RATE_MCS_4  	= BIT_17,
+    HW_BIT_RATE_MCS_5  	= BIT_18,
+    HW_BIT_RATE_MCS_6  	= BIT_19,
+    HW_BIT_RATE_MCS_7  	= BIT_20
+} EHwBitRate;
+
+/* The following enum is used in the FW for HIF interface only !!!!! */
+typedef enum
+{
+    txPolicyMcs7 = 0,
+    txPolicyMcs6,
+    txPolicyMcs5,
+    txPolicyMcs4,
+    txPolicyMcs3,
+    txPolicyMcs2,
+    txPolicyMcs1,
+    txPolicyMcs0,
+    txPolicy54,
+    txPolicy48,
+    txPolicy36,
+    txPolicy24,
+    txPolicy22,
+    txPolicy18,
+    txPolicy12,
+    txPolicy11,
+    txPolicy9,
+    txPolicy6,
+    txPolicy5_5,
+    txPolicy2,
+    txPolicy1,
+    MAX_NUM_OF_TX_RATES_IN_CLASS,
+    TX_RATE_INDEX_ENUM_MAX_SIZE = 0xFF
+} ETxRateClassId;
+
+
+
+
+#define SHORT_PREAMBLE_BIT   BIT_0 /* CCK or Barker depending on the rate */
+#define OFDM_RATE_BIT        BIT_6
+#define PBCC_RATE_BIT        BIT_7
+
+
+typedef enum
+{
+    CCK_LONG = 0,
+    CCK_SHORT = SHORT_PREAMBLE_BIT,
+    PBCC_LONG = PBCC_RATE_BIT,
+    PBCC_SHORT = PBCC_RATE_BIT | SHORT_PREAMBLE_BIT,
+    OFDM = OFDM_RATE_BIT
+} Mod_enum;
+
+#ifdef HOST_COMPILE
+typedef  uint8 Mod_e;
+#else
+typedef  Mod_enum Mod_e;
+#endif
+
+
+typedef uint16 BasicRateSet_t;
+
+
+/******************************************************************************
+
+Transmit-Descriptor RATE-SET field definitions...
+
+******************************************************************************/
+
+typedef uint32 EHwRateBitFiled;/* set with EHwBitRate values */
+
+#ifdef HOST_COMPILE
+typedef uint8  TxRateIndex_t;  /* set with ETxRateClassId values */
+#else 
+typedef ETxRateClassId TxRateIndex_t;
+#endif
+
+/******************************************************************************
+ 
+    CHIP_ID definitions
+ 
+******************************************************************************/
+#define TNETW1150_PG10_CHIP_ID          0x04010101
+#define TNETW1150_PG11_CHIP_ID          0x04020101
+#define TNETW1150_CHIP_ID               0x04030101  /* 1150 PG2.0, 1250, 1350, 1450*/
+#define TNETW1350A_CHIP_ID              0x06010101
+#define TNETW1251_CHIP_ID_PG1_0         0x07010101
+#define TNETW1251_CHIP_ID_PG1_1         0x07020101
+#define TNETW1251_CHIP_ID_PG1_2	        0x07030101
+#define TNETW1273_CHIP_ID_PG1_0	        0x04030101
+#define TNETW1273_CHIP_ID_PG1_1	        0x04030111 
+
+#define CHECK_CHIP_ID(chipId) (CHIP_ID_B == chipId)
+
+/******************************************************************************
+Enable bits for SOC1251 PG1.2
+******************************************************************************/
+#define PDET_BINARY_OFFSET_EN   BIT_0
+#define STOP_TOGGLE_MONADC_EN   BIT_1
+#define RX_ADC_BIAS_DEC_EN      BIT_2
+#define RX_LNB_AND_DIGI_GAIN_EN BIT_3
+
+
+#endif /* PUBLIC_TYPES_H*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/Export_Inc/MacServices_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,525 @@
+/*
+ * MacServices_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 MacServicesApi.h
+ *  \brief This file include public definitions for the MacServices module, comprising its API.
+ *  \date 6-Oct-2005
+ */
+
+#ifndef __MACSERVICESAPI_H__
+#define __MACSERVICESAPI_H__
+
+#include "osApi.h"
+
+/*
+ ***********************************************************************
+ *	Constant definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	Enums.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	Typedefs.
+ ***********************************************************************
+ */
+
+
+
+/*
+ ***********************************************************************
+ *	Structure definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	External data definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	External functions definitions
+ ***********************************************************************
+ */
+/**
+ * \date 6-Oct-2004\n
+ * \brief Creates MacServices module
+ *
+ * Function Scope \e Public.\n
+ * \param hOS - handle to the OS object.\n
+ */
+TI_HANDLE MacServices_create( TI_HANDLE hOS );
+
+/**
+ * \date 6-Oct-2004\n
+ * \brief Destroys MacServices module
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ */
+void MacServices_destroy( TI_HANDLE hMacServices );
+
+/**
+ * \date  6-Oct-2004\n
+ * \brief Initializes the MacServices module
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the Mac Services object.\n
+ * \param hReport - handle to the report object.\n
+ * \param hTWD - handle to the HAL ctrl object.\n
+ * \param hCmdBld - handle to the HAL ctrl object.\n
+ * \param hEventMbpx - handle to the HAL ctrl object.\n
+ */
+void MacServices_init (TI_HANDLE hMacServices, 
+                       TI_HANDLE hReport, 
+                       TI_HANDLE hTWD, 
+                       TI_HANDLE hCmdBld, 
+                       TI_HANDLE hEventMbox, 
+                       TI_HANDLE hTimer);
+void MacServices_config (TI_HANDLE hMacServices, TTwdInitParams *pInitParams);
+void MacServices_restart (TI_HANDLE hMacServices);
+
+void MacServices_registerFailureEventCB (TI_HANDLE hMacServices, void * failureEventCB, TI_HANDLE hFailureEventObj);
+
+
+/***********************************************************************
+ *	Scan SRV API functions
+ ***********************************************************************/
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Registers a complete callback for scan complete notifications.
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param scanCompleteCB - the complete callback function.\n
+ * \param hScanCompleteObj - handle to the object passed to the scan complete callback function.\n
+ */
+void MacServices_scanSRV_registerScanCompleteCB( TI_HANDLE hMacServices, 
+                                     TScanSrvCompleteCb scanCompleteCB, TI_HANDLE hScanCompleteObj );
+
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Performs a scan
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param scanParams - the scan specific parameters.\n
+ * \param eScanTag - tag used for result and scan complete tracking
+ * \param bHighPriority - whether to perform a high priority (overlaps DTIM) scan.\n
+ * \param bDriverMode - whether to try to enter driver mode (with PS on) before issuing the scan command.\n
+ * \param bScanOnDriverModeError - whether to proceed with the scan if requested to enter driver mode and failed.\n
+ * \param bSendNullData - whether to send Null data when exiting driver mode on scan complete.\n
+ * \param psRequest - Parameter sent to PowerSaveServer on PS request to indicate PS on or "keep current" 
+ * \param commandResponseFunc - CB function which called after downloading the command. \n
+ * \param commandResponseObj -  The CB function Obj (Notice : last 2 params are NULL in Legacy run). \n
+  * \return TI_OK if successful (various, TBD codes if not).\n
+ */
+TI_STATUS MacServices_scanSRV_scan( TI_HANDLE hMacServices, TScanParams *scanParams, EScanResultTag eScanTag,
+                                    TI_BOOL bHighPriority, TI_BOOL bDriverMode, TI_BOOL bScanOnDriverModeError, 
+						E80211PsMode psRequest, TI_BOOL bSendNullData,
+						TCmdResponseCb commandResponseFunc, TI_HANDLE commandResponseObj );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Stops a scan in progress
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param eScanTag - scan tag, used for scan complete and result tracking
+ * \param bSendNullData - indicates whether to send Null data when exiting driver mode.\n
+ * \param commandResponseFunc - CB function which called after downloading the command. \n
+ * \param commandResponseObj -  The CB function Obj (Notice : last 2 params are NULL in Legacy run). \n
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */
+TI_STATUS MacServices_scanSRV_stopScan( TI_HANDLE hMacServices, EScanResultTag eScanTag, TI_BOOL bSendNullData,
+                                        TCmdResponseCb commandResponseFunc, TI_HANDLE commandResponseObj );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 17-Jan-2005\n
+ * \brief Notifies the scan SRV of a FW reset (that had originally been reported by a different module).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */
+TI_STATUS MacServices_scanSRV_stopOnFWReset( TI_HANDLE hMacServices );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief callback function used by the power manager to notify driver mode result
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param psStatus - the power save request status.\n
+ */
+void MacServices_scanSRV_powerSaveCB( TI_HANDLE hScanSRV, TI_UINT8 PSMode,TI_UINT8 psStatus );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Callback function used by the HAL ctrl to notify scan complete
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param str - pointer to scan result buffer (holding SPS status for SPS scan only!).\n
+ * \param strLen - scan result buffer length (should ALWAYS be 2, even for non SPS scans).\n
+ */
+void MacServices_scanSRV_scanCompleteCB( TI_HANDLE hScanSRV, char* str, TI_UINT32 strLen );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief called when a scan timer expires. Completes the scan and starts a recovery process.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ */
+void MacServices_scanSRV_scanTimerExpired (TI_HANDLE hScanSRV, TI_BOOL bTwdInitOccured);
+
+void MacServices_scanSrv_UpdateDtimTbtt (TI_HANDLE hMacServices, 
+                                         TI_UINT8  uDtimPeriod, 
+                                         TI_UINT16 uBeaconInterval);
+
+#ifdef TI_DBG
+/**
+ * \author Shirit Brook\n
+ * \date God knows when...\n
+ * \brief Prints Scan Server SM status.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the Mac Services object.\n
+ */
+void MacServices_scanSrv_printDebugStatus(TI_HANDLE hMacServices);
+#endif
+
+/*Power server API*/
+
+
+/**
+  * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief request PS by User
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) hPowerSrv 						- handle to the PowerSrv object.\n		
+ * 2) psMode							- Power save/Active request.\n
+ * 3) sendNullDataOnExit				- \n
+ * 4) powerSaveCompleteCBObject		- handle to the Callback functin module.\n
+ * 5) powerSaveCompleteCB				- Calback function - for success/faild notification.\n
+ * 6) powerSavecmdResponseCB			- Calback function - for GWSI success/faild notification.\n
+ * Return Value: TI_STATUS - TI_OK / PENDING / TI_NOK.\n
+ * \b Description:\n
+ * This function is a user mode request from the Power Save Server./n
+ * it will create a Request from typ "USER_REQUEST" and will try to perform the user request for PS/Active./n
+ * this will be done in respect of priority to Driver request./n
+ */
+TI_STATUS MacServices_powerSrv_SetPsMode(TI_HANDLE 	                hMacServices,
+                                		 E80211PsMode	            psMode,
+ 									     TI_BOOL  						sendNullDataOnExit,
+ 						        		 void * 					powerSaveCompleteCBObject,
+ 						        		 TPowerSaveCompleteCb  		powerSaveCompleteCB,
+ 						        		 TPowerSaveResponseCb	    powerSavecmdResponseCB);
+
+
+/**
+  * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief SW configure, use to override the current PowerMode (what ever it will be) to
+ *        active/PS combined with awake/power-down. use for temporary change the system policy.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the powerSrv object.\n
+ * 2) powerSrv_RequestFor_802_11_PS_e - the driver mode obliged to be in 802.11 PS or not change.\n
+ * 3) PowerCtrl_PowerLevel_e - the desired driver power level (allowed: AWAKE or POWER DOWN).\n
+ * 4) TI_HANDLE theObjectHandle - the handle the object that need the PS success/fail notification.\n
+ * 5) ps802_11_NotificationCB_t - the callback function.\n
+ * 6) char* - the clinet name that ask for driver mode.\n
+ * Return Value: TI_STATUS - if success (already in power save) then TI_OK,\n
+ *                           if pend (wait to ACK form AP for the null data frame) then PENDING\n
+ *                           if PS isn't enabled then POWER_SAVE_802_11_NOT_ALLOWED\n
+ *                           else TI_NOK.\n
+ * \b Description:\n
+ * enter in to configuration of the driver that in higher priority from the user.\n
+ * the configuration is:\n
+ *  - to enter to802.11 PS or not (if not this isn't a request to get out from 802.11 PS).\n
+ *  - to change the HW power level to awake or power-down if not already there.
+ *    this is a must request.\n
+*/
+TI_STATUS MacServices_powerSrv_ReservePS(	TI_HANDLE 	                hMacServices,
+                                            E80211PsMode 	            psMode,
+                                            TI_BOOL  						sendNullDataOnExit,
+                                            void * 						powerSaveCBObject,
+                                            TPowerSaveCompleteCb 		powerSaveCompleteCB);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief end the temporary change of system policy, and returns to the user system policy.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the powerSrv object.\n
+ * 2) char* - the clinet name that ask for driver mode.\n
+ * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n
+ * \b Description:\n
+ * enter in to configuration of the driver that in higher priority from the user.\n
+ * the configuration is:\n
+ * end the user mode configuration (driver mode priority) and returns the user configuration
+ * (user mode priority).
+*/
+TI_STATUS MacServices_powerSrv_ReleasePS( 	TI_HANDLE 	hMacServices,
+									TI_BOOL  						sendNullDataOnExit,
+ 						 			void *  						powerSaveCBObject,
+ 									TPowerSaveCompleteCb  			powerSaveCompleteCB);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief reflects the actual state of the state machine
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the powerSrv object.\n
+ * Return Value:\n 
+ * TI_BOOL - thre is in PS false otherwise.\n
+*/
+TI_BOOL MacServices_powerSrv_getPsStatus(TI_HANDLE hMacServices);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \sets the rate as got from user else sets default value.\n
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE 	- handle to the powerSrv object.\n
+ * 2) TI_UINT16		- desierd rate .\n
+ * Return Value:\n 
+ * void.\n
+*/
+void MacServices_powerSrv_SetRateModulation(TI_HANDLE hMacServices, TI_UINT16  rate);
+/**
+ * \Return the alrweady seted rate.\n
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * TI_HANDLE 	- handle to the powerSrv object.\n
+ * Return Value: TI_UINT16		- desierd rate .\n
+ * void.\n
+*/
+TI_UINT32 MacServices_powerSrv_GetRateModulation(TI_HANDLE hMacServices);
+
+
+
+
+/***********************************************************************
+ *	Measurement SRV API functions
+ ***********************************************************************/
+
+/**
+ * \author Ronen Kalish\n
+ * \date 09-November-2005\n
+ * \brief Starts a measurement operation.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param pMsrRequest - a structure containing measurement parameters.\n
+ * \param timeToRequestExpiryMs - the time (in milliseconds) the measurement SRV has to start the request.\n
+ * \param cmdResponseCBFunc - callback function to used for command response.\n
+ * \param cmdResponseCBObj - handle to pass to command response CB.\n
+ * \param cmdCompleteCBFunc - callback function to be used for command complete.\n
+ * \param cmdCompleteCBObj - handle to pass to command complete CB.\n
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */ 
+TI_STATUS MacServices_measurementSRV_startMeasurement( TI_HANDLE hMacServices, 
+                                                       TMeasurementRequest* pMsrRequest,
+													   TI_UINT32 timeToRequestExpiryMs,
+                                                       TCmdResponseCb cmdResponseCBFunc,
+                                                       TI_HANDLE cmdResponseCBObj,
+                                                       TMeasurementSrvCompleteCb cmdCompleteCBFunc,
+                                                       TI_HANDLE cmdCompleteCBObj );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 09-November-2005\n
+ * \brief Stops a measurement operation in progress.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param bSendNullData - whether to send NULL data when exiting driver mode.\n
+ * \param cmdResponseCBFunc - callback function to used for command response.\n
+ * \param cmdResponseCBObj - handle to pass to command response CB.\n
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */
+TI_STATUS MacServices_measurementSRV_stopMeasurement( TI_HANDLE hMacServices,
+													  TI_BOOL bSendNullData,
+                                                      TCmdResponseCb cmdResponseCBFunc,
+                                                      TI_HANDLE cmdResponseCBObj );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 09-November-2005\n
+ * \brief Notifies the measurement SRV of a FW reset (recovery).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ */
+void MacServices_measurementSRV_FWReset( TI_HANDLE hMacServices );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 09-November-2005\n
+ * \brief callback function used by the power manager to notify driver mode result
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param PSMode - the power save mode the STA is currently in.\n
+ * \param psStatus - the power save request status.\n
+ */
+void MacServices_measurementSRV_powerSaveCB( TI_HANDLE hMeasurementSRV, TI_UINT8 PSMode,TI_UINT8 psStatus );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 14-November-2005\n
+ * \brief callback function used by the HAL for measure start event (sent when the FW 
+ * has started measurement operation, i.e. switched channel and changed RX filters).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_measureStartCB( TI_HANDLE hMeasurementSRV );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 14-November-2005\n
+ * \brief callback function used by the HAL for measure stop event (sent when the FW 
+ * has finished measurement operation, i.e. switched channel to serving channel and changed back RX filters).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_measureCompleteCB( TI_HANDLE hMeasurementSRV );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 14-November-2005\n
+ * \brief callback function used by the HAL for AP discovery stop event (sent when the FW 
+ * has finished AP discovery operation).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_apDiscoveryCompleteCB( TI_HANDLE hMeasurementSRV );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 16-November-2005\n
+ * \brief Callback for channel load get param call.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param status - the get_param call status.\n
+ * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
+ */
+void MacServices_measurementSRV_channelLoadParamCB( TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf );
+
+/** 
+ * \date 03-January-2005\n
+ * \brief Dummy callback for channel load get param call. Used to clear the channel load tracker.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param status - the get_param call status.\n
+ * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
+ */
+void MacServices_measurementSRV_dummyChannelLoadParamCB( TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 16-November-2005\n
+ * \brief Callback for noise histogram get param call.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param status - the get_param call status.\n
+ * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
+ */
+void MacServices_measurementSRV_noiseHistCallBack(TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf);
+
+/**
+ * \author Ronen Kalish\n
+ * \date 14-November-2005\n
+ * \brief called when a measurement FW guard timer expires.
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasuremntSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_startStopTimerExpired (TI_HANDLE hMeasurementSRV, TI_BOOL bTwdInitOccured);
+
+/**
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief called when a measurement type timer expires.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasuremntSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_requestTimerExpired (TI_HANDLE hMeasurementSRV, TI_BOOL bTwdInitOccured);
+
+#endif /* __MACSERVICESAPI_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,106 @@
+/*
+ * measurementSrvDbgPrint.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 MeasurementSrv.h
+ *  \brief This file include definitions for the measurmeent SRV module debug print functions.
+ *  \author Ronen Kalish
+ *  \date 23-december-2005
+ */
+
+#ifndef __MEASUREMENT_SRV__SBG_PRINT_H__
+#define __MEASUREMENT_SRV__SBG_PRINT_H__
+
+/*
+ ***********************************************************************
+ *	Constant definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	Enums.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	Typedefs.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	Structure definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	External data definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	External functions definitions
+ ***********************************************************************
+ */
+/** 
+ * \author Ronen Kalish\n
+ * \date 23-December-2005\n
+ * \brief Prints a measurement request.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param pMsrRequest - the measurement request.\n
+ */
+void measurementSRVPrintRequest( TI_HANDLE hMeasurementSRV, TMeasurementRequest *pMsrRequest );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 23-December-2005\n
+ * \brief Prints a measurement type request.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param pMsrTypeRequest - the measurement type request.\n
+ */
+void measurementSRVPrintTypeRequest( TI_HANDLE hMeasurementSRV, TMeasurementTypeRequest* pMsrTypeRequest );
+
+#endif /* __MEASUREMENT_SRV__SBG_PRINT_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/MacServices.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,380 @@
+/*
+ * MacServices.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 MacServices.c
+ *  \brief This file include public definitions for the scan SRV module, comprising its API.
+ *  \date 6-Oct-2005
+ */
+
+#define __FILE_ID__  FILE_ID_109
+#include "report.h"
+#include "ScanSrv.h"
+#include "MeasurementSrv.h"
+#include "MacServices.h"
+#include "PowerSrv_API.h"
+
+
+/****************************************************************************************
+ *                        MacServices_create                                                     *
+ *****************************************************************************************
+DESCRIPTION: Creates MacServices module
+                                                                                                                               
+INPUT:          hOS - handle to the OS object.
+OUTPUT:     
+RETURN:     handle to MacServices Object, NULL on failure .
+****************************************************************************************/
+
+TI_HANDLE MacServices_create( TI_HANDLE hOS) 
+{
+    MacServices_t *pMacServices = (MacServices_t*)os_memoryAlloc( hOS, sizeof(MacServices_t),MemoryNormal );
+    if ( NULL == pMacServices )
+    {
+        WLAN_OS_REPORT( ("ERROR: Failed to create Mac SRV module") );
+        return NULL;
+    }
+
+    /* nullify all handles, so that only handles in existence will be released */
+    pMacServices->hScanSRV = NULL;
+    pMacServices->hPowerSrv = NULL;
+ 
+    /* create the scanSRV handle */ 
+    pMacServices->hScanSRV = MacServices_scanSRV_create(hOS);
+    if ( NULL == pMacServices->hScanSRV )
+    {
+        MacServices_destroy( pMacServices );
+        return NULL;
+    }
+
+/* create the measurment handle */
+    pMacServices->hMeasurementSRV = MacServices_measurementSRV_create( hOS );
+    if ( NULL == pMacServices->hMeasurementSRV )
+    {
+            MacServices_destroy(pMacServices);
+        return NULL;
+    }
+
+    pMacServices->hPowerSrv = powerSrv_create(hOS);
+    if (NULL == pMacServices->hPowerSrv  )
+    {
+        MacServices_destroy(pMacServices);
+        return NULL;
+     }
+
+    /* store OS handle */
+    pMacServices->hOS      = hOS;
+
+    return pMacServices;
+}
+
+
+ 
+/****************************************************************************************
+ *                        MacServices_destroy                                                    *
+ *****************************************************************************************
+DESCRIPTION: destroys MacServices module
+                                                                                                                               
+INPUT:          hMacServices - handle to the Mac Services object.
+OUTPUT:     
+RETURN:     
+****************************************************************************************/
+void MacServices_destroy( TI_HANDLE hMacServices ) 
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+    
+    /* destroy all SRV modules */
+    if ( NULL != pMacServices->hScanSRV )
+    {
+        MacServices_scanSRV_destroy( pMacServices->hScanSRV );
+    }
+    if ( NULL != pMacServices->hMeasurementSRV )
+    {
+        MacServices_measurementSRV_destroy( pMacServices->hMeasurementSRV );
+    }
+
+    if(pMacServices->hPowerSrv)
+    powerSrv_destroy(pMacServices->hPowerSrv);
+
+    /* free the Mac services allocated context */
+    os_memoryFree( pMacServices->hOS, (TI_HANDLE)pMacServices , sizeof(MacServices_t) );
+}
+
+
+ /****************************************************************************************
+ *                        MacServices_init                                                   *
+ *****************************************************************************************
+DESCRIPTION: Initializes the MacServices module
+                                                                                                                               
+INPUT:    hMacServices - handle to the Mac Services object.\n   
+        hReport - handle to the report object.\n
+        hHalCtrl - handle to the HAL ctrl object.\n
+OUTPUT:     
+RETURN:     
+****************************************************************************************/
+void MacServices_init (TI_HANDLE hMacServices, 
+                       TI_HANDLE hReport, 
+                       TI_HANDLE hTWD, 
+                       TI_HANDLE hCmdBld, 
+                       TI_HANDLE hEventMbox, 
+                       TI_HANDLE hTimer) 
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    MacServices_scanSRV_init (hMacServices, hReport, hTWD, hTimer, hEventMbox, hCmdBld);
+
+    MacServices_measurementSRV_init (pMacServices->hMeasurementSRV, 
+                                     hReport, 
+                                     hCmdBld, 
+                                     hEventMbox, 
+                                     pMacServices->hPowerSrv,
+                                     hTimer);
+    
+    if (powerSrv_init (pMacServices->hPowerSrv, 
+                       hReport, 
+                       hEventMbox, 
+                       hCmdBld,
+                       hTimer) != TI_OK)
+    {
+        WLAN_OS_REPORT(("\n.....PowerSRV_init configuration failure \n"));
+        /*return TI_NOK;*/
+    }
+}
+
+
+ /****************************************************************************************
+ *                        MacServices_config                                                     *
+ *****************************************************************************************
+DESCRIPTION: config the MacServices moduleand sub modules
+                                                                                                                               
+INPUT:    hMacServices - handle to the Mac Services object.\n   
+        pInitParams  - pointer to the init params
+OUTPUT:     
+RETURN:     
+****************************************************************************************/
+void MacServices_config( TI_HANDLE hMacServices, TTwdInitParams *pInitParams) 
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    if (powerSrv_config(pMacServices->hPowerSrv,&pInitParams->tPowerSrv) != TI_OK)
+    {
+        WLAN_OS_REPORT(("\n.....PowerSRV_config failure \n"));
+    }
+
+    MacServices_scanSrv_config (pMacServices, &pInitParams->tScanSrv);
+}
+
+ /****************************************************************************************
+ *                        MacServices_restart                                                     *
+ *****************************************************************************************
+DESCRIPTION: restart the MacServices moduleand sub modules upon recovery
+                                                                                                                               
+INPUT:    hMacServices - handle to the Mac Services object.\n   
+OUTPUT:     
+RETURN:     
+****************************************************************************************/
+void MacServices_restart (TI_HANDLE hMacServices) 
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    scanSRV_restart (pMacServices->hScanSRV);
+    measurementSRV_restart (pMacServices->hMeasurementSRV);
+    powerSrv_restart (pMacServices->hPowerSrv);
+}
+
+
+/****************************************************************************************
+ *                        MacServices_registerFailureEventCB                                                     *
+ *****************************************************************************************
+DESCRIPTION: register the centeral error function from the health monitor to the MacService's sub modules
+                                                                                                                               
+INPUT:    hMacServices      - handle to the Mac Services object.    
+        failureEventCB  - pointer ro the call back
+        hFailureEventObj    -handle of the Callback Object
+OUTPUT:     
+RETURN:     
+****************************************************************************************/
+
+void MacServices_registerFailureEventCB (TI_HANDLE hMacServices, 
+                                         void * failureEventCB, 
+                                         TI_HANDLE hFailureEventObj)
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    powerSrvRegisterFailureEventCB (pMacServices->hPowerSrv,
+                                    failureEventCB,
+                                    hFailureEventObj);
+
+    measurementSRVRegisterFailureEventCB (pMacServices->hMeasurementSRV,
+                                          failureEventCB,
+                                          hFailureEventObj);
+
+    scanSRV_registerFailureEventCB (pMacServices->hScanSRV,
+                                    failureEventCB,
+                                    hFailureEventObj);
+
+}
+
+/****************************************************************************************
+ *                        MacServices_powerSrv_SetPsMode                                                            *
+ ****************************************************************************************
+DESCRIPTION: This function is a wrapper for the power server's powerSrv_SetPsMode function
+                                                                                                                   
+INPUT:      - hMacServices          - handle to the Mac services object.        
+            - psMode                    - Power save/Active request
+            - sendNullDataOnExit        - 
+            - powerSaveCBObject     - handle to the Callback function module.
+            - powerSaveCompleteCB   - Callback function - for success/faild notification.
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / PENDING / TI_NOK.
+****************************************************************************************/
+
+TI_STATUS MacServices_powerSrv_SetPsMode (TI_HANDLE                   hMacServices,
+                                          E80211PsMode                psMode,
+                                          TI_BOOL                        sendNullDataOnExit,
+                                          void *                      powerSaveCompleteCBObject,
+                                          TPowerSaveCompleteCb        powerSaveCompleteCB,
+                                          TPowerSaveResponseCb        powerSavecmdResponseCB)
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    return powerSrv_SetPsMode (pMacServices->hPowerSrv,
+                               psMode,
+                               sendNullDataOnExit,
+                               powerSaveCompleteCBObject,
+                               powerSaveCompleteCB,
+                               powerSavecmdResponseCB);
+}
+
+
+/****************************************************************************************
+ *                        MacServices_powerSrv_ReservePS                                                        *
+ ****************************************************************************************
+DESCRIPTION: This function is a wrapper for the power server's powerSrv_ReservePS function
+                                                                                                                   
+INPUT:      - hMacServices                  - handle to the Mac services object.        
+            - psMode                            - Power save/Active request
+            - sendNullDataOnExit                - 
+            - powerSaveCBObject             - handle to the Callback function module.
+            - powerSaveCompleteCB           - Callback function - for success/faild notification.
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / PENDING / TI_NOK.
+****************************************************************************************/
+TI_STATUS MacServices_powerSrv_ReservePS(   TI_HANDLE               hMacServices,
+                                            E80211PsMode psMode,
+                                            TI_BOOL                    sendNullDataOnExit,
+                                            void *                  powerSaveCBObject,
+                                            TPowerSaveCompleteCb    powerSaveCompleteCB)
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    return powerSrv_ReservePS(pMacServices->hPowerSrv,psMode,sendNullDataOnExit,powerSaveCBObject,powerSaveCompleteCB);
+}
+
+
+/****************************************************************************************
+ *                        MacServices_powerSrv_ReleasePS                                                        *
+ ****************************************************************************************
+DESCRIPTION: This function is a wrapper for the power server's powerSrv_ReleasePS function
+                                                                                                                   
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            - sendNullDataOnExit                - 
+            - powerSaveCBObject     - handle to the Callback function module.
+            - powerSaveCompleteCB           - Callback function - for success/faild notification.
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / PENDING / TI_NOK.
+****************************************************************************************/
+
+TI_STATUS MacServices_powerSrv_ReleasePS(   TI_HANDLE                   hMacServices,
+                                    TI_BOOL                        sendNullDataOnExit,
+                                    void *                          powerSaveCBObject,
+                                    TPowerSaveCompleteCb              powerSaveCompleteCB)
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    return powerSrv_ReleasePS(pMacServices->hPowerSrv,sendNullDataOnExit,powerSaveCBObject,powerSaveCompleteCB);
+}
+
+
+/****************************************************************************************
+ *                        MacServices_powerSrv_getPsStatus                                                       *
+ *****************************************************************************************
+DESCRIPTION: This function is a wrapper for the power server's powerSrv_getPsStatus function
+                                                                                                                                                                       
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            
+OUTPUT: 
+RETURN:    TI_BOOL - true if the SM is in PS state -  false otherwise
+****************************************************************************************/
+TI_BOOL MacServices_powerSrv_getPsStatus(TI_HANDLE hMacServices)
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    return powerSrv_getPsStatus( pMacServices->hPowerSrv);
+}
+
+
+ /****************************************************************************************
+ *                        MacServices_powerSrv_SetRateModulation                                                         *
+ *****************************************************************************************
+DESCRIPTION: This function is a wrapper for the power server's powerSrv_SetRateModulation function
+                                                                                                                                                                       
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.
+            - dot11mode_e - The current radio mode (A or G)
+            
+OUTPUT: 
+RETURN:    TI_BOOL - true if the SM is in PS state -  false otherwise
+****************************************************************************************/
+void MacServices_powerSrv_SetRateModulation(TI_HANDLE hMacServices, TI_UINT16  rate)
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    powerSrv_SetRateModulation( pMacServices->hPowerSrv,   rate);
+}
+
+
+TI_UINT32 MacServices_powerSrv_GetRateModulation(TI_HANDLE hMacServices)
+{
+    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
+
+    return powerSrv_GetRateModulation( pMacServices->hPowerSrv);
+}
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/MacServices.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,56 @@
+/*
+ * MacServices.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 MacServices.h
+ *  \brief This file include internal definitions for the MacServices module
+ *  \date 6-Oct-2005
+ */
+
+
+#ifndef __MACSERVICES_H__
+#define __MACSERVICES_H__
+
+typedef struct 
+{
+	TI_HANDLE hOS;
+	TI_HANDLE hScanSRV;
+    TI_HANDLE hMeasurementSRV;
+	TI_HANDLE hPowerSrv;
+} MacServices_t ;
+
+#endif /* __MACSERVICES_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/MeasurementSrv.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1085 @@
+/*
+ * MeasurementSrv.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 measurementSrv.c
+ *  \brief This file include the measurement SRV interface functions implementation.
+ *  \author Ronen Kalish
+ *  \date 09-November-2005
+ */
+
+#define __FILE_ID__  FILE_ID_110
+#include "tidef.h"
+#include "MeasurementSrv.h"
+#include "MeasurementSrvSM.h"
+#include "report.h"
+#include "timer.h"
+#include "osApi.h"
+#include "MacServices.h"
+#include "measurementSrvDbgPrint.h"
+#include "eventMbox_api.h"
+#include "CmdBld.h"
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Creates the measurement SRV object
+ *
+ * Function Scope \e Public.\n
+ * \param hOS - handle to the OS object.\n
+ * \return a handle to the measurement SRV object, NULL if an error occurred.\n
+ */
+TI_HANDLE MacServices_measurementSRV_create( TI_HANDLE hOS )
+{
+    measurementSRV_t* pMeasurementSRV;
+
+    /* allocate the measurement SRV object */
+    pMeasurementSRV = os_memoryAlloc( hOS, sizeof(measurementSRV_t),MemoryNormal);
+    if ( NULL == pMeasurementSRV )
+    {
+        WLAN_OS_REPORT( ("ERROR: Failed to create measurement SRV object."));
+        return NULL;
+    }
+    
+    /* nullify the object */
+    os_memoryZero( hOS, pMeasurementSRV, sizeof(measurementSRV_t));
+
+    /* store OS handle */
+    pMeasurementSRV->hOS = hOS;
+
+    /* allocate the SM */
+    if ( TI_OK != fsm_Create( hOS, &(pMeasurementSRV->SM), MSR_SRV_NUM_OF_STATES, MSR_SRV_NUM_OF_EVENTS ))
+    {
+        pMeasurementSRV->SM = NULL;
+        WLAN_OS_REPORT(("Failed to create measurement SRV state machine.\n"));
+        MacServices_measurementSRV_destroy( pMeasurementSRV );
+        return NULL;
+    }
+
+    return (TI_HANDLE)pMeasurementSRV;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Initializes the measurement SRV object
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param hReport - handle to the report object.\n
+ * \param hCmdBld - handle to the Command Builder object.\n
+ * \param hPowerSaveSRV - handle to the power save SRV object.\n
+ */
+TI_STATUS MacServices_measurementSRV_init (TI_HANDLE hMeasurementSRV, 
+                                           TI_HANDLE hReport, 
+                                           TI_HANDLE hCmdBld,
+                                           TI_HANDLE hEventMbox,
+                                           TI_HANDLE hPowerSaveSRV,
+                                           TI_HANDLE hTimer)
+{ 
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TI_INT32 i;
+
+    /* store handles */
+    pMeasurementSRV->hReport = hReport;
+    pMeasurementSRV->hCmdBld = hCmdBld;
+    pMeasurementSRV->hEventMbox = hEventMbox;
+    pMeasurementSRV->hPowerSaveSRV = hPowerSaveSRV;
+    pMeasurementSRV->hTimer = hTimer;
+
+    /* Initialize the state machine */
+    measurementSRVSM_init (hMeasurementSRV);
+
+    /* allocate the module timers */
+    pMeasurementSRV->hStartStopTimer = tmr_CreateTimer (pMeasurementSRV->hTimer);
+	if (pMeasurementSRV->hStartStopTimer == NULL)
+	{
+        TRACE0(pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, "MacServices_measurementSRV_init(): Failed to create hStartStopTimer!\n");
+		return TI_NOK;
+	}
+    pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+
+    for (i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++)
+    {
+        pMeasurementSRV->hRequestTimer[i] = tmr_CreateTimer (pMeasurementSRV->hTimer);
+        if (pMeasurementSRV->hRequestTimer[i] == NULL)
+        {
+            TRACE0(pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, "MacServices_measurementSRV_init(): Failed to create hRequestTimer!\n");
+            return TI_NOK;
+        }
+        pMeasurementSRV->bRequestTimerRunning[i] = TI_FALSE;
+    }
+
+    /* register HAL callbacks */
+    /* Register and Enable the Measure Start event in HAL */
+
+
+	eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox, 
+                               TWD_OWN_EVENT_MEASUREMENT_START,
+                               (void *)MacServices_measurementSRV_measureStartCB, 
+                               hMeasurementSRV);
+    eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_START, NULL, NULL);
+
+    /* Register and Enable the Measurement Complete event in HAL.
+    This event will be received when the Measurement duration expired,
+    or after Stop Measure command. */
+
+	eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox,
+                               TWD_OWN_EVENT_MEASUREMENT_COMPLETE,
+                               (void *)MacServices_measurementSRV_measureCompleteCB,
+                               hMeasurementSRV);
+    eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_COMPLETE, NULL, NULL);
+
+	/* Register and Enable the AP Discovery Complete event in HAL */
+    eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox, 
+                               TWD_OWN_EVENT_AP_DISCOVERY_COMPLETE, 
+                               (void *)MacServices_measurementSRV_apDiscoveryCompleteCB, 
+                               hMeasurementSRV);
+    eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_AP_DISCOVERY_COMPLETE, NULL, NULL);
+
+    TRACE0(hReport, REPORT_SEVERITY_INIT , ".....Measurement SRV configured successfully.\n");
+
+    return TI_OK;
+}
+
+/**
+ * \brief Restart the measurement SRV object upon recovery.
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void measurementSRV_restart( TI_HANDLE hMeasurementSRV)
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TI_INT32 i;
+
+	/* if a timer is running, stop it */
+	if (pMeasurementSRV->bStartStopTimerRunning)
+	{
+		tmr_StopTimer (pMeasurementSRV->hStartStopTimer);
+		pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+	}
+	for (i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++)
+	{
+		if (pMeasurementSRV->bRequestTimerRunning[i])
+		{
+			tmr_StopTimer (pMeasurementSRV->hRequestTimer[i]);
+			pMeasurementSRV->bRequestTimerRunning[i] = TI_FALSE;
+		}
+	}
+
+
+    /* Initialize the state machine */
+	/* initialize current state */
+	pMeasurementSRV->SMState = MSR_SRV_STATE_IDLE;
+
+    /* mark that all timers are not running */
+    pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+    for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
+    {
+        pMeasurementSRV->bRequestTimerRunning[ i ] = TI_FALSE;
+    }
+
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Destroys the measurement SRV object
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_destroy( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_INT32 i;
+
+    /* sanity cehcking */
+    if ( NULL == hMeasurementSRV )
+    {
+        return;
+    }
+
+    /* release state machine */
+    if ( NULL != pMeasurementSRV->SM )
+    {
+        fsm_Unload( pMeasurementSRV->hOS, pMeasurementSRV->SM );
+    }
+
+    /* release timers */
+    for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
+    {
+        if (pMeasurementSRV->hRequestTimer[i])
+        {
+            tmr_DestroyTimer (pMeasurementSRV->hRequestTimer[i]);
+        }
+    }
+    if (pMeasurementSRV->hStartStopTimer)
+    {
+        tmr_DestroyTimer (pMeasurementSRV->hStartStopTimer);
+    }
+
+    /* release object space */
+    os_memoryFree( pMeasurementSRV->hOS, (TI_HANDLE)pMeasurementSRV, sizeof(measurementSRV_t));
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 09-November-2005\n
+ * \brief Starts a measurement operation.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param pMsrRequest - a structure containing measurement parameters.\n
+ * \param timeToRequestexpiryMs - the time (in milliseconds) the measurement SRV has to start the request.\n
+ * \param cmdResponseCBFunc - callback function to used for command response.\n
+ * \param cmdResponseCBObj - handle to pass to command response CB.\n
+ * \param cmdCompleteCBFunc - callback function to be used for command complete.\n
+ * \param cmdCompleteCBObj - handle to pass to command complete CB.\n
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */ 
+TI_STATUS MacServices_measurementSRV_startMeasurement( TI_HANDLE hMacServices, 
+                                                       TMeasurementRequest* pMsrRequest,
+													   TI_UINT32 timeToRequestExpiryMs,
+                                                       TCmdResponseCb cmdResponseCBFunc,
+                                                       TI_HANDLE cmdResponseCBObj,
+                                                       TMeasurementSrvCompleteCb cmdCompleteCBFunc,
+                                                       TI_HANDLE cmdCompleteCBObj )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)((MacServices_t*)hMacServices)->hMeasurementSRV;
+	TI_INT32 i;
+
+#ifdef TI_DBG
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Received measurement request.\n");
+	measurementSRVPrintRequest( (TI_HANDLE)pMeasurementSRV, pMsrRequest );
+TRACE3( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "time to expiry: %d ms, cmd response CB: 0x%x, cmd response handle: 0x%x\n",							  timeToRequestExpiryMs,							  cmdResponseCBFunc,							  cmdResponseCBObj);
+TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "cmd complete CB: 0x%x, cmd complete handle: 0x%x\n",							  cmdCompleteCBFunc,							  cmdCompleteCBObj);
+#endif
+
+	/* mark that request is in progress */
+    pMeasurementSRV->bInRequest = TI_TRUE;
+
+	/* mark to send NULL data when exiting driver mode (can be changed to TI_FALSE
+	   only when explictly stopping the measurement */
+	pMeasurementSRV->bSendNullDataWhenExitPs = TI_TRUE;
+
+    /* Nullify return status */
+    pMeasurementSRV->returnStatus = TI_OK;
+
+    /* copy request parameters */
+    os_memoryCopy (pMeasurementSRV->hOS, 
+                   (void *)&pMeasurementSRV->msrRequest, 
+                   (void *)pMsrRequest, 
+                   sizeof(TMeasurementRequest));
+
+	/* Mark the current time stamp and the duration to start to cehck expiry later */
+	pMeasurementSRV->requestRecptionTimeStampMs = os_timeStampMs( pMeasurementSRV->hOS );
+	pMeasurementSRV->timeToRequestExpiryMs = timeToRequestExpiryMs;
+
+	/* copy callbacks */
+    pMeasurementSRV->commandResponseCBFunc = cmdResponseCBFunc;
+    pMeasurementSRV->commandResponseCBObj = cmdResponseCBObj;
+    pMeasurementSRV->measurmentCompleteCBFunc = cmdCompleteCBFunc;
+    pMeasurementSRV->measurementCompleteCBObj = cmdCompleteCBObj;
+
+	/* initialize reply */
+	pMeasurementSRV->msrReply.numberOfTypes = pMsrRequest->numberOfTypes;
+	for ( i = 0; i < pMsrRequest->numberOfTypes; i++ )
+	{
+		pMeasurementSRV->msrReply.msrTypes[ i ].msrType = pMeasurementSRV->msrRequest.msrTypes[ i ].msrType;
+		pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_OK;
+	}
+
+	/* nullify the pending CBs bitmap */
+	pMeasurementSRV->pendingParamCBs = 0;
+    
+    /* send a start measurement event to the SM */
+    measurementSRVSM_SMEvent( (TI_HANDLE)pMeasurementSRV, &(pMeasurementSRV->SMState), 
+                              MSR_SRV_EVENT_MEASURE_START_REQUEST );
+
+    /* mark that request has been sent */
+    pMeasurementSRV->bInRequest = TI_FALSE;
+
+    return pMeasurementSRV->returnStatus;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 09-November-2005\n
+ * \brief Stops a measurement operation in progress.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param bSendNullData - whether to send NULL data when exiting driver mode.\n
+ * \param cmdResponseCBFunc - callback function to used for command response.\n
+ * \param cmdResponseCBObj - handle to pass to command response CB.\n
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */
+TI_STATUS MacServices_measurementSRV_stopMeasurement( TI_HANDLE hMacServices,
+													  TI_BOOL bSendNullData,
+                                                      TCmdResponseCb cmdResponseCBFunc,
+                                                      TI_HANDLE cmdResponseCBObj )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)((MacServices_t*)hMacServices)->hMeasurementSRV;
+    
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Received measurement stop request.\n");
+TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "Send null data:, cmd response CB: 0x%x, cmd response handle: 0x%x\n",							  cmdResponseCBFunc,							  cmdResponseCBObj);
+
+	/* store callbacks */
+    pMeasurementSRV->commandResponseCBFunc = cmdResponseCBFunc;
+    pMeasurementSRV->commandResponseCBObj = cmdResponseCBObj;
+
+	/* store NULL data indication */
+	pMeasurementSRV->bSendNullDataWhenExitPs = bSendNullData;
+
+    /* mark that current return status is TI_OK */
+    pMeasurementSRV->returnStatus = TI_OK;
+
+	/* mark that a stop request is in progress */
+	pMeasurementSRV->bInRequest = TI_TRUE;
+
+    /* send a stop event to the SM */
+    measurementSRVSM_SMEvent( (TI_HANDLE)pMeasurementSRV, &(pMeasurementSRV->SMState),
+                              MSR_SRV_EVENT_MEASURE_STOP_REQUEST );
+
+	/*mark that stop request has completed */
+	pMeasurementSRV->bInRequest = TI_FALSE;
+
+    return pMeasurementSRV->returnStatus;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 09-November-2005\n
+ * \brief Notifies the measurement SRV of a FW reset (recovery).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ */
+void MacServices_measurementSRV_FWReset( TI_HANDLE hMacServices )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)((MacServices_t*)hMacServices)->hMeasurementSRV;
+    TI_INT32 i;
+
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Received FW reset indication.\n");
+
+	/* if a timer is running, stop it */
+    if (pMeasurementSRV->bStartStopTimerRunning)
+    {
+        tmr_StopTimer (pMeasurementSRV->hStartStopTimer);
+        pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+    }
+    for (i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++)
+    {
+        if (pMeasurementSRV->bRequestTimerRunning[i])
+        {
+            tmr_StopTimer (pMeasurementSRV->hRequestTimer[i]);
+            pMeasurementSRV->bRequestTimerRunning[i] = TI_FALSE;
+        }
+    }
+
+    /* change SM state to idle */
+    pMeasurementSRV->SMState = MSR_SRV_STATE_IDLE;
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 09-November-2005\n
+ * \brief callback function used by the power manager to notify driver mode result
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param PSMode - the power save mode the STA is currently in.\n
+ * \param psStatus - the power save request status.\n
+ */
+void MacServices_measurementSRV_powerSaveCB( TI_HANDLE hMeasurementSRV, TI_UINT8 PSMode, TI_UINT8 psStatus )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Power save SRV CB called. PS mode:%d status: %d\n", PSMode, psStatus);
+
+	/* if driver mode entry succeedded */
+    if ( ENTER_POWER_SAVE_SUCCESS == psStatus )
+    {
+        TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": PS successful.\n");
+
+        /* send a RIVER_MODE_SUCCESS event */
+        measurementSRVSM_SMEvent( (TI_HANDLE)pMeasurementSRV, &(pMeasurementSRV->SMState), 
+                                  MSR_SRV_EVENT_DRIVER_MODE_SUCCESS );
+    }
+    /* driver mode entry failed */
+    else
+    {
+        TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": PS failed, status %d.\n", psStatus);
+
+        /* Set the return status to TI_NOK */
+        pMeasurementSRV->returnStatus = (TI_STATUS)psStatus;
+
+        /* send a DRIVER_MODE_FAILURE event */
+        measurementSRVSM_SMEvent( (TI_HANDLE)pMeasurementSRV, &(pMeasurementSRV->SMState), 
+								  MSR_SRV_EVENT_DRIVER_MODE_FAILURE );
+    }
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 14-November-2005\n
+ * \brief callback function used by the HAL for measure start event (sent when the FW 
+ * has started measurement operation, i.e. switched channel and changed RX filters).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_measureStartCB( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t *pMeasurementSRV  = (measurementSRV_t*)hMeasurementSRV;
+
+    TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": measure start CB called.\n");
+
+	/* stop the FW guard timer */
+    tmr_StopTimer (pMeasurementSRV->hStartStopTimer);
+	pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+
+	/* clear the CB function, so that it won't be called on stop as well! */
+	pMeasurementSRV->commandResponseCBFunc = NULL;
+	pMeasurementSRV->commandResponseCBObj = NULL;
+
+    measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), 
+							  MSR_SRV_EVENT_START_SUCCESS );
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 14-November-2005\n
+ * \brief callback function used by the HAL for measure stop event (sent when the FW 
+ * has finished measurement operation, i.e. switched channel to serving channel and changed back RX filters).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_measureCompleteCB( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+    TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": measure complete CB called.\n");
+
+	/* stop the FW guard timer */
+    tmr_StopTimer (pMeasurementSRV->hStartStopTimer);
+	pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+
+    measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), 
+							  MSR_SRV_EVENT_STOP_COMPLETE );
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 14-November-2005\n
+ * \brief callback function used by the HAL for AP discovery stop event (sent when the FW 
+ * has finished AP discovery operation).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_apDiscoveryCompleteCB( TI_HANDLE hMeasurementSRV )
+{
+#ifdef TI_DBG
+    measurementSRV_t *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+    TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": AP Discovery complete CB called.\n");
+#endif /* TI_DBG */
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 14-November-2005\n
+ * \brief called when a measurement FW guard timer expires.
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasuremntSRV - handle to the measurement SRV object.\n
+ * \param bTwdInitOccured -   Indicates if TWDriver recovery occured since timer started.\n
+ */
+void MacServices_measurementSRV_startStopTimerExpired (TI_HANDLE hMeasurementSRV, TI_BOOL bTwdInitOccured)
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_INT32 i;
+
+    TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": FW guard timer expired.\n");
+
+    /* mark that the FW guard timer is not running */
+    pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+
+    /* if any other timer is running - stop it */
+    for (i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++)
+    {
+        if (pMeasurementSRV->bRequestTimerRunning[i])
+        {
+            tmr_StopTimer (pMeasurementSRV->hRequestTimer[i]);
+            pMeasurementSRV->bRequestTimerRunning[i] = TI_FALSE;
+        }
+    }
+
+    /* change SM state to idle */
+    pMeasurementSRV->SMState = MSR_SRV_STATE_IDLE;
+
+	/*Error Reporting - call the centeral error function in the health monitor if a request for measurement was faield*/
+	pMeasurementSRV->failureEventFunc(pMeasurementSRV->failureEventObj ,MEASUREMENT_FAILURE);
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief called when a measurement type timer expires.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasuremntSRV - handle to the measurement SRV object.\n
+ * \param bTwdInitOccured -   Indicates if TWDriver recovery occured since timer started.\n
+ */
+void MacServices_measurementSRV_requestTimerExpired (TI_HANDLE hMeasurementSRV, TI_BOOL bTwdInitOccured)
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_INT32 requestIndex;
+
+	/* find the expired measurement type */
+    requestIndex = measurementSRVFindMinDuration( hMeasurementSRV );
+	if ( -1 == requestIndex )
+	{
+		/* indicates we can't find the request in the requets array. Shouldn't happen, but nothing to do */
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Request timer expired and request index from findMinDuration is -1?!?");
+		return;
+	}
+
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": request timer expired, request index: %d.\n", requestIndex);
+
+	/* mark that the timer is not running and that this request has completed */
+    pMeasurementSRV->bRequestTimerRunning[ requestIndex ] = TI_FALSE;
+
+    /* collect results and send stop command if necessary */
+    switch (pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].msrType)
+    {
+    case MSR_TYPE_BEACON_MEASUREMENT:
+        measurementSRVHandleBeaconMsrComplete( hMeasurementSRV, requestIndex );
+        break;
+
+    case MSR_TYPE_CCA_LOAD_MEASUREMENT:
+        measurementSRVHandleChannelLoadComplete( hMeasurementSRV, requestIndex );
+        break;
+
+    case MSR_TYPE_NOISE_HISTOGRAM_MEASUREMENT:
+        measurementSRVHandleNoiseHistogramComplete( hMeasurementSRV, requestIndex );
+        break;
+
+	/* used here to avoid compilation warning only, does nothing */
+	case MSR_TYPE_BASIC_MEASUREMENT:
+	case MSR_TYPE_FRAME_MEASUREMENT:
+	case MSR_TYPE_MAX_NUM_OF_MEASURE_TYPES:
+	default:
+TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": measure type %d not supported for request %d\n", 							pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].msrType,							requestIndex);
+		break;
+    }
+
+	/* if no measurement are running and no CBs are pending, send ALL TYPES COMPLETE event */
+	if ( TI_TRUE == measurementSRVIsMeasurementComplete( hMeasurementSRV ))
+	{
+		/* send the event */
+		measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), 
+								  MSR_SRV_EVENT_ALL_TYPES_COMPLETE );
+	}
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 13-November-2005\n
+ * \brief Checks whether a beacon measurement is part of current measurement request
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \return TI_TRUE if a beacon measurement is part of current request, TI_FALSE otherwise.\n
+ */
+TI_BOOL measurementSRVIsBeaconMeasureIncluded( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_INT32 i;
+
+    for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
+    {
+        if ( MSR_TYPE_BEACON_MEASUREMENT == pMeasurementSRV->msrRequest.msrTypes[ i ].msrType )
+        {
+            return TI_TRUE;
+        }
+    }
+    return TI_FALSE;
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief Finds the index for the measurement request with the shortest period 
+ * (the one that has now completed).\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \return index of the measurement request with the shortest duration.\n
+ */
+TI_INT32 measurementSRVFindMinDuration( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_INT32 i, minIndex;
+	TI_UINT32 minValue;
+
+
+    minIndex = minValue = 0; /* minIndex is initialized only to avoid compilation warning! */
+
+    /* find the index with the minimum duration */
+    for ( i = 0; i < pMeasurementSRV->msrRequest.numberOfTypes; i++ )
+    {
+        if ( TI_TRUE == pMeasurementSRV->bRequestTimerRunning[ i ] )
+        {
+			if ( (0 == minValue) ||
+				 (pMeasurementSRV->msrRequest.msrTypes[ i ].duration < minValue))
+			{
+				minValue = pMeasurementSRV->msrRequest.msrTypes[ i ].duration;
+				minIndex = i;
+			}
+        }
+    }
+
+    /* if no entry with positive duration exists, return -1 */
+    if ( 0 == minValue )
+    {
+        return -1;
+    }
+    else
+    { /* otherwise, return the index of the type with the shortest duration */
+        return minIndex;
+    }
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief Handles an AP discovery timer expiry, by setting necessary values in the
+ * reply struct.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param requestIndex - index of the beacon request in the request structure.\n
+ */
+void measurementSRVHandleBeaconMsrComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex )
+{
+	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TI_INT32 status;
+
+
+TRACE0(pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Sending AP Discovery Stop to the HAL...");
+
+	/* send stop AP discovery command */
+	status = cmdBld_CmdApDiscoveryStop (pMeasurementSRV->hCmdBld, NULL, NULL);
+	if ( TI_OK != status )
+	{
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": status %d received from cmdBld_CmdApDiscoveryStop\n", status);
+	}
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief Handles a channel load timer expiry, by requesting channel load 
+ * results from the FW.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param requestIndex - index of the channel load request in the request structure.\n
+ */
+void measurementSRVHandleChannelLoadComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex )
+{
+	measurementSRV_t*		pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TTwdParamInfo			tTwdParam;
+	TI_STATUS               status;
+
+    /* Getting the Medium Occupancy Register */
+	tTwdParam.paramType = TWD_MEDIUM_OCCUPANCY_PARAM_ID;
+    tTwdParam.content.interogateCmdCBParams.fCb = (void *)MacServices_measurementSRV_channelLoadParamCB;
+    tTwdParam.content.interogateCmdCBParams.hCb = hMeasurementSRV;
+    tTwdParam.content.interogateCmdCBParams.pCb = (TI_UINT8*)(&(pMeasurementSRV->mediumOccupancyResults));
+	status = cmdBld_GetParam (pMeasurementSRV->hCmdBld, &tTwdParam);
+
+	if ( status != TI_OK )
+    {
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": whalCtrl_GetParam returned status %d\n", status);
+
+		/* mark that the specific measurment type has failed */
+		pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK;
+
+		/* if all measurement types has finished, an event will be send by request timer expired */
+    }
+    else
+    {
+		/* mark that channel load param CB is pending */
+		pMeasurementSRV->pendingParamCBs |= MSR_SRV_WAITING_CHANNEL_LOAD_RESULTS;
+	}
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief Handles a noise histogram timer expiry, by requesting noise histogram
+ * reaults from the FW.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param requestIndex - index of the beacon request in the request structure.\n
+ */
+void measurementSRVHandleNoiseHistogramComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex )
+{
+    measurementSRV_t		    *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TTwdParamInfo	            tTwdParam;
+    TNoiseHistogram             pNoiseHistParams;
+	TI_STATUS	                status;
+	
+    /* Set Noise Histogram Cmd Params */
+    pNoiseHistParams.cmd = STOP_NOISE_HIST;
+    pNoiseHistParams.sampleInterval = 0;
+    os_memoryZero( pMeasurementSRV->hOS, &(pNoiseHistParams.ranges[0]), MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES );
+    
+    /* Send a Stop command to the FW */
+    status = cmdBld_CmdNoiseHistogram (pMeasurementSRV->hCmdBld, &pNoiseHistParams, NULL, NULL);
+    
+    if ( TI_OK != status )
+	{
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": whalCtrl_NoiseHistogramCmd returned status %d\n", status);
+
+		/* mark that the specific measurment type has failed */
+		pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK;
+
+		/* if all measurement types has finished, an event will be send by request timer expired */
+	}
+
+   	/* Get measurement results */
+	tTwdParam.paramType = TWD_NOISE_HISTOGRAM_PARAM_ID;
+    tTwdParam.content.interogateCmdCBParams.fCb = (void *)MacServices_measurementSRV_noiseHistCallBack;
+    tTwdParam.content.interogateCmdCBParams.hCb = hMeasurementSRV;
+    tTwdParam.content.interogateCmdCBParams.pCb = (TI_UINT8*)&pMeasurementSRV->noiseHistogramResults;
+	status = cmdBld_GetParam (pMeasurementSRV->hCmdBld, &tTwdParam);
+
+    if ( TI_OK == status )
+    {
+		/* setting On the Waitng for Noise Histogram Results Bit */
+		pMeasurementSRV->pendingParamCBs |= MSR_SRV_WAITING_NOISE_HIST_RESULTS;
+
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": sent noise histogram stop command.\n");
+	}
+    else
+    {
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": whalCtrl_GetParam returned status %d\n", status);
+
+		/* mark that the specific measurment type has failed */
+		pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK;
+
+		/* if all measurement types has finished, an event will be send by request timer expired */
+    }
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 16-November-2005\n
+ * \brief Callback for channel load get param call.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param status - the get_param call status.\n
+ * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
+ */
+void MacServices_measurementSRV_channelLoadParamCB( TI_HANDLE hMeasurementSRV, TI_STATUS status, 
+													TI_UINT8* CB_buf )
+{
+    measurementSRV_t	    *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_UINT32                  mediumUsageInMs, periodInMs;
+	TI_INT32 					requestIndex;
+
+	/* when this CB is called as a result of the nulify call at the measurement beginning,
+	   the handle will be NULL. In this case, nothing needs to be done. */
+	if ( NULL == hMeasurementSRV )
+	{
+		return;
+	}
+
+    TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Channel load CB called, status:%d\n", status);
+    TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "result address (reported): 0x%x, result address (assumed): 0x%x, results (reported):\n",CB_buf, &(pMeasurementSRV->mediumOccupancyResults));
+    TRACE_INFO_HEX(pMeasurementSRV->hReport, CB_buf, sizeof(TMediumOccupancy));
+
+	/* setting Off the Waitng for Channel Load Results Bit */
+	pMeasurementSRV->pendingParamCBs &= ~MSR_SRV_WAITING_CHANNEL_LOAD_RESULTS;
+
+	/* find the request index */
+	requestIndex = measurementSRVFindIndexByType( hMeasurementSRV, MSR_TYPE_CCA_LOAD_MEASUREMENT );
+	if ( -1 == requestIndex )
+	{
+		/* indicates we can't find the request in the requets array. Shouldn't happen, but nothing to do */
+        TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": request index from measurementSRVFindIndexByType is -1?!?");
+		return;
+	}
+
+	if ( (TI_OK == status) && (0 != pMeasurementSRV->mediumOccupancyResults.Period))
+	{		
+		/* calculate results */
+		mediumUsageInMs = pMeasurementSRV->mediumOccupancyResults.MediumUsage / 1000;
+		periodInMs      = pMeasurementSRV->mediumOccupancyResults.Period / 1000;
+
+        TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": MediumUsage = %d Period = %d\n",mediumUsageInMs, periodInMs);
+		
+		if ( periodInMs <= pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].duration )
+		{
+			pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.CCABusyFraction = 
+				( 255 * pMeasurementSRV->mediumOccupancyResults.MediumUsage ) / 
+					pMeasurementSRV->mediumOccupancyResults.Period;
+		}
+		else
+		{       
+			pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.CCABusyFraction = 
+				( 255 * pMeasurementSRV->mediumOccupancyResults.MediumUsage ) / 
+					(pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].duration * 1000);
+		}		
+	}
+	else
+	{
+        TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": channel load failed. Status=%d, period=%d\n",							status,							pMeasurementSRV->mediumOccupancyResults.Period);
+
+		/* mark result status */
+		pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK;
+	}
+	
+	/* if no measurement are running and no CBs are pending, 
+	   send ALL TYPES COMPLETE event */
+	if ( TI_TRUE == measurementSRVIsMeasurementComplete( hMeasurementSRV ))
+	{
+		/* send the event */
+		measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), 
+								  MSR_SRV_EVENT_ALL_TYPES_COMPLETE );
+	}
+}
+
+/** 
+ * \date 03-January-2005\n
+ * \brief Dummy callback for channel load get param call. Used to clear the channel load tracker.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param status - the get_param call status.\n
+ * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
+ */
+void MacServices_measurementSRV_dummyChannelLoadParamCB( TI_HANDLE hMeasurementSRV, TI_STATUS status, 
+													TI_UINT8* CB_buf )
+{
+#ifdef TI_DBG
+    measurementSRV_t *pMeasurementSRV = (measurementSRV_t*) hMeasurementSRV;
+
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Dummy Channel Load callback called (status = %d)\n", status);
+#endif /* TI_DBG */
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 16-November-2005\n
+ * \brief Callback for noise histogram get param call.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param status - the get_param call status.\n
+ * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
+ */
+void MacServices_measurementSRV_noiseHistCallBack( TI_HANDLE hMeasurementSRV, TI_STATUS status, 
+												   TI_UINT8* CB_buf )
+{
+    measurementSRV_t		    *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TI_UINT8		                index;
+    TI_UINT32                      sumOfSamples;
+    TI_INT32							requestIndex;
+
+    TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": noise histogram CB called, status: %d\n", status);
+    TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "result address (reported): 0x%x, result address (assumed): 0x%x, results (reported):\n",							  CB_buf, &(pMeasurementSRV->noiseHistogramResults));
+    TRACE_INFO_HEX( pMeasurementSRV->hReport, CB_buf, sizeof(TNoiseHistogramResults));
+
+	/* setting Off the Waitng for noise histogram Results Bit */
+	pMeasurementSRV->pendingParamCBs &= ~MSR_SRV_WAITING_NOISE_HIST_RESULTS;
+
+	/* find the request index */
+	requestIndex = measurementSRVFindIndexByType( hMeasurementSRV, MSR_TYPE_NOISE_HISTOGRAM_MEASUREMENT );
+	if ( -1 == requestIndex )
+	{
+		/* indicates we can't find the request in the requets array. Shouldn't happen, but nothing to do */
+        TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": request index from measurementSRVFindIndexByType is -1?!?");
+		return;
+	}
+
+	if ( TI_OK == status )
+	{
+		sumOfSamples = pMeasurementSRV->noiseHistogramResults.numOfLostCycles;
+		
+		/* Print For Debug */
+TRACE4( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": numOfLostCycles = %d numOfTxHwGenLostCycles = %d numOfRxLostCycles = %d numOfExceedLastThresholdLostCycles = %d\n",			pMeasurementSRV->noiseHistogramResults.numOfLostCycles, 			pMeasurementSRV->noiseHistogramResults.numOfTxHwGenLostCycles,			pMeasurementSRV->noiseHistogramResults.numOfRxLostCycles,			pMeasurementSRV->noiseHistogramResults.numOfLostCycles - 			 (pMeasurementSRV->noiseHistogramResults.numOfTxHwGenLostCycles + 			  pMeasurementSRV->noiseHistogramResults.numOfRxLostCycles));
+		
+		for ( index = 0; index < NUM_OF_NOISE_HISTOGRAM_COUNTERS; index++ )
+		{
+			sumOfSamples += pMeasurementSRV->noiseHistogramResults.counters[ index ];
+			
+			/* Print For Debug */
+TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Counter #%d = %x\n", index, pMeasurementSRV->noiseHistogramResults.counters[index]);
+		}
+		
+		/* If there weren't enough samples --> Reject the Request */
+		if ( (sumOfSamples - pMeasurementSRV->noiseHistogramResults.numOfLostCycles) < 
+				NOISE_HISTOGRAM_THRESHOLD )
+		{
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_WARNING, ": noise histogram CB, rejecting request because %d samples received.\n",								  sumOfSamples - pMeasurementSRV->noiseHistogramResults.numOfLostCycles);
+
+			/* set negative result status */
+			pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK;
+		}
+		else
+		{   
+ 			for (index = 0; index < NUM_OF_NOISE_HISTOGRAM_COUNTERS; index++)
+			{
+				pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ index ] = 
+					( 255 * pMeasurementSRV->noiseHistogramResults.counters[ index ]) / sumOfSamples;
+			}
+
+TRACE8( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Valid noise histogram reply. RPIDensity: %d %d %d %d %d %d %d %d\n",									  pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 0 ],									  pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 1 ],									  pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 2 ],									  pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 3 ],									  pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 4 ],									  pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 5 ],									  pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 6 ],									  pMeasurementSRV->msrReply.msrTypes[ requestIndex ].replyValue.RPIDensity[ 7 ]);
+		}
+	}
+	else
+	{
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_WARNING, ": noise histogram CB with status: %d, rejecting request.\n", status);
+		/* set negative result status */
+		pMeasurementSRV->msrReply.msrTypes[ requestIndex ].status = TI_NOK;
+	}
+	
+	/* if no measurement are running and no CBs are pending, 
+	   send ALL TYPES COMPLETE event */
+	if ( TI_TRUE == measurementSRVIsMeasurementComplete( hMeasurementSRV ))
+	{
+		/* send the event */
+		measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), 
+								  MSR_SRV_EVENT_ALL_TYPES_COMPLETE );
+	}
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 16-November-2005\n
+ * \brief Checks whether all measuremtn types had completed and all param CBs had been called.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param status - the get_param call status.\n
+ * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
+ */
+TI_BOOL measurementSRVIsMeasurementComplete( TI_HANDLE hMeasurementSRV )
+{
+	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TI_INT32 i;
+
+	/* verify that no request is currently running */
+	for ( i = 0; i < pMeasurementSRV->msrRequest.numberOfTypes; i++ )
+	{
+		if ( TI_TRUE == pMeasurementSRV->bRequestTimerRunning[ i ] )
+		{
+			return TI_FALSE;
+		}
+	}
+
+	/* verify that no CBs are pending */
+	if ( 0 != (pMeasurementSRV->pendingParamCBs & 
+			   (MSR_SRV_WAITING_CHANNEL_LOAD_RESULTS | MSR_SRV_WAITING_NOISE_HIST_RESULTS)))
+	{
+		return TI_FALSE;
+	}
+
+	return TI_TRUE;
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 17-November-2005\n
+ * \brief Finds a measure type index in the measure request array.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param type - the measure type to look for.\n
+ * \return the type index, -1 if not found.\n
+ */
+TI_INT32 measurementSRVFindIndexByType( TI_HANDLE hMeasurementSRV, EMeasurementType type )
+{
+	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TI_INT32 i;
+
+	for ( i = 0; i < pMeasurementSRV->msrRequest.numberOfTypes; i++ )
+	{
+		if ( type == pMeasurementSRV->msrRequest.msrTypes[ i ].msrType )
+		{
+			return i;
+		}
+	}
+	return -1;
+}
+
+
+
+/****************************************************************************************
+ *                        measurementSRVRegisterFailureEventCB													*
+ ****************************************************************************************
+DESCRIPTION: Registers a failure event callback for scan error notifications.
+			    
+				                                                                                                   
+INPUT:     	- hMeasurementSRV	- handle to the Measurement SRV object.		
+			- failureEventCB 		- the failure event callback function.\n
+			- hFailureEventObj 	- handle to the object passed to the failure event callback function.
+
+OUTPUT:	
+RETURN:    void.
+****************************************************************************************/
+
+void measurementSRVRegisterFailureEventCB( TI_HANDLE hMeasurementSRV, 
+                                     void * failureEventCB, TI_HANDLE hFailureEventObj )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+    pMeasurementSRV->failureEventFunc	= (TFailureEventCb)failureEventCB;
+    pMeasurementSRV->failureEventObj	= hFailureEventObj;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/MeasurementSrv.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,332 @@
+/*
+ * MeasurementSrv.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 MeasurementSrv.h
+ *  \brief This file include private definitions for the Measurement SRV module.
+ *  \author Ronen Kalish
+ *  \date 08-November-2005
+ */
+
+#ifndef __MEASUREMENT_SRV_H__
+#define __MEASUREMENT_SRV_H__
+
+#include "TWDriverInternal.h"
+#include "MacServices_api.h"
+#include "fsm.h"
+#include "MeasurementSrvSM.h"
+
+/*
+ ***********************************************************************
+ *  Constant definitions.
+ ***********************************************************************
+ */
+/* Time in milliseconds to receive a command complete for measure start / stop from the FW */
+#define MSR_FW_GUARD_TIME   100 
+#define DEF_SAMPLE_INTERVAL             (100)   /* expressed in microsec */
+#define NOISE_HISTOGRAM_THRESHOLD           100
+/* Get param callback flags  */
+#define MSR_SRV_WAITING_CHANNEL_LOAD_RESULTS        0x01 /* channel load results are still pending */
+#define MSR_SRV_WAITING_NOISE_HIST_RESULTS          0x02 /* noise histogram results are still pending */
+
+/*
+ ***********************************************************************
+ *  Enums.
+ ***********************************************************************
+ */
+
+
+/*
+ ***********************************************************************
+ *  Typedefs.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *  Structure definitions.
+ ***********************************************************************
+ */
+
+/** \struct measurementSRV_t
+ * \brief This structure contains the measurement SRV object data
+ */
+typedef struct
+{
+    TMediumOccupancy            mediumOccupancyResults; /**< channel load results buffer */
+    TNoiseHistogramResults      noiseHistogramResults;  /**< noise histogram results buffer */
+
+    /* module handles */
+    TI_HANDLE           hOS;                            /**< OS object handle */
+    TI_HANDLE           hReport;                        /**< report object handle */
+    TI_HANDLE           hPowerSaveSRV;                  /**< power save SRV object handle */
+    TI_HANDLE           hCmdBld;                        /**< Command Builder object handle */
+    TI_HANDLE           hEventMbox;                     /**< Event Mbox handle */
+    TI_HANDLE           hTimer    ;                     /**< Timer Module handle */
+    /* CB functions and objects */                                                        
+    TMeasurementSrvCompleteCb measurmentCompleteCBFunc;
+                                                        /**< 
+                                                         * upper layer (measurement manager) measurement complete 
+                                                         * callback function
+                                                         */
+    TI_HANDLE           measurementCompleteCBObj;       /**< 
+                                                         * upper layer (measurement manager) measurement complete
+                                                         * callback object
+                                                         */
+    
+    TCmdResponseCb      commandResponseCBFunc;          /**<
+                                                         * upper layer command response CB, used for both start
+                                                         * and stop. Passed down to the HAL and called when 
+                                                         * the measurement command has been received by the FW
+                                                         */
+    TI_HANDLE           commandResponseCBObj;           /**<
+                                                         * object parameter passed to the commandResposeFunc by 
+                                                         * the HAL when it is called 
+                                                         */
+
+    TFailureEventCb     failureEventFunc;   /**<
+                                            * upper layer Failure Event CB.
+                                            * called when the scan command has been Timer Expiry
+                                            */
+    TI_HANDLE           failureEventObj;        /**<
+                                            * object parameter passed to the failureEventFunc
+                                            * when it is called 
+                                            */
+    /* Timers */
+    TI_HANDLE           hRequestTimer[ MAX_NUM_OF_MSR_TYPES_IN_PARALLEL ];
+                                                        /**< Timers for different measurement types */
+    TI_BOOL             bRequestTimerRunning[ MAX_NUM_OF_MSR_TYPES_IN_PARALLEL ];
+                                                        /**< Indicates whether each request timer is running */
+    TI_HANDLE           hStartStopTimer;                /**< Timer for start / stop commands guard */
+    TI_BOOL             bStartStopTimerRunning;         /**< 
+                                                         * Indicates whether the start / stop command guard
+                                                         * timer is running
+                                                         */
+    /* Misc stuff */
+    TI_BOOL             bInRequest;                     /**<
+                                                         * Indicates whether the SM is run within
+                                                         * the measurement request context (if so, to avoid
+                                                         * re-entrance, the complete function shouldn't
+                                                         * be called on failure, but rather an invalid
+                                                         * status should be returned)
+                                                         */
+    TI_STATUS           returnStatus;                   /**< 
+                                                         * Holds the return code to the upper layer
+                                                         * Used to save errors during SM operation.
+                                                         */
+    TI_BOOL             bSendNullDataWhenExitPs;        /**< whether to send NULL data frame when exiting
+                                                         * driver mode
+                                                         */
+    /* state machine */
+    fsm_stateMachine_t* SM;                            /**< 
+                                                         * state machines for different
+                                                         * scan types
+                                                         */
+    measurements_SRVSMStates_e  SMState;                /**< state machine current states */
+    /* measurement request */
+    TMeasurementRequest     msrRequest;                 /**< measurement request parameters */
+    TMeasurementReply       msrReply;                   /**< measurement reply values */
+    TI_UINT32               requestRecptionTimeStampMs; /**< The time in which the request was received. */
+    TI_UINT32               timeToRequestExpiryMs;      /**<
+                                                         * The duration (in ms) from request receiption
+                                                         * until it should actually start. Request is
+                                                         * discarded if a longer period is required
+                                                         */
+    TI_UINT8                pendingParamCBs;            /**<
+                                                         * a bitmap indicating which get_param CBs are
+                                                         * currently pending (noise histogram and/or
+                                                         * channel load).
+                                                         */
+} measurementSRV_t;
+
+/*
+ ***********************************************************************
+ *  External data definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *  External functions definitions
+ ***********************************************************************
+ */
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Creates the measurement SRV object
+ *
+ * Function Scope \e Public.\n
+ * \param hOS - handle to the OS object.\n
+ * \return a handle to the measurement SRV object, NULL if an error occurred.\n
+ */
+TI_HANDLE MacServices_measurementSRV_create( TI_HANDLE hOS );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Initializes the measurement SRV object
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param hReport - handle to the report object.\n
+ * \param hCmdBld - handle to the Command Builder object.\n
+ * \param hEventMbox - handle to the Event Mbox object.\n
+ * \param hPowerSaveSRV - handle to the power save SRV object.\n
+ * \param hTimer - handle to the Timer module object.\n
+ */
+TI_STATUS MacServices_measurementSRV_init (TI_HANDLE hMeasurementSRV, 
+                                           TI_HANDLE hReport, 
+                                           TI_HANDLE hCmdBld,
+                                           TI_HANDLE hEventMbox,
+                                           TI_HANDLE hPowerSaveSRV,
+                                           TI_HANDLE hTimer);
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Destroys the measurement SRV object
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ */
+void MacServices_measurementSRV_destroy( TI_HANDLE hMeasurementSRV );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 13-November-2005\n
+ * \brief Checks whether a beacon measurement is part of current measurement request
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \return TI_TRUE if a beacon measurement is part of current request, TI_FALSE otherwise.\n
+ */
+TI_BOOL measurementSRVIsBeaconMeasureIncluded( TI_HANDLE hMeasurementSRV );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief Finds the index for the measurement request with the shortest period 
+ * (the one that has now completed).\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \return index of the measurement request with the shortest duration.\n
+ */
+TI_INT32 measurementSRVFindMinDuration( TI_HANDLE hMeasurementSRV );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief Handles an AP discovery timer expiry, by setting necessary values in the
+ * reply struct.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param requestIndex - index of the beacon request in the request structure.\n
+ */
+void measurementSRVHandleBeaconMsrComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief Handles a channel load timer expiry, by requesting channel load 
+ * results from the FW.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param requestIndex - index of the channel load request in the request structure.\n
+ */
+void measurementSRVHandleChannelLoadComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 15-November-2005\n
+ * \brief Handles a nois histogram timer expiry, by requesting noise histogram
+ * reaults from the FW.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param requestIndex - indexof the beacon request in the request structure.\n
+ */
+void measurementSRVHandleNoiseHistogramComplete( TI_HANDLE hMeasurementSRV, TI_INT32 requestIndex );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 16-November-2005\n
+ * \brief Checks whether all measuremtn types had completed and all param CBs had been called.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param status - the get_param call status.\n
+ * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
+ */
+TI_BOOL measurementSRVIsMeasurementComplete( TI_HANDLE hMeasurementSRV );
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 17-November-2005\n
+ * \brief Finds a measure type index in the measure request array.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param type - the measure type to look for.\n
+ * \return the type index, -1 if not found.\n
+ */
+TI_INT32 measurementSRVFindIndexByType( TI_HANDLE hMeasurementSRV, EMeasurementType type );
+
+/****************************************************************************************
+ *                        measurementSRVRegisterFailureEventCB                                                  *
+ ****************************************************************************************
+DESCRIPTION: Registers a failure event callback for scan error notifications.
+                
+                                                                                                                   
+INPUT:      - hMeasurementSRV   - handle to the Measurement SRV object.     
+            - failureEventCB        - the failure event callback function.\n
+            - hFailureEventObj  - handle to the object passed to the failure event callback function.
+
+OUTPUT: 
+RETURN:    void.
+****************************************************************************************/
+void measurementSRVRegisterFailureEventCB( TI_HANDLE hMeasurementSRV, 
+                                     void * failureEventCB, TI_HANDLE hFailureEventObj );
+
+void measurementSRV_restart( TI_HANDLE hMeasurementSRV);
+
+
+#endif /* __MEASUREMENT_SRV_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/MeasurementSrvSM.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1068 @@
+/*
+ * MeasurementSrvSM.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 measurementSrv.c
+ *  \brief This file include the measurement SRV state machine implementation.
+ *  \author Ronen Kalish
+ *  \date 13-November-2005
+ */
+
+#define __FILE_ID__  FILE_ID_112
+#include "osApi.h"
+#include "report.h"
+#include "MeasurementSrvSM.h"
+#include "MeasurementSrv.h"
+#include "PowerSrv_API.h"
+#include "timer.h"
+#include "fsm.h"
+#include "TWDriverInternal.h"
+#include "CmdBld.h"
+
+
+TI_STATUS actionUnexpected( TI_HANDLE hMeasurementSrv );
+TI_STATUS actionNop( TI_HANDLE hMeasurementSrv );
+static void measurementSRVSM_requestMeasureStartResponseCB(TI_HANDLE hMeasurementSRV, TI_UINT16 uMboxStatus);
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Initialize the measurement SRV SM.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS measurementSRVSM_init( TI_HANDLE hMeasurementSRV )
+{
+   measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+    fsm_actionCell_t    smMatrix[ MSR_SRV_NUM_OF_STATES ][ MSR_SRV_NUM_OF_EVENTS ] =
+    {
+        /* next state and actions for IDLE state */
+        {   
+            {MSR_SRV_STATE_WAIT_FOR_DRIVER_MODE, measurementSRVSM_requestDriverMode},     /*"MESSURE_START_REQUEST"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"DRIVER_MODE_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"DRIVER_MODE_FAILURE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"START_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"START_FAILURE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"ALL_TYPES_COMPLETE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"STOP_COMPLETE"*/
+            {MSR_SRV_STATE_IDLE, measurementSRVSRVSM_dummyStop}                           /*"MEASURE_STOP_REQUEST"*/
+        },
+
+
+        /* next state and actions for WAIT_FOR_DRIVER_MODE state */
+        {   
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"MESSURE_START_REQUEST"*/
+            {MSR_SRV_STATE_WAIT_FOR_MEASURE_START, measurementSRVSM_requestMeasureStart}, /*"DRIVER_MODE_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, measurementSRVSM_DriverModeFailure},                     /*"DRIVER_MODE_FAILURE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"START_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"START_FAILURE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"ALL_TYPES_COMPLETE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"STOP_COMPLETE"*/
+            {MSR_SRV_STATE_IDLE, measurementSRVSM_stopFromWaitForDriverMode}              /*"MEASURE_STOP_REQUEST"*/
+        },
+
+        /* next state and actions for WAIT_FOR_MEASURE_START state */
+        {    
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"MESSURE_START_REQUEST"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"DRIVER_MODE_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"DRIVER_MODE_FAILURE"*/
+            {MSR_SRV_STATE_MEASURE_IN_PROGRESS, measurementSRVSM_startMeasureTypes},      /*"START_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, measurementSRVSM_measureStartFailure},                   /*"START_FAILURE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"ALL_TYPES_COMPLETE"*/
+            {MSR_SRV_STATE_IDLE, measurementSRVSM_completeMeasure},                       /*"STOP_COMPLETE"*/
+            {MSR_SRV_STATE_WAIT_FOR_MEASURE_STOP, measurementSRVSM_stopFromWaitForMeasureStart}
+                                                                                          /*"MEASURE_STOP_REQUEST"*/
+        },
+
+        /* next state and actions for MEASURE_IN_PROGRESS state */
+        {   
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"MESSURE_START_REQUEST"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"DRIVER_MODE_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"DRIVER_MODE_FAILURE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"START_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"START_FAILURE"*/
+            {MSR_SRV_STATE_WAIT_FOR_MEASURE_STOP, measurementSRVSM_requestMeasureStop},   /*"ALL_TYPES_COMPLETE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"STOP_COMPLETE"*/
+            {MSR_SRV_STATE_WAIT_FOR_MEASURE_STOP, measurementSRVSM_stopFromMeasureInProgress}
+                                                                                          /*"MEASURE_STOP_REQUEST"*/
+        },
+
+        /* next state and actions for WAIT_FOR_MEASURE_STOP state */
+        {   
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"MESSURE_START_REQUEST"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"DRIVER_MODE_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"DRIVER_MODE_FAILURE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"START_SUCCESS"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"START_FAILURE"*/
+            {MSR_SRV_STATE_IDLE, actionUnexpected},                                       /*"ALL_TYPES_COMPLETE"*/
+            {MSR_SRV_STATE_IDLE, measurementSRVSM_completeMeasure},                       /*"STOP_COMPLETE"*/
+            {MSR_SRV_STATE_WAIT_FOR_MEASURE_STOP, measurementSRVSRVSM_dummyStop}          /*"MEASURE_STOP_REQUEST"*/
+        }
+    };
+
+    /* initialize current state */
+    pMeasurementSRV->SMState = MSR_SRV_STATE_IDLE;
+
+    /* configure the state machine */
+    return fsm_Config( pMeasurementSRV->SM, (fsm_Matrix_t)smMatrix, 
+                       (TI_UINT8)MSR_SRV_NUM_OF_STATES, (TI_UINT8)MSR_SRV_NUM_OF_EVENTS, 
+                       (fsm_eventActivation_t)measurementSRVSM_SMEvent, pMeasurementSRV->hOS );
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Processes an event.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the measurement SRV object.\n
+ * \param currentState - the current scan SRV SM state.\n
+ * \param event - the event to handle.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS measurementSRVSM_SMEvent( TI_HANDLE hMeasurementSrv, measurements_SRVSMStates_e* currentState, 
+                                    measurement_SRVSMEvents_e event )
+{
+    measurementSRV_t *pMeasurementSRV = (measurementSRV_t *)hMeasurementSrv;
+    TI_STATUS status = TI_OK;
+    TI_UINT8 nextState;
+
+    /* obtain the next state */
+    status = fsm_GetNextState( pMeasurementSRV->SM, (TI_UINT8)*currentState, (TI_UINT8)event, &nextState );
+    if ( status != TI_OK )
+    {
+        TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "measurementSRVSM_SMEvent: State machine error, failed getting next state\n");
+        return TI_NOK;
+    }
+
+    /* report the move */
+	TRACE3( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "measurementSRVSM_SMEvent: <currentState = %d, event = %d> --> nextState = %d\n", currentState, event, nextState);
+
+    /* move */
+    return fsm_Event( pMeasurementSRV->SM, (TI_UINT8*)currentState, (TI_UINT8)event, hMeasurementSrv );
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a MEASURE_START_REQUEST event by requesting driver mode.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_requestDriverMode( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t    *pMeasurementSRV  = (measurementSRV_t*)hMeasurementSRV;
+    TI_STATUS           PSStatus;
+    TTwdParamInfo       paramInfo;
+
+    /* get the current channel */
+    paramInfo.paramType = TWD_CURRENT_CHANNEL_PARAM_ID;
+    cmdBld_GetParam (pMeasurementSRV->hCmdBld, &paramInfo);
+    
+    /* check if the request is on the serving channel */
+    if ( paramInfo.content.halCtrlCurrentChannel == pMeasurementSRV->msrRequest.channel )
+    {
+        /* Switch Power Save SRV to driver mode w/o changing power save mode*/
+        PSStatus = powerSrv_ReservePS( pMeasurementSRV->hPowerSaveSRV, POWER_SAVE_KEEP_CURRENT,
+                                       TI_TRUE, hMeasurementSRV, MacServices_measurementSRV_powerSaveCB );
+    }
+    else
+    {
+        /* Switch Power Save SRV to driver mode with PS mode */      
+        PSStatus = powerSrv_ReservePS( pMeasurementSRV->hPowerSaveSRV, POWER_SAVE_ON,
+                                       TI_TRUE, hMeasurementSRV, MacServices_measurementSRV_powerSaveCB );
+    }
+
+    switch (PSStatus)
+    {
+        case POWER_SAVE_802_11_IS_CURRENT:
+            TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Driver mode entered successfully\n");
+            /* send a power save success event */
+            return measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState),
+                                             MSR_SRV_EVENT_DRIVER_MODE_SUCCESS );
+    
+        case POWER_SAVE_802_11_PENDING:
+        case TI_OK:
+            TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Driver mode pending\n");
+            break;
+        
+        default: /* Error */
+            TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Error %d when requesting driver mode\n",PSStatus);
+
+            /* Set the return status to TI_NOK */
+            pMeasurementSRV->returnStatus = PSStatus;
+
+            /* send a power save failure event */
+            measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState),
+                                      MSR_SRV_EVENT_DRIVER_MODE_FAILURE );
+            break;
+    }
+    
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a DRIVER_MODE_SUCCESS event by sending start measure command to the FW.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_requestMeasureStart( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t     *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TMeasurementParams    pMeasurementCmd;
+    TI_STATUS             status;
+    TI_UINT32                currentTime = os_timeStampMs( pMeasurementSRV->hOS );
+
+    /* check if request time has expired (note: timer wrap-around is also handled)*/
+    if ( (pMeasurementSRV->requestRecptionTimeStampMs + pMeasurementSRV->timeToRequestExpiryMs)
+                    < currentTime )
+    {
+        TI_INT32 i;
+
+        TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": request time has expired, request expiry time:%d, current time:%d\n", pMeasurementSRV->requestRecptionTimeStampMs + pMeasurementSRV->timeToRequestExpiryMs, currentTime);
+
+        /* mark that all measurement types has failed */
+        for ( i = 0; i < pMeasurementSRV->msrRequest.numberOfTypes; i++ )
+        {
+            pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
+        }
+
+        /* send a measurement complete event */
+        measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState),
+                                  MSR_SRV_EVENT_STOP_COMPLETE );
+        
+        return TI_OK;
+    }
+
+    pMeasurementCmd.channel = pMeasurementSRV->msrRequest.channel;
+    pMeasurementCmd.band = pMeasurementSRV->msrRequest.band;
+    pMeasurementCmd.duration = 0; /* Infinite */
+    pMeasurementCmd.eTag = pMeasurementSRV->msrRequest.eTag;
+
+    if ( measurementSRVIsBeaconMeasureIncluded( hMeasurementSRV ))
+    {  /* Beacon Measurement is one of the types */
+
+		/* get the current channel */
+		TTwdParamInfo	paramInfo;
+
+		paramInfo.paramType = TWD_CURRENT_CHANNEL_PARAM_ID;
+		cmdBld_GetParam (pMeasurementSRV->hCmdBld, &paramInfo);
+
+		pMeasurementCmd.ConfigOptions = RX_CONFIG_OPTION_FOR_MEASUREMENT; 
+
+		/* check if the request is on the serving channel */
+		if ( paramInfo.content.halCtrlCurrentChannel == pMeasurementSRV->msrRequest.channel )
+		{
+			/* Set the RX Filter to the join one, so that any packets will 
+            be received on the serving channel - beacons and probe requests for
+			the measurmenet, and also data (for normal operation) */
+            pMeasurementCmd.FilterOptions = RX_FILTER_OPTION_JOIN;
+		}
+		else
+		{
+			/* not on the serving channle - only beacons and rpobe responses are required */
+			pMeasurementCmd.FilterOptions = RX_FILTER_OPTION_DEF_PRSP_BCN; 
+		}
+    }
+    else
+    {  /* No beacon measurement - use the current RX Filter */
+        pMeasurementCmd.ConfigOptions = 0xffffffff;
+        pMeasurementCmd.FilterOptions = 0xffffffff;
+    }
+
+    /* Send start measurement command */
+    status = cmdBld_CmdMeasurement (pMeasurementSRV->hCmdBld,
+                                    &pMeasurementCmd,
+                                    (void *)measurementSRVSM_requestMeasureStartResponseCB, 
+                                    pMeasurementSRV);
+    
+    if ( TI_OK != status )
+    {
+        TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Failed to send measurement start command, statud=%d,\n", status);
+
+        /* keep the faulty return status */
+        pMeasurementSRV->returnStatus = status;
+
+        /* send a measurement start fail event */
+        return measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState),
+                                         MSR_SRV_EVENT_START_FAILURE );
+    }
+
+    TRACE6( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": measure start command sent. Params:\n channel=%d, band=%d, duration=%d, \n configOptions=0x%x, filterOptions=0x%x, status=%d, \n", pMeasurementCmd.channel, pMeasurementCmd.band, pMeasurementCmd.duration, pMeasurementCmd.ConfigOptions, pMeasurementCmd.FilterOptions, status);
+
+    /* start the FW guard timer */
+    pMeasurementSRV->bStartStopTimerRunning = TI_TRUE;
+    tmr_StartTimer (pMeasurementSRV->hStartStopTimer,
+                    MacServices_measurementSRV_startStopTimerExpired,
+                    (TI_HANDLE)pMeasurementSRV,
+                    MSR_FW_GUARD_TIME,
+                    TI_FALSE);
+  
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a START_SUCCESS event by starting different measure types and setting timers.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_startMeasureTypes( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t      *pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_UINT8                 requestIndex, rangeIndex;
+    TI_INT8                  rangeUpperBound;
+    TTwdParamInfo         tTwdParam;
+    TI_STATUS             status;
+    TNoiseHistogram       pNoiseHistParams;
+    TApDiscoveryParams    pApDiscoveryParams;
+    TI_UINT32                currentTime = os_timeStampMs( pMeasurementSRV->hOS );
+
+    /* check if request time has expired (note: timer wrap-around is also handled)*/
+    if ( (pMeasurementSRV->requestRecptionTimeStampMs + pMeasurementSRV->timeToRequestExpiryMs)
+                    < currentTime )
+    {
+        TI_INT32 i;
+
+        TRACE2( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": request time has expired, request expiry time:%d, current time:%d\n", pMeasurementSRV->requestRecptionTimeStampMs + pMeasurementSRV->timeToRequestExpiryMs, currentTime);
+
+        /* mark that all measurement types has failed */
+        for ( i = 0; i < pMeasurementSRV->msrRequest.numberOfTypes; i++ )
+        {
+            pMeasurementSRV->msrReply.msrTypes[ i ].status = MSR_REJECT_MAX_DELAY_PASSED;
+        }
+
+        /* send a measurement complete event */
+        measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState),
+                                  MSR_SRV_EVENT_ALL_TYPES_COMPLETE );
+        
+        return TI_OK;
+    }
+
+    /* Going over all request types that should be executed in parallel 
+    to start their timers and execute the measurement */
+    for ( requestIndex = 0; requestIndex < pMeasurementSRV->msrRequest.numberOfTypes ; requestIndex++ )
+    {
+        switch (pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].msrType)
+        {
+        case MSR_TYPE_CCA_LOAD_MEASUREMENT:    
+            /* Clearing the Medium Occupancy Register */
+            tTwdParam.paramType = TWD_MEDIUM_OCCUPANCY_PARAM_ID;
+            tTwdParam.content.interogateCmdCBParams.fCb = (void *)MacServices_measurementSRV_dummyChannelLoadParamCB;
+            tTwdParam.content.interogateCmdCBParams.hCb = hMeasurementSRV;
+            tTwdParam.content.interogateCmdCBParams.pCb = 
+                    (TI_UINT8*)&pMeasurementSRV->mediumOccupancyResults;
+            status = cmdBld_GetParam (pMeasurementSRV->hCmdBld, &tTwdParam);
+            if( TI_OK == status  )
+            {
+                TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Medium Usage has been nullified, starting timer.\n");
+
+                /* Start Timer */
+                tmr_StartTimer (pMeasurementSRV->hRequestTimer[requestIndex],
+                                MacServices_measurementSRV_requestTimerExpired,
+                                (TI_HANDLE)pMeasurementSRV,
+                                pMeasurementSRV->msrRequest.msrTypes[requestIndex].duration, 
+                                TI_FALSE);
+                pMeasurementSRV->bRequestTimerRunning[requestIndex] = TI_TRUE;
+            }
+            else
+            {
+                TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": TWD_GetParam (for channel load) returned status %d\n", status);
+            }
+
+            break;
+        
+        case MSR_TYPE_NOISE_HISTOGRAM_MEASUREMENT:
+            /* Set Noise Histogram Cmd Params */
+            pNoiseHistParams.cmd = START_NOISE_HIST;
+            pNoiseHistParams.sampleInterval = DEF_SAMPLE_INTERVAL;
+            os_memoryZero( pMeasurementSRV->hOS, &(pNoiseHistParams.ranges[0]), MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES );
+        
+            /* Set Ranges */
+            /* (-87) - First Range's Upper Bound */
+            rangeUpperBound = -87;
+
+            /* Previously we converted from RxLevel to dBm - now this isn't necessary */
+            /* rangeUpperBound = TWD_convertRSSIToRxLevel( pMeasurementSRV->hTWD, -87); */
+
+            for(rangeIndex = 0; rangeIndex < MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES -1; rangeIndex++)
+            {
+                if(rangeUpperBound > 0)
+                {
+                    pNoiseHistParams.ranges[rangeIndex] = 0;
+                }
+                else
+                {               
+                    pNoiseHistParams.ranges[rangeIndex] = rangeUpperBound;
+                }         
+                rangeUpperBound += 5; 
+            }
+            pNoiseHistParams.ranges[rangeIndex] = 0xFE;
+
+            /* Print for Debug */
+            TRACE8(pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ":Noise histogram Measurement Ranges:\n%d %d %d %d %d %d %d %d\n", (TI_INT8) pNoiseHistParams.ranges[0], (TI_INT8) pNoiseHistParams.ranges[1], (TI_INT8) pNoiseHistParams.ranges[2], (TI_INT8) pNoiseHistParams.ranges[3], (TI_INT8) pNoiseHistParams.ranges[4], (TI_INT8) pNoiseHistParams.ranges[5], (TI_INT8) pNoiseHistParams.ranges[6], (TI_INT8) pNoiseHistParams.ranges[7]);
+
+            /* Send a Start command to the FW */
+            status = cmdBld_CmdNoiseHistogram (pMeasurementSRV->hCmdBld, &pNoiseHistParams, NULL, NULL);
+
+            if ( TI_OK == status )
+            {
+                /* Print for Debug */
+                TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Sent noise histogram command. Starting timer\n");
+
+                /* Start Timer */
+                tmr_StartTimer (pMeasurementSRV->hRequestTimer[requestIndex],
+                                MacServices_measurementSRV_requestTimerExpired,
+                                (TI_HANDLE)pMeasurementSRV,
+                                pMeasurementSRV->msrRequest.msrTypes[requestIndex].duration, 
+                                TI_FALSE);
+                pMeasurementSRV->bRequestTimerRunning[requestIndex] = TI_TRUE;
+            }
+            else
+            {
+                TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": TWD_NoiseHistogramCmd returned status %d\n", status);
+            }
+            break;
+        
+        case MSR_TYPE_BEACON_MEASUREMENT:
+            /* set all parameters in the AP discovery command */
+            pApDiscoveryParams.scanDuration = pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].duration * 1000; 
+            pApDiscoveryParams.numOfProbRqst = 1;
+            pApDiscoveryParams.txdRateSet = HW_BIT_RATE_1MBPS;
+            pApDiscoveryParams.ConfigOptions = RX_CONFIG_OPTION_FOR_MEASUREMENT;
+            pApDiscoveryParams.FilterOptions = RX_FILTER_OPTION_DEF_PRSP_BCN;
+            pApDiscoveryParams.txPowerDbm = pMeasurementSRV->msrRequest.txPowerDbm;
+            pApDiscoveryParams.scanOptions = SCAN_ACTIVE; /* both scan type and band are 0 for active and */
+                                                          /* 2.4 GHz, respectively, but 2.4 is not defined */
+
+            /* band determined at the initiate measurement command not at that structure */
+
+            /* scan mode go into the scan option field */
+            if ( MSR_SCAN_MODE_PASSIVE == pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].scanMode )
+            {
+                pApDiscoveryParams.scanOptions |= SCAN_PASSIVE;
+            }
+
+            /* Send AP Discovery command */
+            status = cmdBld_CmdApDiscovery (pMeasurementSRV->hCmdBld, &pApDiscoveryParams, NULL, NULL);
+
+            if ( TI_OK == status )
+            {
+                TRACE7( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": AP discovery command sent. Params:\n scanDuration=%d, scanOptions=%d, numOfProbRqst=%d, txdRateSet=%d, txPowerDbm=%d, configOptions=%d, filterOptions=%d\n Starting timer...\n", pApDiscoveryParams.scanDuration, pApDiscoveryParams.scanOptions, pApDiscoveryParams.numOfProbRqst, pApDiscoveryParams.txdRateSet, pApDiscoveryParams.txPowerDbm, pApDiscoveryParams.ConfigOptions, pApDiscoveryParams.FilterOptions);
+        
+                /* Start Timer */
+                tmr_StartTimer (pMeasurementSRV->hRequestTimer[requestIndex],
+                                MacServices_measurementSRV_requestTimerExpired,
+                                (TI_HANDLE)pMeasurementSRV,
+                                pMeasurementSRV->msrRequest.msrTypes[requestIndex].duration, 
+                                TI_FALSE);
+                pMeasurementSRV->bRequestTimerRunning[ requestIndex ] = TI_TRUE;
+            }
+            else
+            {
+                TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": TWD_ApDiscoveryCmd returned status %d\n", status);
+            }
+            break;
+
+        case MSR_TYPE_BASIC_MEASUREMENT: /* not supported in current implemntation */
+        case MSR_TYPE_FRAME_MEASUREMENT: /* not supported in current implemntation */
+        default:
+            TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Measurement type %d is not supported\n", pMeasurementSRV->msrRequest.msrTypes[ requestIndex ].msrType);
+            break;
+        }        
+    }
+
+    /* if no measurement types are running, sen al types complete event.
+       This can happen if all types failed to start */
+    if ( TI_TRUE == measurementSRVIsMeasurementComplete( hMeasurementSRV ))
+    {
+        /* send the event */
+        measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), 
+                                  MSR_SRV_EVENT_ALL_TYPES_COMPLETE );
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle an ALL_TYPE_COMPLETE event by sending a stop measure command to the FW.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_requestMeasureStop( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_STATUS status;
+
+    /* since this function may also be called when stop is requested and start complete event
+       has not yet been received from the FW, we may need to stop the FW guard timer */
+    if (pMeasurementSRV->bStartStopTimerRunning)
+    {
+		tmr_StopTimer (pMeasurementSRV->hStartStopTimer);
+        pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+    }
+
+    /* Send Measurement Stop command to the FW */
+    status = cmdBld_CmdMeasurementStop (pMeasurementSRV->hCmdBld, 
+                                        (void *)pMeasurementSRV->commandResponseCBFunc,
+                                        pMeasurementSRV->commandResponseCBObj);
+
+    pMeasurementSRV->commandResponseCBFunc = NULL;
+    pMeasurementSRV->commandResponseCBObj = NULL;
+    
+    if ( TI_OK != status )
+    {
+        TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Failed to send measurement stop command, statud=%d,\n", status);
+
+        /* send a measurement complete event - since it can't be stopped */
+        measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState), MSR_SRV_EVENT_STOP_COMPLETE );
+        return TI_OK;
+    }
+
+    TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": measure stop command sent.\n");
+
+    /* start the FW guard timer */
+    pMeasurementSRV->bStartStopTimerRunning = TI_TRUE;
+    tmr_StartTimer (pMeasurementSRV->hStartStopTimer,
+                    MacServices_measurementSRV_startStopTimerExpired,
+                    (TI_HANDLE)pMeasurementSRV,
+                    MSR_FW_GUARD_TIME,
+                    TI_FALSE);
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a STOP_COMPLETE event by exiting driver mode and calling the complete CB.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_completeMeasure( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t *pMeasurementSRV = (measurementSRV_t *)hMeasurementSRV;
+
+    /* Switch Power Save SRV back to user mode */
+    powerSrv_ReleasePS( pMeasurementSRV->hPowerSaveSRV, pMeasurementSRV->bSendNullDataWhenExitPs, NULL, NULL );
+
+    /* if the response CB is still pending, call it (when requestExpiryTimeStamp was reached) */
+    if ( NULL != pMeasurementSRV->commandResponseCBFunc )
+    {
+        pMeasurementSRV->commandResponseCBFunc( pMeasurementSRV->commandResponseCBObj, TI_OK );
+    }
+
+    /* call the complete CB */
+    if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
+    {
+        pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj, 
+                                                   &(pMeasurementSRV->msrReply));
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE state by exiting driver mode.
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_stopFromWaitForDriverMode( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+    /* Switch Power Save SRV back to user mode */
+    powerSrv_ReleasePS( pMeasurementSRV->hPowerSaveSRV, pMeasurementSRV->bSendNullDataWhenExitPs, NULL, NULL );
+
+    /* if we are not running within a stop request context (shouldn't happen), call the CBs */
+    if ( TI_FALSE == pMeasurementSRV->bInRequest )
+    {
+        TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": stop from wait for driver mode: not within a request context?!? \n");
+
+        /* call the response CB - this shouldn't happen, as only GWSI has response CB, and it shouldn't call
+           stop before driver */
+        if ( NULL != pMeasurementSRV->commandResponseCBFunc )
+        {
+            TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": stop from wait for driver mode: command response CB is not NULL?!? \n");
+            pMeasurementSRV->commandResponseCBFunc( pMeasurementSRV->commandResponseCBObj, TI_OK );
+
+            pMeasurementSRV->commandResponseCBFunc = NULL;
+            pMeasurementSRV->commandResponseCBObj = NULL;
+        }
+        /* call the complete CB */
+        if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
+        {
+            /* mark that all types has failed */
+            TI_INT32 i;
+            for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
+            {
+                pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
+            }
+            /* call the complete CB */
+            pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj, 
+                                                       &(pMeasurementSRV->msrReply));
+        }
+        else
+        {
+            TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": stop from wait for driver mode and response CB is NULL!!!\n");
+        }
+    }
+    /* we are within a stop request context */
+    else
+    {
+        /* if the command response Cb is valid, send a measure stop command to the FW - 
+           although it is not necessary, we need it to get a different context for the command response.
+           This shouldn't happen, as only GWSI has command response, and it shouldn't call stop measure
+           before it got the commadn response for start measure */
+        if ( NULL != pMeasurementSRV->commandResponseCBFunc )
+        {
+            /* shouldn't happen - a command response is valid (GWSI) and stop measure called 
+               before measure start response was received (driver) */
+            TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": stop from wait for driver mode - within request context and command response is not NULL?!?\n");
+
+            cmdBld_CmdMeasurementStop (pMeasurementSRV->hCmdBld, 
+                                       (void *)pMeasurementSRV->commandResponseCBFunc,
+                                       pMeasurementSRV->commandResponseCBObj);
+
+            pMeasurementSRV->commandResponseCBFunc = NULL;
+            pMeasurementSRV->commandResponseCBObj = NULL;
+        }
+        if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
+        {
+            /* Note: this is being called from request context, but there's npthing else that can be done */
+            /* mark that all types has failed */
+            TI_INT32 i;
+            for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
+            {
+                pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
+            }
+            /* call the complete CB */
+            pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj, 
+                                                       &(pMeasurementSRV->msrReply));
+        }
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 27-November-2005\n
+ * \brief handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE by marking negative result status
+ * \brief and calling the ordinary stop function
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_stopFromWaitForMeasureStart( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TI_INT32 i;
+
+    /* mark that all types has failed */
+    for ( i = 0; i < pMeasurementSRV->msrRequest.numberOfTypes; i++ )
+    {
+        pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
+    }
+
+    /* call the ordinary stop function (will send a measure stop command to FW) */
+    measurementSRVSM_requestMeasureStop( hMeasurementSRV );
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief handle a STOP_REQUEST event when in MEASURE_IN_PROGRESS by stopping all measure types and
+ * \brief requesting measure stop from the FW.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_stopFromMeasureInProgress( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+    TNoiseHistogram   pNoiseHistParams;
+    TI_STATUS         status;
+    TI_INT32          i;
+
+    /* stop all running measure types */
+    for (i = 0; i < pMeasurementSRV->msrRequest.numberOfTypes; i++)
+    {
+        if (pMeasurementSRV->bRequestTimerRunning[i])
+        {
+            /* stop timer */
+			tmr_StopTimer (pMeasurementSRV->hRequestTimer[i]);
+            pMeasurementSRV->bRequestTimerRunning[i] = TI_FALSE;
+
+            /* if necessary, stop measurement type */
+            switch ( pMeasurementSRV->msrRequest.msrTypes[ i ].msrType )
+            {
+            case MSR_TYPE_BEACON_MEASUREMENT:
+                /* send stop AP discovery command */
+                status = cmdBld_CmdApDiscoveryStop (pMeasurementSRV->hCmdBld, NULL, NULL);
+                if ( TI_OK != status )
+                {
+                    TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": TWD_ApDiscoveryStop returned status %d\n", status);
+                }
+                break;
+
+            case MSR_TYPE_NOISE_HISTOGRAM_MEASUREMENT:
+                /* Set Noise Histogram Cmd Params */
+                pNoiseHistParams.cmd = STOP_NOISE_HIST;
+                pNoiseHistParams.sampleInterval = 0;
+                os_memoryZero( pMeasurementSRV->hOS, &(pNoiseHistParams.ranges[ 0 ]), MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES );
+
+                /* Send a Stop command to the FW */
+                status = cmdBld_CmdNoiseHistogram (pMeasurementSRV->hCmdBld, &pNoiseHistParams, NULL, NULL);
+
+                if ( TI_OK != status )
+                {
+                    TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": TWD_NoiseHistogramCmd returned status %d\n", status);
+                }
+                break;
+
+            /* These are just to avoid compilation warnings, nothing is actualy done here! */
+            case MSR_TYPE_BASIC_MEASUREMENT:
+            case MSR_TYPE_CCA_LOAD_MEASUREMENT:
+            case MSR_TYPE_FRAME_MEASUREMENT:
+            case MSR_TYPE_MAX_NUM_OF_MEASURE_TYPES:
+            default:
+                TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": unsupported measurement type: %d\n", pMeasurementSRV->msrRequest.msrTypes[ i ].msrType);
+                break;
+            }
+
+            /* mark that measurement has failed */
+            pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
+        }
+    }
+
+    /* Send Measurement Stop command to the FW */
+    status = cmdBld_CmdMeasurementStop (pMeasurementSRV->hCmdBld,
+                                        (void *)pMeasurementSRV->commandResponseCBFunc,
+                                        pMeasurementSRV->commandResponseCBObj);
+
+    pMeasurementSRV->commandResponseCBFunc = NULL;
+    pMeasurementSRV->commandResponseCBObj = NULL;
+    
+    if ( TI_OK != status )
+    {
+        TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Failed to send measurement stop command, statud=%d,\n", status);
+
+        /* send a measurement complete event - since it can't be stopped */
+        measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState),
+                                  MSR_SRV_EVENT_STOP_COMPLETE );
+        return TI_OK;
+    }
+
+    TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": measure stop command sent.\n");
+
+    /* start the FW guard timer */
+    pMeasurementSRV->bStartStopTimerRunning = TI_TRUE;
+    tmr_StartTimer (pMeasurementSRV->hStartStopTimer,
+                    MacServices_measurementSRV_startStopTimerExpired,
+                    (TI_HANDLE)pMeasurementSRV,
+                    MSR_FW_GUARD_TIME,
+                    TI_FALSE);
+
+    return TI_OK; 
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief handle a DRIVER_MODE_FAILURE event by calling the response and complete CBs.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_DriverModeFailure( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+    /* this function can be called from within a request (when the power save SRV returned an immediate error),
+       or in a different context, when power save entry failed. The latter is a valid status, whereas the former
+       indicates a severe error. However, as there is nothing to do with the former (other than debug it), the same
+       failure indication is used for both of them, which will make the upper layer (Palau driver or TI measurement
+       manager) to return to idle state. Still, for the former the error is returned as the return status from the
+       measurement start API call whereas for the latter the error is indicated both by the command response and
+       measurement complete CBs status */
+
+    /* if we are running within a request context, don't call the CBs! The startMeasurement function
+       will return an invalid status instead */
+    if ( TI_FALSE == pMeasurementSRV->bInRequest )
+    {
+        /* if a response CB is available (GWSI) call it */
+        if ( NULL != pMeasurementSRV->commandResponseCBFunc )
+        {
+            pMeasurementSRV->commandResponseCBFunc( pMeasurementSRV->commandResponseCBObj, TI_NOK );
+        }
+
+        /* if a complete CB is available (both GWSI and TI driver), call it */
+        if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
+        {
+            /* mark that all types has failed */
+            TI_INT32 i;
+            for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
+            {
+                pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
+            }
+            /* call the complete CB */
+            pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj, 
+                                                       &(pMeasurementSRV->msrReply));
+        }
+        else
+        {
+            TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": driver mode failure and complete CB is NULL!!!\n");
+        }
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief handle a START_FAILURE event by exiting driver mode and calling the complete CB.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_measureStartFailure( TI_HANDLE hMeasurementSRV )
+{
+    measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+    /* This function can be called from within a request context (if the driver mode entry process
+       was immediate), or from the driver mode CB context. Regardless of teh context in which it runs,
+       The error indicates that something is wrong in the HAL. There is no way to solve this (other than debug it).
+       The error is either indicating by the measurement start API return status (if still in the request context),
+       or by calling the response (if available, only in GWSI) and complete CBs with invalid status */
+
+    /* Switch Power save SRV back to user mode */
+    powerSrv_ReleasePS( pMeasurementSRV->hPowerSaveSRV, pMeasurementSRV->bSendNullDataWhenExitPs, NULL, NULL );
+
+    /* if we are running within a request context, don't call the CB! The startMeasurement function
+       will return an invalid status instead */
+    if ( TI_FALSE == pMeasurementSRV->bInRequest )
+    {
+        /* if a response CB is available (GWSI) call it */
+        if ( NULL != pMeasurementSRV->commandResponseCBFunc )
+        {
+            pMeasurementSRV->commandResponseCBFunc( pMeasurementSRV->commandResponseCBObj, TI_NOK );
+        }
+
+        /* if a complete CB is available (both GWSI and TI driver), call it */
+        if ( NULL != pMeasurementSRV->measurmentCompleteCBFunc )
+        {
+            /* mark that all types has failed */
+            TI_INT32 i;
+            for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
+            {
+                pMeasurementSRV->msrReply.msrTypes[ i ].status = TI_NOK;
+            }
+            /* call the complete CB */
+            pMeasurementSRV->measurmentCompleteCBFunc( pMeasurementSRV->measurementCompleteCBObj, 
+                                                       &(pMeasurementSRV->msrReply));
+        }
+        else
+        {
+            TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_ERROR, ": Start measurement failure and response and complete CBs are NULL!!!\n");
+        }
+    }
+
+    return TI_OK;
+}
+
+
+static void measurementSRVSM_requestMeasureStartResponseCB(TI_HANDLE hMeasurementSRV, TI_UINT16 uMboxStatus)
+{
+	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TI_INT32 i;
+
+TRACE1( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": FW has responded with CMD_STATUS = %d\n", uMboxStatus);
+
+	if (uMboxStatus == TI_OK) 
+	{
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": FW has responded with CMD_STATUS_SUCCESS!\n");
+
+		if ( NULL != pMeasurementSRV->commandResponseCBFunc )
+        {
+            pMeasurementSRV->commandResponseCBFunc( pMeasurementSRV->commandResponseCBObj, TI_OK );
+        }
+	}
+	else
+	{
+		if (uMboxStatus == SG_REJECT_MEAS_SG_ACTIVE) 
+		{
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": FW has responded with CMD_STATUS_REJECT_MEAS_SG_ACTIVE!\n");
+		}
+
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, ": FW has responded with CMD_STATUS NOK!!!\n");
+
+
+		/* if a timer is running, stop it */
+		if ( TI_TRUE == pMeasurementSRV->bStartStopTimerRunning )
+		{
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "***** STOP TIMER 8 *****\n");
+			tmr_StopTimer( pMeasurementSRV->hStartStopTimer );
+			pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+		}
+		for ( i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++ )
+		{
+			if ( TI_TRUE == pMeasurementSRV->bRequestTimerRunning[ i ] )
+			{
+				tmr_StopTimer( pMeasurementSRV->hRequestTimer[ i ] );
+				pMeasurementSRV->bRequestTimerRunning[ i ] = TI_FALSE;
+			}
+		}
+		
+		measurementSRVSM_SMEvent( hMeasurementSRV, &(pMeasurementSRV->SMState),
+											 MSR_SRV_EVENT_START_FAILURE );
+	}
+}
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 23-December-2005\n
+ * \brief Handles a stop request when no stop is needed (SM is either idle or already send stop command to FW.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSrv - handle to the measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSRVSM_dummyStop( TI_HANDLE hMeasurementSrv )
+{
+    measurementSRV_t *pMeasurementSRV = (measurementSRV_t*)hMeasurementSrv;
+
+    TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_WARNING, ": sending unnecessary stop measurement command to FW...\n");
+
+    /* send a stop command to FW, to obtain a different context in ehich to cal the command response CB */
+    cmdBld_CmdMeasurementStop (pMeasurementSRV->hCmdBld, 
+                               (void *)pMeasurementSRV->commandResponseCBFunc,
+                               pMeasurementSRV->commandResponseCBObj);
+
+    pMeasurementSRV->commandResponseCBFunc = NULL;
+    pMeasurementSRV->commandResponseCBObj = NULL;
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 17-November-2005\n
+ * \brief Handles an unexpected event.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSrv - handle to the measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS actionUnexpected( TI_HANDLE hMeasurementSrv ) 
+{
+    measurementSRV_t *pMeasurementSRV = (measurementSRV_t*)hMeasurementSrv;
+    TI_INT32 i;
+
+    TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_SM, ": measurement SRV state machine error, unexpected Event\n");
+
+    if (pMeasurementSRV->bStartStopTimerRunning)
+    {
+		tmr_StopTimer (pMeasurementSRV->hStartStopTimer);
+        pMeasurementSRV->bStartStopTimerRunning = TI_FALSE;
+    }
+
+    for (i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++)
+    {
+        if (pMeasurementSRV->bRequestTimerRunning[i])
+        {
+			tmr_StopTimer (pMeasurementSRV->hRequestTimer[i]);
+            pMeasurementSRV->bRequestTimerRunning[i] = TI_FALSE;
+        }
+    }
+
+    /* we must clean the old command response CB since they are no longer relevant 
+      since the state machine may be corrupted */
+    pMeasurementSRV->commandResponseCBFunc = NULL;
+    pMeasurementSRV->commandResponseCBObj = NULL;
+
+    /* indicate the unexpected event in the return status */
+    pMeasurementSRV->returnStatus = TI_NOK;
+    
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Handles an event that doesn't require any action.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSrv - handle to the measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS actionNop( TI_HANDLE hMeasurementSrv )
+{   
+    return TI_OK;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/MeasurementSrvSM.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,266 @@
+/*
+ * MeasurementSrvSM.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 MeasurementSrv.h
+ *  \brief This file include private definitions for the Measurement SRV state machine.
+ *  \author Ronen Kalish
+ *  \date 08-November-2005
+ */
+
+#ifndef __MEASUREMENT_SRV_SM_H__
+#define __MEASUREMENT_SRV_SM_H__
+
+
+/*
+ ***********************************************************************
+ *	Constant definitions.
+ ***********************************************************************
+ */
+
+
+/*
+ ***********************************************************************
+ *	Enums.
+ ***********************************************************************
+ */
+
+/** \enum measurement_SRVSMEvents_e
+ * \brief enumerates the different measurement SRV state machine events.
+ */
+typedef enum
+{
+    MSR_SRV_EVENT_MEASURE_START_REQUEST       = 0,
+    MSR_SRV_EVENT_DRIVER_MODE_SUCCESS,
+    MSR_SRV_EVENT_DRIVER_MODE_FAILURE,
+    MSR_SRV_EVENT_START_SUCCESS,
+    MSR_SRV_EVENT_START_FAILURE,
+    MSR_SRV_EVENT_ALL_TYPES_COMPLETE,
+    MSR_SRV_EVENT_STOP_COMPLETE,
+    MSR_SRV_EVENT_MEASURE_STOP_REQUEST,
+    MSR_SRV_NUM_OF_EVENTS
+} measurement_SRVSMEvents_e;
+
+/** \enum measurement_SRVSMStates_e
+ * \brief enumerates the different measurement SRV state machine states.
+ */
+typedef enum
+{
+    MSR_SRV_STATE_IDLE                      =0,
+    MSR_SRV_STATE_WAIT_FOR_DRIVER_MODE,
+    MSR_SRV_STATE_WAIT_FOR_MEASURE_START,
+    MSR_SRV_STATE_MEASURE_IN_PROGRESS,
+    MSR_SRV_STATE_WAIT_FOR_MEASURE_STOP,
+    MSR_SRV_NUM_OF_STATES
+} measurements_SRVSMStates_e;
+
+
+/*
+ ***********************************************************************
+ *	Typedefs.
+ ***********************************************************************
+ */
+
+
+/*
+ ***********************************************************************
+ *	Structure definitions.
+ ***********************************************************************
+*/
+
+/*
+ ***********************************************************************
+ *	External data definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	External functions definitions
+ ***********************************************************************
+ */
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Initialize the measurement SRV SM.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS measurementSRVSM_init( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Processes an event.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the measurement SRV object.\n
+ * \param currentState - the current scan SRV SM state.\n
+ * \param event - the event to handle.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS measurementSRVSM_SMEvent( TI_HANDLE hMeasurementSrv, measurements_SRVSMStates_e* currentState, 
+                                    measurement_SRVSMEvents_e event );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a MEASURE_START_REQUEST event by requesting driver mode.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_requestDriverMode( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a DRIVER_MODE_SUCCESS event by sending start measure command to the FW.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_requestMeasureStart( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a START_SUCCESS event by starting different measure types and setting timers.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_startMeasureTypes( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle an ALL_TYPE_COMPLETE event by sending a stop measure command to the FW.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_requestMeasureStop( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a STOP_COMPLETE event by exiting driver mode and calling the complete CB.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_completeMeasure( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief Handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE state by exiting driver mode.
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_stopFromWaitForDriverMode( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 27-November-2005\n
+ * \brief handle a STOP_REQUEST event when in WAIT_FOR_DRIVER_MODE by marking negative result status
+ * \brief and callin the ordinary stop function
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_stopFromWaitForMeasureStart( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief handle a STOP_REQUEST event when in MEASURE_IN_PROGRESS by stopping all measure types and
+ * \brief requesting measure stop from the FW.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_stopFromMeasureInProgress( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief handle a DRIVER_MODE_FAILURE event by calling the response CB.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_DriverModeFailure( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 08-November-2005\n
+ * \brief handle a START_FAILURE event by exiting driver mode and calling the complete CB.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSrv - handle to the Measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSM_measureStartFailure( TI_HANDLE hMeasurementSRV );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 23-December-2005\n
+ * \brief Handles a stop request when no stop is needed (SM is either idle or already send stop command to FW.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hMeasurementSrv - handle to the measurement SRV object.\n
+ * \return always TI_OK.\n
+ */
+TI_STATUS measurementSRVSRVSM_dummyStop( TI_HANDLE hmeasurementSrv );
+
+#endif /* __MEASUREMENT_SRV_SM_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/PowerSrv.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,817 @@
+/*
+ * PowerSrv.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 powerSrv.c
+ *  \brief This is the powerSrv module implementation.
+ *  \author Assaf Azulay
+ *  \date 19-Oct-2005
+ */
+
+/****************************************************************************
+ *                                                                                                           *
+ *   MODULE:  powerSrv                                                                                  *
+ *   PURPOSE: powerSrv Module implementation.                                                   *
+ *                                                                                                              *
+ ****************************************************************************/
+
+#define __FILE_ID__  FILE_ID_113
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "timer.h"
+#include "PowerSrv.h"
+#include "PowerSrv_API.h"
+#include "PowerSrvSM.h"
+#include "eventMbox_api.h"
+
+
+/*****************************************************************************
+ **         Defines                                                         **
+ *****************************************************************************/
+
+
+
+/****************************************************************************************
+**         Private Function prototypes                                                                              **
+****************************************************************************************/
+static void     powerSrv802_11PsReport  (TI_HANDLE hPowerSrv, char* str , TI_UINT32 strLen);
+TI_STATUS   powerSrvProcessRequest  (TI_HANDLE hPowerSrv, powerSrvMode_e requestMode);
+void powerSrvCreatePssRequest (TI_HANDLE                    hPowerSrv,
+                               powerSrvMode_e              requestMode,
+                               powerSrvRequestState_e      requestState,
+                               E80211PsMode                psMode,
+                               TI_BOOL                        sendNullDataOnExit,
+                               void *                      powerSaveCBObject,
+                               powerSaveCmpltCB_t          powerSaveCompleteCB,
+                               powerSaveCmdResponseCB_t    powerSaveCmdResponseCB);
+
+/***************************************************************************************
+**                                 Functions                                                                    **
+****************************************************************************************/
+
+
+
+/****************************************************************************************
+ *                        powerSrv_create                                                           *
+ ****************************************************************************************
+DESCRIPTION: Power Server module creation function, called by the MAC Services create in creation phase 
+                performs the following:
+                -   Allocate the Power Server handle
+                -   Creates the Power Server State Machine
+                                                                                                                   
+INPUT:          - hOs - Handle to OS        
+
+
+OUTPUT:     
+
+RETURN:     Handle to the Power Server module on success, NULL otherwise
+****************************************************************************************/
+TI_HANDLE powerSrv_create(TI_HANDLE hOs)
+{
+    powerSrv_t * pPowerSrv = NULL;
+    pPowerSrv = (powerSrv_t*) os_memoryAlloc (hOs, sizeof(powerSrv_t),MemoryNormal);
+    if ( pPowerSrv == NULL )
+    {
+        WLAN_OS_REPORT(("powerSrv_create - Memory Allocation Error!\n"));
+        return NULL;
+    }
+
+    os_memoryZero (hOs, pPowerSrv, sizeof(powerSrv_t));
+
+    pPowerSrv->hOS = hOs;
+
+    /*creation of the State Machine*/
+    pPowerSrv->hPowerSrvSM = powerSrvSM_create(hOs);
+    if ( pPowerSrv->hPowerSrvSM == NULL )
+    {
+        WLAN_OS_REPORT(("powerSrv_create - Error in create PowerSrvSM module!\n"));
+        powerSrv_destroy(pPowerSrv);
+        return NULL;
+    }
+
+    return pPowerSrv;
+
+}
+
+
+/****************************************************************************************
+ *                        powerSrv_destroy                                                          *
+ ****************************************************************************************
+DESCRIPTION: Power Server module destroy function, c
+                -   delete Power Server allocation
+                -   call the destroy function of the State machine
+                                                                                                                   
+INPUT:          - hPowerSrv - Handle to the Power Server    
+
+
+OUTPUT:     
+
+RETURN:    TI_STATUS - TI_OK on success else TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrv_destroy(TI_HANDLE hPowerSrv)
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+
+    if ( pPowerSrv->hPowerSrvSM != NULL )
+    {
+        powerSrvSM_destroy(pPowerSrv->hPowerSrvSM);
+    }
+
+    os_memoryFree(pPowerSrv->hOS , pPowerSrv , sizeof(powerSrv_t));
+
+    return TI_OK;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvSM_init                                                           *
+ ****************************************************************************************
+DESCRIPTION: Power Server module initialize function, called by the MAC Services in initialization phase 
+                performs the following:
+                -   init the Power server to active state.
+                -   call the init function of the state machine.
+                                                                                                                   
+INPUT:      - hPowerSrv         - handle to the PowerSrv object.        
+            - hReport           - handle to the Report object.
+            - hEventMbox        - handle to the Event Mbox object.    
+            - hCmdBld           - handle to the Command Builder object.    
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK on success else TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrv_init (TI_HANDLE hPowerSrv,
+                         TI_HANDLE hReport,
+                         TI_HANDLE hEventMbox,
+                         TI_HANDLE hCmdBld,
+                         TI_HANDLE hTimer)
+{
+    powerSrv_t* pPowerSrv = (powerSrv_t*)hPowerSrv;
+
+    pPowerSrv->hReport = hReport;
+    pPowerSrv->hEventMbox = hEventMbox;
+
+    /*
+    init PowerSrv state machine.
+    */
+    powerSrvSM_init (pPowerSrv->hPowerSrvSM, hReport, hCmdBld, hTimer);
+
+    pPowerSrv->currentMode = USER_MODE;
+
+    /*init all request with init values*/
+    powerSrvCreatePssRequest(hPowerSrv,
+                             USER_MODE,
+                             HANDLED_REQUEST,
+                             POWER_SAVE_OFF,
+                             TI_FALSE,
+                             NULL,
+                             NULL,
+                             NULL);
+    powerSrvCreatePssRequest(hPowerSrv,
+                             DRIVER_MODE,
+                             HANDLED_REQUEST,
+                             POWER_SAVE_OFF,
+                             TI_FALSE,
+                             NULL,
+                             NULL,
+                             NULL);
+    pPowerSrv->userLastRequestMode = (powerSrvMode_e)POWER_SAVE_OFF;
+    pPowerSrv->pCurrentRequest  = & pPowerSrv->userRequest;
+
+    /*
+    register for Event 
+    */
+
+	eventMbox_RegisterEvent (hEventMbox,
+                               TWD_OWN_EVENT_PS_REPORT,
+                               (void *)powerSrv802_11PsReport,
+                               hPowerSrv);
+
+    eventMbox_UnMaskEvent (hEventMbox, TWD_OWN_EVENT_PS_REPORT, NULL, NULL);
+
+    TRACE0(pPowerSrv->hReport, REPORT_SEVERITY_INIT, "powerSrv Initialized \n");
+
+    return TI_OK;
+}
+
+/****************************************************************************************
+ *                        powerSrv_restart															*
+ ****************************************************************************************
+DESCRIPTION: Restart the scan SRV module upon recovery.
+				-	init the Power server to active state.
+				-	call the init function of the state machine.
+				                                                                                                   
+INPUT:     	- hPowerSrv 			- handle to the PowerSrv object.		
+
+OUTPUT:	
+RETURN:    TI_STATUS - TI_OK on success else TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrv_restart(	TI_HANDLE hPowerSrv)
+{
+    powerSrv_t* pPowerSrv = (powerSrv_t*)hPowerSrv;
+	PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)pPowerSrv->hPowerSrvSM;
+    /*
+    init PowerSrv state machine.
+    */
+	/*
+	the PowerSrvSM start in active mode (POWER_SRV_STATE_ACTIVE)
+	the PowerSrvSM::currentState must be sync with the PowerSrv::desiredPowerModeProfile (POWER_MODE_ACTIVE).
+	*/
+	pPowerSrvSM->currentState = POWER_SRV_STATE_ACTIVE;
+    pPowerSrv->currentMode = USER_MODE;
+    tmr_StopTimer (pPowerSrvSM->hPwrSrvSmTimer);
+
+    /*init all request with init values*/
+    powerSrvCreatePssRequest(hPowerSrv,
+							USER_MODE,
+							HANDLED_REQUEST,
+							POWER_SAVE_OFF,
+							TI_FALSE,
+							NULL,
+							NULL,
+							NULL);
+    powerSrvCreatePssRequest(hPowerSrv,
+							DRIVER_MODE,
+							HANDLED_REQUEST,
+							POWER_SAVE_OFF,
+							TI_FALSE,
+							NULL,
+							NULL,
+							NULL);
+	pPowerSrv->userLastRequestMode = (powerSrvMode_e)POWER_SAVE_OFF;
+    pPowerSrv->pCurrentRequest 	= & pPowerSrv->userRequest;
+
+	/*
+	register for Event 
+	*/
+	eventMbox_RegisterEvent (pPowerSrv->hEventMbox,
+							   TWD_OWN_EVENT_PS_REPORT,
+							   (void *)powerSrv802_11PsReport,
+							   hPowerSrv);
+
+	eventMbox_UnMaskEvent (pPowerSrv->hEventMbox, TWD_OWN_EVENT_PS_REPORT, NULL, NULL);
+
+    return TI_OK;
+}
+
+/****************************************************************************************
+ *                        powerSrv_config                                                           *
+ ****************************************************************************************
+DESCRIPTION: Power Server module configuration function, called by the MAC Services in configure phase 
+                performs the following:
+                -   init the Power server to active state.
+                -   call the init function of the state machine.
+                                                                                                                   
+INPUT:      - hPowerSrv             - handle to the PowerSrv object.            
+            - pPowerSrvInitParams   - the Power Server initialize parameters.
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK on success else TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrv_config(  TI_HANDLE               hPowerSrv,
+                            TPowerSrvInitParams    *pPowerSrvInitParams)
+{
+    powerSrv_t* pPowerSrv = (powerSrv_t*)hPowerSrv;
+
+    /*
+    config PowerSrv state machine.
+    */
+    powerSrvSM_config(   pPowerSrv->hPowerSrvSM,
+                         pPowerSrvInitParams);
+
+    return TI_OK;
+}
+/****************************************************************************************
+ *                        powerSrv_SetPsMode                                                            *
+ ****************************************************************************************
+DESCRIPTION: This function is a user mode request from the Power Save Server.
+              it will create a Request from the "USER_REQUEST" and will try to perform the user request for PS/Active.
+              this will be done in respect of priority to Driver request.
+                                                                                                                   
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            - psMode                            - Power save/Active request
+            - sendNullDataOnExit                - 
+            - powerSaveCBObject     - handle to the Callback function module.
+            - powerSaveCompleteCB           - Callback function - for success/faild notification.
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / PENDING / TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrv_SetPsMode(   TI_HANDLE                   hPowerSrv,
+                                E80211PsMode                psMode,
+                                TI_BOOL                        sendNullDataOnExit,
+                                void *                      powerSaveCBObject,
+                                powerSaveCmpltCB_t          powerSaveCompleteCB,
+                                powerSaveCmdResponseCB_t    powerSavecmdResponseCB)
+
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+    TI_STATUS status;
+/*creating the request from type - "user"*/
+    powerSrvCreatePssRequest(hPowerSrv,
+                             USER_MODE,
+                             NEW_REQUEST,
+                             psMode,
+                             sendNullDataOnExit,
+                             powerSaveCBObject,
+                             powerSaveCompleteCB,
+                             powerSavecmdResponseCB);
+
+/*the request will be handled if the Power server is not in Driver mode.*/
+    if ( pPowerSrv->currentMode==USER_MODE )
+    {
+        status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->userRequest.requestMode);
+    }
+    else/*driver mode*/
+    {
+        pPowerSrv->userRequest.requestState = PENDING_REQUEST;
+        status = POWER_SAVE_802_11_PENDING;
+    }
+    return status;
+
+}
+
+
+/****************************************************************************************
+ *                        powerSrv_ReservePS                                                        *
+ ****************************************************************************************
+DESCRIPTION: This function is a driver mode request to set the 802.11 Power Save state and reserve the module.
+              The module should not be in driver mode when this request is made. 
+              If this function is called when the module is already in driver mode the result is unexpected. 
+              If the request cannot be fulfilled because of currently executing user mode request, 
+              then the function will return PENDING and the powerSaveCompleteCB function will be called when the request is fulfilled. 
+              If the request can be fulfilled immediately and the Power Save state required is the current state 
+              (This is always the case when PSMode = KEEP_CURRENT),
+              then the module will be reserved and the function will return TI_OK - the callback function will not be called.?? 
+              If the request can be fulfilled immediately and requires a Power Save state transition,
+              then the return value will be TI_OK and the powerSaveCompleteCB function will be called by the Power Save Server
+              when the request is complete.
+                                                                                                                   
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            - psMode                            - Power save/Active request
+            - sendNullDataOnExit                - 
+            - powerSaveCBObject     - handle to the Callback function module.
+            - powerSaveCompleteCB           - Callback function - for success/faild notification.
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / PENDING / TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrv_ReservePS(   TI_HANDLE               hPowerSrv,
+                                E80211PsMode            psMode,
+                                TI_BOOL                    sendNullDataOnExit,
+                                void *                  powerSaveCBObject,
+                                powerSaveCmpltCB_t      powerSaveCompleteCB)
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+    TI_STATUS status;
+
+    /*creating the request from type - "driver"*/
+    if ( psMode == POWER_SAVE_KEEP_CURRENT )
+    {
+        psMode = pPowerSrv->userRequest.psMode;
+    }
+
+    powerSrvCreatePssRequest(hPowerSrv,
+                             DRIVER_MODE,
+                             NEW_REQUEST,
+                             psMode,
+                             sendNullDataOnExit,
+                             powerSaveCBObject,
+                             powerSaveCompleteCB,
+                             NULL);
+    /*try to execute the request*/
+    status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->driverRequest.requestMode);
+    return status;
+
+}
+
+
+/****************************************************************************************
+ *                        powerSrv_ReleasePS                                                        *
+ ****************************************************************************************
+DESCRIPTION: This function is used to release a previous driver mode request issued with the ReservPS API. 
+              it creates a Driver request and the server act like it is a normal driver request.
+              the server will send the request with a simple optimization - if there is a pending or 
+              new user request - the request will be added in the driver request, in this way when the 
+              user request  will be executed there will be nothing to do, in the same manner if there 
+              are no user / driver request to execute we will send the last user request in Driver mode. 
+               
+              
+              
+                                                                                                                   
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            - sendNullDataOnExit                - 
+            - powerSaveCBObject     - handle to the Callback function module.
+            - powerSaveCompleteCB           - Callback function - for success/faild notification.
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / PENDING / TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrv_ReleasePS(   TI_HANDLE                   hPowerSrv,
+                                TI_BOOL                        sendNullDataOnExit,
+                                void *                          powerSaveCBObject,
+                                powerSaveCmpltCB_t              powerSaveCompleteCB)
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+    TI_STATUS status;
+
+    /*creating the request from type - "driver"*/
+
+    if (pPowerSrv->driverRequest.requestMode == POWER_SAVE_802_11_PENDING)
+    {
+        powerSrvCreatePssRequest(hPowerSrv,
+                                 DRIVER_MODE,
+                                 HANDLED_REQUEST,
+                                 POWER_SAVE_OFF,
+                                 TI_FALSE,
+                                 NULL,
+                                 NULL,
+                                 NULL);
+        return POWER_SAVE_802_11_IS_CURRENT;
+    }
+
+    /*creating the request from type - "driver"*/
+    powerSrvCreatePssRequest(hPowerSrv,
+                             DRIVER_MODE,
+                             NEW_REQUEST,
+                             POWER_SAVE_KEEP_CURRENT,
+                             sendNullDataOnExit,
+                             powerSaveCBObject,
+                             powerSaveCompleteCB,
+                             NULL);
+    if ( pPowerSrv->userRequest.requestState == NEW_REQUEST ||
+         pPowerSrv->userRequest.requestState == PENDING_REQUEST )
+    {
+        pPowerSrv->driverRequest.psMode = pPowerSrv->userRequest.psMode;
+    }
+    else
+    {
+        pPowerSrv->driverRequest.psMode = (E80211PsMode)pPowerSrv->userLastRequestMode;
+    }
+
+
+
+    status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->driverRequest.requestMode);
+    /*if the request was not executed we should not change the mode*/
+    if (status != POWER_SAVE_802_11_PENDING)
+    {
+        pPowerSrv->currentMode = USER_MODE;
+    }
+    return status;
+}
+
+
+
+/****************************************************************************************
+ *                        powerSrv_getPsStatus                                                       *
+ *****************************************************************************************
+DESCRIPTION: This function returns the true state of power.
+                                                                                                                                                                       
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            
+OUTPUT: 
+RETURN:    TI_BOOL - true if the SM is in PS state -  false otherwise
+****************************************************************************************/
+TI_BOOL powerSrv_getPsStatus(TI_HANDLE hPowerSrv)
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+    PowerSrvSMStates_e smState;
+    smState = powerSrvSM_getCurrentState(pPowerSrv->hPowerSrvSM);
+    return(smState == POWER_SRV_STATE_PS );
+}
+
+
+/****************************************************************************************
+*                        powerSrv_SetRateModulation                                                         *
+*****************************************************************************************
+DESCRIPTION: Sets the rate modulation according to the current Radio Mode.
+                                                                                                                                                                      
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.
+           - dot11mode_e - The current radio mode (A or G)
+           
+OUTPUT: 
+RETURN:    TI_BOOL - true if the SM is in PS state -  false otherwise
+****************************************************************************************/
+void powerSrv_SetRateModulation(TI_HANDLE hPowerSrv, TI_UINT16  rate)
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+    powerSrvSM_setRateModulation(pPowerSrv->hPowerSrvSM,rate);
+
+    return;
+}
+
+/**
+ * \Gets the rate modulation.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
+ * 2) dot11mode_e - The current radio mode (A or G)
+ * Return: None.\n
+ */
+TI_UINT32 powerSrv_GetRateModulation(TI_HANDLE hPowerSrv)
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+    return powerSrvSM_getRateModulation(pPowerSrv->hPowerSrvSM);
+}
+
+
+
+
+/*****************************************************************************
+ **         Private Function prototypes                                                             **
+ *****************************************************************************/
+
+
+/****************************************************************************************
+ *                        powerSrv802_11PsReport                                                    *
+ ****************************************************************************************
+DESCRIPTION:  This function is the call back for the TWD control when a PS event triggered
+              This function is responsible for the process "keep alive".
+              the function handles the event and sends it to the state machine, after sending the events 
+              the function handles the next request with respect to driver request priority.
+              if a request is already done then we will call the request call back (if exist!).
+               
+              
+              
+                                                                                                                   
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            - str                               - Event string   
+            - strLen                            - string length
+
+OUTPUT: 
+RETURN:    void.
+****************************************************************************************/
+static void powerSrv802_11PsReport(TI_HANDLE hPowerSrv, char* str , TI_UINT32 strLen)
+{
+    powerSrv_t *    pPowerSrv = (powerSrv_t*)hPowerSrv;
+    TI_UINT8           PowerSaveStatus;
+    E80211PsMode    currentPsMode;
+    TI_STATUS       status = TI_OK;
+
+    /*copy the event*/
+    os_memoryCopy(pPowerSrv->hOS, (void *)&PowerSaveStatus, (void *)str, strLen);
+
+    TRACE1( pPowerSrv->hReport, REPORT_SEVERITY_INFORMATION, "PS callback with status: %d\n", PowerSaveStatus);
+
+    /* Handling the event*/
+    switch ( (EventsPowerSave_e)PowerSaveStatus )
+    {
+    case ENTER_POWER_SAVE_FAIL:
+    case EXIT_POWER_SAVE_FAIL:
+        TRACE0( pPowerSrv->hReport, REPORT_SEVERITY_WARNING, "Power save enter or exit failed!\n");
+        powerSrvSM_SMApi(pPowerSrv->hPowerSrvSM,POWER_SRV_EVENT_FAIL);
+        break;
+
+    case ENTER_POWER_SAVE_SUCCESS:
+	case EXIT_POWER_SAVE_SUCCESS:
+        powerSrvSM_SMApi(pPowerSrv->hPowerSrvSM,POWER_SRV_EVENT_SUCCESS);
+        /*update the last user request if the request was a user request*/
+        if ( pPowerSrv->currentMode == USER_MODE )
+        {
+            pPowerSrv->userLastRequestMode= (powerSrvMode_e)pPowerSrv->userRequest.psMode;
+        }
+        break;
+
+    default:
+        TRACE1( pPowerSrv->hReport, REPORT_SEVERITY_ERROR, "Unrecognized status at PS callback %d\n", PowerSaveStatus );
+        break;
+    }
+
+    /*this reflects the true power save state - power save IFF state machine in PS state.*/
+    if ( (EventsPowerSave_e)PowerSaveStatus == ENTER_POWER_SAVE_SUCCESS )
+    {
+        currentPsMode = POWER_SAVE_ON;
+    }
+    else
+    {
+        currentPsMode = POWER_SAVE_OFF;
+    }
+
+    /*in case of  request has been already handled - calling the CB*/
+    if ( pPowerSrv->pCurrentRequest->requestState == HANDLED_REQUEST )
+    {
+        if ( pPowerSrv->pCurrentRequest->powerSrvCompleteCB != NULL )
+        {
+            pPowerSrv->pCurrentRequest->powerSrvCompleteCB( pPowerSrv->pCurrentRequest->powerSaveCBObject,
+                                                            currentPsMode,
+                                                            (EventsPowerSave_e)PowerSaveStatus);
+
+        }
+    }
+
+    /*starting again to handle waiting requests  */
+    /*priority to driver request*/
+    if ( pPowerSrv->driverRequest.requestState == NEW_REQUEST ||
+         pPowerSrv->driverRequest.requestState == PENDING_REQUEST )
+    {
+        status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->driverRequest.requestMode);
+    }
+    else/*user request*/
+    {
+        if ( pPowerSrv->currentMode==USER_MODE )
+        {
+            if ( pPowerSrv->userRequest.requestState == NEW_REQUEST||
+                 pPowerSrv->userRequest.requestState == PENDING_REQUEST )
+            {
+                status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->userRequest.requestMode);
+            }
+
+        }
+    }
+    if ( status == POWER_SAVE_802_11_IS_CURRENT )/*in case of already or habdled*/
+    {
+        if ( pPowerSrv->pCurrentRequest->powerSrvCompleteCB != NULL )
+        {
+            pPowerSrv->pCurrentRequest->powerSrvCompleteCB(pPowerSrv->pCurrentRequest->powerSaveCBObject,
+                                                           pPowerSrv->pCurrentRequest->psMode,
+                                                           ((pPowerSrv->pCurrentRequest->psMode == POWER_SAVE_ON) ? 
+                                                            ENTER_POWER_SAVE_SUCCESS : 
+                                                            EXIT_POWER_SAVE_SUCCESS));
+        }
+    }
+
+
+}
+
+
+/****************************************************************************************
+ *                        powerSrvProcessRequest                                                    *
+ ****************************************************************************************
+DESCRIPTION: This function receive the request before sending it to the state machine, checks if it 
+              possible to be applied and pass it to the state machine.
+              
+              
+                                                                                                                   
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            - requestMode                   - Driver or User mode
+
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / PENDING / TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrvProcessRequest (TI_HANDLE hPowerSrv, powerSrvMode_e requestMode)
+{
+    PowerSrvSMStates_e powerSrvSmState;
+    powerSrvRequest_t*      pPrcessedRequest;
+    TI_STATUS smApiStatus;
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+
+
+
+/*determine what is the current request*/
+    if ( requestMode == DRIVER_MODE )
+    {
+        pPrcessedRequest = &(pPowerSrv->driverRequest);     
+    }
+    else
+    {
+        pPrcessedRequest = &(pPowerSrv->userRequest);
+    }
+
+/*in case that the state machine is in a pending state and it is a driver 
+   request we will return Pending and not call the SM. the request will 
+   be processed in the next event - according to the 802_11_Report.*/
+    powerSrvSmState = powerSrvSM_getCurrentState(pPowerSrv->hPowerSrvSM);
+
+    if ( (powerSrvSmState == POWER_SRV_STATE_PEND_ACTIVE || 
+          powerSrvSmState == POWER_SRV_STATE_PEND_PS) &&
+         pPowerSrv->pCurrentRequest->requestMode == DRIVER_MODE )
+    {
+        pPrcessedRequest->requestState = PENDING_REQUEST;
+        return POWER_SAVE_802_11_PENDING;
+    }
+    /*Set the correct request to the SM*/
+    powerSrvSm_setSmRequest(pPowerSrv->hPowerSrvSM ,pPrcessedRequest);      
+
+    /*call the SM with the correct request*/
+
+    if ( pPrcessedRequest->psMode == POWER_SAVE_ON )
+    {
+        smApiStatus = powerSrvSM_SMApi(pPowerSrv->hPowerSrvSM,POWER_SRV_EVENT_REQUEST_PS);
+    }
+    else
+    {
+        smApiStatus = powerSrvSM_SMApi(pPowerSrv->hPowerSrvSM,POWER_SRV_EVENT_REQUEST_ACTIVE);
+    }
+
+    /*if =! pending updating the current request pointer.*/
+    if ( pPrcessedRequest->requestState != PENDING_REQUEST )
+    {
+        pPowerSrv->pCurrentRequest = pPrcessedRequest;
+        pPowerSrv->currentMode = pPowerSrv->pCurrentRequest->requestMode;
+    }
+
+
+    return smApiStatus;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvCreatePssRequest                                                  *
+ ****************************************************************************************
+DESCRIPTION: This function create a request acording to it's type:
+                                                        - User
+                                                        -Driver
+                
+                                                                                                                   
+INPUT:      - hPowerSrv                         - handle to the PowerSrv object.        
+            - requestMode                   - request type : Driver/User
+            - psMode                            - Power save/Active request
+            - sendNullDataOnExit                - 
+            - powerSaveCBObject     - handle to the Callback functin module.
+            - powerSaveCompleteCB           - Calback function - for success/faild notification.
+
+OUTPUT: 
+RETURN:    void.
+****************************************************************************************/
+void powerSrvCreatePssRequest (TI_HANDLE                    hPowerSrv,
+                               powerSrvMode_e              requestMode,
+                               powerSrvRequestState_e      requestState,
+                               E80211PsMode                psMode,
+                               TI_BOOL                        sendNullDataOnExit,
+                               void *                      powerSaveCBObject,
+                               powerSaveCmpltCB_t          powerSaveCompleteCB,
+                               powerSaveCmdResponseCB_t    powerSaveCmdResponseCB)
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+    if ( requestMode==USER_MODE )
+    {
+        pPowerSrv->userRequest.requestState             = requestState;
+        pPowerSrv->userRequest.requestMode              = requestMode;
+        pPowerSrv->userRequest.psMode                   = psMode;
+        pPowerSrv->userRequest.sendNullDataOnExit           = sendNullDataOnExit;
+        pPowerSrv->userRequest.powerSaveCBObject            = powerSaveCBObject;
+        pPowerSrv->userRequest.powerSrvCompleteCB       = powerSaveCompleteCB;
+        pPowerSrv->userRequest.powerSaveCmdResponseCB   = powerSaveCmdResponseCB;
+    }
+    else /*driver request*/
+    {
+        pPowerSrv->driverRequest.requestState               = requestState;
+        pPowerSrv->driverRequest.requestMode                = requestMode;
+        pPowerSrv->driverRequest.psMode                 = psMode;
+        pPowerSrv->driverRequest.sendNullDataOnExit             = sendNullDataOnExit;
+        pPowerSrv->driverRequest.powerSaveCBObject      = powerSaveCBObject;
+        pPowerSrv->driverRequest.powerSrvCompleteCB         = powerSaveCompleteCB;
+        pPowerSrv->driverRequest.powerSaveCmdResponseCB     = NULL;
+    }
+}
+
+
+
+/****************************************************************************************
+ *                        powerSrvRegisterFailureEventCB                                                    *
+ ****************************************************************************************
+DESCRIPTION: Registers a failure event callback for scan error notifications.
+                
+                                                                                                                   
+INPUT:      - hPowerSrv         - handle to the PowerSrv object.        
+            - failureEventCB    - the failure event callback function.\n
+            - hFailureEventObj - handle to the object passed to the failure event callback function.
+
+OUTPUT: 
+RETURN:    void.
+****************************************************************************************/
+void powerSrvRegisterFailureEventCB( TI_HANDLE hPowerSrv, 
+                                     void * failureEventCB, TI_HANDLE hFailureEventObj )
+{
+    powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
+
+    pPowerSrv->failureEventFunc = (TFailureEventCb)failureEventCB;
+    pPowerSrv->failureEventObj  = hFailureEventObj;
+
+    /* register the failure event CB also with the PS SM */
+    powerSrvSM_RegisterFailureEventCB( pPowerSrv->hPowerSrvSM, failureEventCB, hFailureEventObj );
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/PowerSrv.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,199 @@
+/*
+ * PowerSrv.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 powerSrv.h
+ *  \brief This is the Power Manager module private (internal).
+ *  \author Yaron Menashe
+ *  \date 27-Apr-2004
+ */
+
+/****************************************************************************
+ *                                                                          *
+ *   MODULE:  Power Manager                                                 *
+ *   PURPOSE: Power Manager Module private                                      *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifndef _POWER_SRV_H_
+#define _POWER_SRV_H_
+
+#include "TWDriverInternal.h"
+#include "PowerSrv_API.h"
+
+/*#include "PowerSrvSM.h"*/
+
+/*****************************************************************************
+ **         Constants                                                       **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         Enumerations                                                    **
+ *****************************************************************************/
+
+
+
+
+
+/*new Power*/
+
+
+typedef enum 
+{
+	DRIVER_MODE,
+	USER_MODE
+}powerSrvMode_e;  
+
+typedef enum 
+{
+	NEW_REQUEST,
+	PENDING_REQUEST,
+	RUNNING_REQUEST,
+	HANDLED_REQUEST
+}powerSrvRequestState_e;
+
+
+/*****************************************************************************
+ **         Typedefs                                                        **
+ *****************************************************************************/
+
+
+
+
+/*****************************************************************************
+ **         Structures                                                      **
+ *****************************************************************************/
+
+
+
+typedef struct
+{
+	powerSrvRequestState_e 		requestState;
+	powerSrvMode_e				requestMode;
+	E80211PsMode	            psMode;
+	TI_BOOL 						sendNullDataOnExit;
+	void* 						powerSaveCBObject;
+	powerSaveCmpltCB_t    		powerSrvCompleteCB;
+	powerSaveCmdResponseCB_t	powerSaveCmdResponseCB;
+}	powerSrvRequest_t;   
+
+/** \struct powerSrv_t
+ * this structure contain the data of the PowerSrv object.
+ */
+
+
+typedef struct
+{
+	TI_HANDLE   			hPowerSrvSM;            /**<
+                                             					* Hnadle to the Power Server State Machine object.
+                                            			 		*/
+
+	TI_HANDLE   			hOS;                        	/**<
+                                             					* Handle to the OS object.
+                                             					*/
+
+    TI_HANDLE   			hReport;                    	/**<
+                                            	 				* Handle to the Report module.
+                                             					*/
+
+	TI_HANDLE   			hEventMbox;         		/**< Handle to the power controller object via the WhalCtrl.
+											 * Need for configure the desired power mode policy in the system.
+											 */
+    TI_HANDLE               hCmdBld;
+											 
+	powerSrvMode_e 		currentMode; 		/**<
+											*holds the current mode of the PSS - driver or user...
+											*/
+
+	powerSrvMode_e 		userLastRequestMode;
+											/**<
+											*
+											*/
+
+	powerSrvRequest_t 	userRequest;		/**<
+											*user request struct.
+											*/
+
+	powerSrvRequest_t 	driverRequest;		/**<
+											*driver request struct
+											*/
+
+	powerSrvRequest_t*  	pCurrentRequest;	/**<
+											*pointer to the current request - user/driver request
+											*/
+	
+	TFailureEventCb		failureEventFunc;	/**<
+											* upper layer Failure Event CB.
+											* called when the scan command has been Timer Expiry
+											*/
+	TI_HANDLE			failureEventObj;		/**<
+											* object parameter passed to the failureEventFunc
+											* when it is called 
+											*/
+	
+} powerSrv_t;
+
+
+
+/*****************************************************************************
+ **         External data definitions                                       **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         External functions definitions                                  **
+ *****************************************************************************/
+
+
+
+
+
+/*****************************************************************************
+ **         Public Function prototypes                                      **
+ *****************************************************************************/
+
+/*****************************************************************************
+ **         Private Function prototypes                                     **
+ *****************************************************************************/
+
+/*****************************************************************************
+ **         Private Function prototypes                                     **
+ *****************************************************************************/
+
+#endif /*  _POWER_SRV_H_  */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/PowerSrvSM.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,819 @@
+/*
+ * PowerSrvSM.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 PowerSrvSM.c
+ *  \brief This is the PowerSrvSM module implementation.
+ *  \author Assaf Azulay
+ *  \date 19-OCT-2005
+ */
+
+/****************************************************************************
+ *                                                                          *
+ *   MODULE:  PowerSrvSM                                                    *
+ *   PURPOSE: PowerSrvSM Module implementation.                             *
+ *                                                                          *
+ ****************************************************************************/
+
+#define __FILE_ID__  FILE_ID_114
+#include "tidef.h"
+#include "osApi.h"
+#include "timer.h"
+#include "fsm.h"
+#include "report.h"
+#include "TWDriver.h"
+#include "PowerSrvSM.h"
+#include "CmdBld.h"
+
+
+/*****************************************************************************
+ **         Defines                                                         **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         structs                                                         **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         Private Function prototypes                                     **
+ *****************************************************************************/
+
+static TI_STATUS powerSrvSmSMEvent(TI_UINT8* pCurrentState,
+                                   TI_UINT8 event,
+                                   TI_HANDLE hPowerSrvSM);
+static TI_STATUS powerSrvSmDoUpdateRequest(TI_HANDLE hPowerSrvSM);
+static TI_STATUS powerSrvSmDoEnterPowerSave(TI_HANDLE hPowerSrvSM);
+static TI_STATUS powerSrvSmDoExitPowerSave(TI_HANDLE hPowerSrvSM);
+static TI_STATUS powerSrvSmDoPending(TI_HANDLE hPowerSrvSM);
+static TI_STATUS powerSrvSmDoAllready(TI_HANDLE hPowerSrvSM);
+static TI_STATUS powerSrvSMActionUnexpected(TI_HANDLE hPowerSrvSM);
+static TI_STATUS powerSrvSMSendMBXConfiguration(TI_HANDLE hPowerSrvSM, TI_BOOL PS_disableEnable);
+static void      powerSrvSMTimerExpired (TI_HANDLE hPowerSrvSM, TI_BOOL bTwdInitOccured);
+
+/***************************************************************************************
+ **         Public Function prototypes                                      **
+ ****************************************************************************************/
+
+
+/****************************************************************************************
+ *                        powerSrvSM_create                                                         *
+ ****************************************************************************************
+DESCRIPTION: Power Server SM module creation function, called by the Power Server create in creation phase 
+                performs the following:
+                -   Allocate the Power Server SM handle
+                -   Creates the fsm.
+                                                                                                                   
+INPUT:          - hOs - Handle to OS        
+
+
+OUTPUT:     
+
+RETURN:     Handle to the Power Server SM module on success, NULL otherwise
+****************************************************************************************/
+TI_HANDLE powerSrvSM_create(TI_HANDLE hOsHandle)
+{
+    PowerSrvSM_t *pPowerSrvSM = NULL;
+    fsm_stateMachine_t *pFsm = NULL;
+    TI_STATUS status;
+
+    pPowerSrvSM = (PowerSrvSM_t*) os_memoryAlloc (hOsHandle, sizeof(PowerSrvSM_t),MemoryNormal);
+    if ( pPowerSrvSM == NULL )
+    {
+        WLAN_OS_REPORT(("%s(%d) - Memory Allocation Error!\n",__FUNCTION__,__LINE__));
+        return NULL;
+    }
+
+    os_memoryZero (hOsHandle, pPowerSrvSM, sizeof(PowerSrvSM_t));
+
+    pPowerSrvSM->hOS = hOsHandle;
+
+    /* create the generic state-machine */
+    status = fsm_Create(hOsHandle,
+                        &pFsm,
+                        (TI_UINT8)POWER_SRV_SM_STATE_NUM,
+                        (TI_UINT8)POWER_SRV_SM_EVENT_NUM);
+    if ( status != TI_OK )
+    {
+        WLAN_OS_REPORT(("%s(%d) - Error in create FSM!\n",__FUNCTION__,__LINE__));
+        powerSrvSM_destroy(pPowerSrvSM);
+        return NULL;
+    }
+
+    pPowerSrvSM->hFSM = (TI_HANDLE)pFsm;
+
+    return pPowerSrvSM;
+}
+
+ 
+/****************************************************************************************
+ *                        powerSrvSM_destroy                                                            *
+ ****************************************************************************************
+DESCRIPTION: Power Server SM module destroy function, 
+                -   delete Power Server SM allocation
+                
+                                                                                                                   
+INPUT:          - hPowerSrvSM - Handle to the Power Server  SM
+
+
+OUTPUT:     
+
+RETURN:    TI_STATUS - TI_OK on success else TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrvSM_destroy(TI_HANDLE hPowerSrvSM)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    TI_HANDLE osHandle = pPowerSrvSM->hOS;
+
+    /* free the timer */
+    if (pPowerSrvSM->hPwrSrvSmTimer)
+    {
+        tmr_DestroyTimer (pPowerSrvSM->hPwrSrvSmTimer);
+    }
+
+    /* free the generic SM */
+    if ( pPowerSrvSM->hFSM != NULL )
+    {
+        fsm_Unload(osHandle, (fsm_stateMachine_t*)pPowerSrvSM->hFSM);
+    }
+
+    /* free the Power Save SRV object */
+    os_memoryFree(osHandle , pPowerSrvSM , sizeof(PowerSrvSM_t));
+
+    return TI_OK;
+}
+
+
+/****************************************************************************************
+*                        powerSrvSM_init                                                           *
+****************************************************************************************
+DESCRIPTION: Power Server SM module initialize function, called by the Power Server init in configure phase 
+               performs the following:
+               -   init the Stet machine states.
+               -   set Active as start state.
+                                                                                                                  
+INPUT:     - hPowerSrvSM       - handle to the PowerSrvSM object.
+           - hReport           - handle to the Report object.
+           - hCmdBld           - handle to the Command Builder object.    
+           - hTimer            - handle to the Timer module object.    
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK on success else TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrvSM_init (TI_HANDLE hPowerSrvSM,
+                           TI_HANDLE hReport,
+                           TI_HANDLE hCmdBld,
+                           TI_HANDLE hTimer)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    fsm_actionCell_t smMatrix[POWER_SRV_SM_STATE_NUM][POWER_SRV_SM_EVENT_NUM] =
+    {
+        /*
+        next state and transition action for POWER_SRV_STATE_ACTIVE state
+        */
+        {
+            /* POWER_SRV_EVENT_REQUEST_ACTIVE */
+            {POWER_SRV_STATE_ACTIVE             , powerSrvSmDoAllready},
+
+            /* POWER_SRV_EVENT_REQUEST_PS */
+            {POWER_SRV_STATE_PEND_PS                , powerSrvSmDoEnterPowerSave},
+
+            /* POWER_SRV_EVENT_SUCCESS */
+            {POWER_SRV_STATE_ACTIVE                 , powerSrvSMActionUnexpected},
+
+            /* POWER_SRV_EVENT_FAIL */
+            {POWER_SRV_STATE_ACTIVE                 , powerSrvSMActionUnexpected}
+
+        },
+
+        /*
+        next state and transition action for POWER_SRV_STATE_PEND_PS state
+        */
+        {
+            /* POWER_SRV_EVENT_REQUEST_ACTIVE */
+            {POWER_SRV_STATE_PEND_PS            , powerSrvSmDoPending},
+
+            /* POWER_SRV_EVENT_REQUEST_PS */
+            {POWER_SRV_STATE_PEND_PS        , powerSrvSmDoPending},
+
+            /* POWER_SRV_EVENT_SUCCESS */
+            {POWER_SRV_STATE_PS                 , powerSrvSmDoUpdateRequest},
+
+            /* POWER_SRV_EVENT_FAIL */
+            {POWER_SRV_STATE_ACTIVE             , powerSrvSmDoUpdateRequest}
+
+        },
+        /*
+        next state and transition action for POWER_SRV_STATE_PS state
+        */
+        {
+            /* POWER_SRV_EVENT_REQUEST_ACTIVE */
+            {POWER_SRV_STATE_PEND_ACTIVE        , powerSrvSmDoExitPowerSave},
+
+            /* POWER_SRV_EVENT_REQUEST_PS */
+            {POWER_SRV_STATE_PS                 , powerSrvSmDoAllready},
+
+            /* POWER_SRV_EVENT_SUCCESS */
+            {POWER_SRV_STATE_PS                 , powerSrvSMActionUnexpected},
+
+            /* POWER_SRV_EVENT_FAIL */
+            {POWER_SRV_STATE_PS                 , powerSrvSMActionUnexpected}
+
+        },
+        /*
+        next state and transition action for POWER_SRV_STATE_PEND_ACTIVE state
+        */
+        {
+            /* POWER_SRV_EVENT_REQUEST_ACTIVE */
+            {POWER_SRV_STATE_PEND_ACTIVE            , powerSrvSmDoPending},
+
+            /* POWER_SRV_EVENT_REQUEST_PS */
+            {POWER_SRV_STATE_PEND_ACTIVE        , powerSrvSmDoPending},
+
+            /* POWER_SRV_EVENT_SUCCESS */
+            {POWER_SRV_STATE_ACTIVE             , powerSrvSmDoUpdateRequest},
+
+            /* POWER_SRV_EVENT_FAIL */
+            {POWER_SRV_STATE_ERROR_ACTIVE       , powerSrvSmDoUpdateRequest}
+
+        },
+        /*
+        next state and transition action for POWER_SRV_STATE_ERROR_ACTIVE state
+        */
+        {
+            /* POWER_SRV_EVENT_REQUEST_ACTIVE */
+            {POWER_SRV_STATE_PEND_ACTIVE            , powerSrvSmDoExitPowerSave},
+
+            /* POWER_SRV_EVENT_REQUEST_PS */
+            {POWER_SRV_STATE_PEND_PS        , powerSrvSmDoEnterPowerSave},
+
+            /* POWER_SRV_EVENT_SUCCESS */
+            {POWER_SRV_STATE_ERROR_ACTIVE       , powerSrvSMActionUnexpected},
+
+            /* POWER_SRV_EVENT_FAIL */
+            {POWER_SRV_STATE_ERROR_ACTIVE       , powerSrvSMActionUnexpected}
+
+        },
+
+    };
+
+    pPowerSrvSM->hReport = hReport;
+    pPowerSrvSM->hCmdBld = hCmdBld;
+    pPowerSrvSM->hTimer  = hTimer;
+
+    /* create the timer */
+    pPowerSrvSM->hPwrSrvSmTimer = tmr_CreateTimer (pPowerSrvSM->hTimer);
+	if (pPowerSrvSM->hPwrSrvSmTimer == NULL)
+	{
+        TRACE0(pPowerSrvSM->hReport, REPORT_SEVERITY_ERROR, "powerSrvSM_init(): Failed to create hPwrSrvSmTimer!\n");
+		return TI_NOK;
+	}
+
+    fsm_Config(pPowerSrvSM->hFSM,
+               (fsm_Matrix_t)smMatrix,
+               POWER_SRV_SM_STATE_NUM,
+               POWER_SRV_SM_EVENT_NUM,
+               powerSrvSmSMEvent,
+               pPowerSrvSM->hOS);
+
+    /*
+    the PowerSrvSM start in active mode (POWER_SRV_STATE_ACTIVE)
+    the PowerSrvSM::currentState must be sync with the PowerSrv::desiredPowerModeProfile (POWER_MODE_ACTIVE).
+    */
+    pPowerSrvSM->currentState = POWER_SRV_STATE_ACTIVE;
+
+
+    /*
+    Null packet rate : 2,5.5 M
+    Probe Request : Not PBCC modulation, Long Preamble */
+    pPowerSrvSM->NullPktRateModulation= (DRV_RATE_MASK_1_BARKER | DRV_RATE_MASK_2_BARKER); 
+
+    TRACE0(pPowerSrvSM->hReport, REPORT_SEVERITY_INIT, "PowerSrvSM Initialized\n");
+
+    return TI_OK;
+}
+
+/****************************************************************************************
+*                        powerSrvSM_config                                                         *
+****************************************************************************************
+DESCRIPTION: Power Server SM module configuration function, called by the Power Server init in configure phase 
+               performs the following:
+               -   init the Stet machine states.
+               -   set Active as start state.
+                                                                                                                  
+INPUT:      - hPowerSrvSM       - handle to the PowerSrvSM object.  
+           - pPowerSrvInitParams   - the Power Server initialize parameters.
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK on success else TI_NOK.
+****************************************************************************************/
+TI_STATUS powerSrvSM_config(TI_HANDLE hPowerSrvSM,
+                            TPowerSrvInitParams *pPowerSrvInitParams)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    /*
+    init PowerMgmtConfigration
+    */
+    pPowerSrvSM->hangOverPeriod =   pPowerSrvInitParams->hangOverPeriod;
+    pPowerSrvSM->numNullPktRetries =    pPowerSrvInitParams->numNullPktRetries;
+
+    return TI_OK;
+}
+/****************************************************************************************
+ *                        powerSrvSM_SMApi                                                           *
+ *****************************************************************************************
+DESCRIPTION: This function triggers events from the outside of the module into the state machine.
+              
+                                                                                                                                                                       
+INPUT:      - hPowerSrvSM                   - handle to the PowerSrvSM object.  
+            - theSMEvent                    - event from TWD.
+            
+
+OUTPUT: 
+RETURN:    TI_STATUS TI_OK / PENDING / TI_NOK
+****************************************************************************************/
+TI_STATUS powerSrvSM_SMApi(TI_HANDLE hPowerSrvSM,
+                           PowerSrvSMEvents_e theSMEvent)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    TI_STATUS status;
+
+    switch ( theSMEvent )
+    {
+    case POWER_SRV_EVENT_REQUEST_ACTIVE :
+    case POWER_SRV_EVENT_REQUEST_PS :
+    case POWER_SRV_EVENT_FAIL :
+    case POWER_SRV_EVENT_SUCCESS :
+
+        TRACE1(pPowerSrvSM->hReport, REPORT_SEVERITY_INFORMATION, "powerSrvSM_SMApi(%d) called - legal input parameter.\n",theSMEvent);
+        break;
+
+    default:
+        TRACE1(pPowerSrvSM->hReport, REPORT_SEVERITY_WARNING, "powerSrvSM_SMApi(%d) called,                            input parameter is illegal.",theSMEvent);
+        return TI_NOK;
+    }
+
+
+    status = powerSrvSmSMEvent((TI_UINT8*)&pPowerSrvSM->currentState,
+                               (TI_UINT8)theSMEvent,
+                               hPowerSrvSM);
+
+    return status;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvSm_setSmRequest                                                    *
+ *****************************************************************************************
+DESCRIPTION: This function sets the current SM working request.
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.
+            -powerSrvRequest_t*                 - pointer to the correct request in the Power server.
+
+OUTPUT: 
+RETURN:    TI_STATUS -  TI_OK
+****************************************************************************************/
+TI_STATUS powerSrvSm_setSmRequest(TI_HANDLE hPowerSrvSM,powerSrvRequest_t* pSmRequest)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    pPowerSrvSM->pSmRequest = pSmRequest;
+    return TI_OK;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvSM_getCurrentState                                                         *
+ *****************************************************************************************
+DESCRIPTION: This function returns the current state of the SM.
+                                                       
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.      
+            
+
+OUTPUT: 
+RETURN:    PowerSrvSMStates_e current state
+****************************************************************************************/
+PowerSrvSMStates_e powerSrvSM_getCurrentState(TI_HANDLE hPowerSrvSM)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    return pPowerSrvSM->currentState; 
+}
+
+/****************************************************************************************
+ *                        powerSrvSM_setRateModulation                                               *
+ *****************************************************************************************
+DESCRIPTION: This function sets the Rate Modulation
+                                                       
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.      
+            - rateModulation                        - desired rate
+
+OUTPUT: 
+RETURN:      void
+****************************************************************************************/
+
+void powerSrvSM_setRateModulation(TI_HANDLE hPowerSrvSM, TI_UINT16 rateModulation)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    pPowerSrvSM->NullPktRateModulation= rateModulation; 
+}
+
+/****************************************************************************************
+ *                        powerSrvSM_getRateModulation                                               *
+ *****************************************************************************************
+DESCRIPTION: This function sets the Rate Modulation
+                                                       
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.      
+
+OUTPUT: 
+RETURN:      -  desired rate
+****************************************************************************************/
+
+TI_UINT32 powerSrvSM_getRateModulation(TI_HANDLE hPowerSrvSM)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    return pPowerSrvSM->NullPktRateModulation;
+}
+
+/****************************************************************************************
+ *                        powerSrvSM_printObject                                                         *
+ *****************************************************************************************
+DESCRIPTION: This function prints the SM object
+                                                       
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.      
+            
+
+OUTPUT: 
+RETURN:   void
+****************************************************************************************/
+void powerSrvSM_printObject(TI_HANDLE hPowerSrvSM)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    char *pString;
+
+    WLAN_OS_REPORT(("\n+++++ powerSrvSM_printObject +++++\n"));
+    WLAN_OS_REPORT(("Handle to the CmdBld is 0x%08X\n", pPowerSrvSM->hCmdBld));
+    WLAN_OS_REPORT(("Handle to the OS is 0x%08X\n", pPowerSrvSM->hOS));
+    WLAN_OS_REPORT(("Handle to the Report is 0x%08X\n", pPowerSrvSM->hReport));
+    WLAN_OS_REPORT(("Handle to the FSM is 0x%08X\n", pPowerSrvSM->hFSM));
+
+    switch ( pPowerSrvSM->currentState )
+    {
+    case POWER_SRV_STATE_ACTIVE:
+        pString = "POWER_SRV_STATE_ACTIVE";
+        break;
+
+    case POWER_SRV_STATE_PEND_PS:
+        pString = "POWER_SRV_STATE_PEND_PS";
+        break;
+
+    case POWER_SRV_STATE_PS:
+        pString = "POWER_SRV_STATE_PS";
+        break;
+
+    case POWER_SRV_STATE_PEND_ACTIVE:
+        pString = "POWER_SRV_STATE_PEND_ACTIVE";
+        break;
+
+    case POWER_SRV_STATE_ERROR_ACTIVE:
+        pString = "POWER_SRV_STATE_ERROR_ACTIVE";
+        break;
+
+
+    default:
+        pString = "UNKWON PARAMETER";
+        break;
+    }
+    WLAN_OS_REPORT(("The current state of the state machine is %s (=%d)\n",
+                    pString,
+                    pPowerSrvSM->currentState));
+
+}
+
+
+
+
+/*****************************************************************************
+ **         Private Function prototypes                                                             **
+ *****************************************************************************/
+
+
+
+
+
+
+/****************************************************************************************
+ *                        powerSrvSmDoEnterPowerSave                                                 *
+ *****************************************************************************************
+DESCRIPTION: This function is an action of the state machine to move from active state to PS
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / TI_NOK
+****************************************************************************************/
+
+static TI_STATUS powerSrvSmDoEnterPowerSave(TI_HANDLE hPowerSrvSM)
+{
+    TI_STATUS status;
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    pPowerSrvSM->pSmRequest->requestState = RUNNING_REQUEST;
+    status = powerSrvSMSendMBXConfiguration(hPowerSrvSM, TI_TRUE);
+    return status;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvSmDoExitPowerSave                                              *
+ *****************************************************************************************
+DESCRIPTION: This function is an action of the state machine to move from PS state to Active
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / TI_NOK
+****************************************************************************************/
+static TI_STATUS powerSrvSmDoExitPowerSave(TI_HANDLE hPowerSrvSM)
+{
+    TI_STATUS status;
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    pPowerSrvSM->pSmRequest->requestState = RUNNING_REQUEST;
+    status = powerSrvSMSendMBXConfiguration(hPowerSrvSM, TI_FALSE);
+    return status;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvSmDoUpdateRequest                                                  *
+ *****************************************************************************************
+DESCRIPTION: This function is an action of the state machine to update a request when the SM 
+              is already in the requested state is already 
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK / TI_NOK
+****************************************************************************************/
+
+static TI_STATUS powerSrvSmDoUpdateRequest(TI_HANDLE hPowerSrvSM)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    /* request has completed - stop the guard timer */
+    tmr_StopTimer (pPowerSrvSM->hPwrSrvSmTimer);
+
+    /*powerSrv_SetRequestState  will update the correct request (acording to the current active request)*/
+    if ( pPowerSrvSM->pSmRequest->requestState == RUNNING_REQUEST )
+    {
+        pPowerSrvSM->pSmRequest->requestState = HANDLED_REQUEST;
+    }
+
+    return TI_OK;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvSmDoPending                                                        *
+ *****************************************************************************************
+DESCRIPTION: This function is an action of the state machine returns Pending in case that there is a request 
+              waiting to be finished (already sent to FW)
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.
+
+OUTPUT: 
+RETURN:    TI_STATUS - PENDING
+****************************************************************************************/
+
+static TI_STATUS powerSrvSmDoPending(TI_HANDLE hPowerSrvSM)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    /*powerSrv_SetRequestState will check the mode and will update the correct request (Driver of user)*/
+    pPowerSrvSM->pSmRequest->requestState = PENDING_REQUEST;
+    return POWER_SAVE_802_11_PENDING;
+}
+
+
+
+/****************************************************************************************
+ *                        powerSrvSmDoAllready                                                       *
+ *****************************************************************************************
+DESCRIPTION: This function is an action of the state machine stays in the same state since it the requested
+              one in the request
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK
+****************************************************************************************/
+static TI_STATUS powerSrvSmDoAllready(TI_HANDLE hPowerSrvSM)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    /*powerSrv_SetRequestState will check the mode and will update the correct request (Driver of user)*/
+    pPowerSrvSM->pSmRequest->requestState = HANDLED_REQUEST;
+    return POWER_SAVE_802_11_IS_CURRENT;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvSMActionUnexpected                                                 *
+ *****************************************************************************************
+DESCRIPTION: This function is an action of the state machine stays in the same state and return that action
+              was not expected
+                                                                                                                   
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.
+
+OUTPUT: 
+RETURN:    TI_STATUS - TI_OK
+****************************************************************************************/
+static TI_STATUS powerSrvSMActionUnexpected(TI_HANDLE hPowerSrvSM)
+{
+#ifdef TI_DBG
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    TRACE0(pPowerSrvSM->hReport, REPORT_SEVERITY_ERROR, "called: powerSrvSMActionUnexpected");
+#endif /* TI_DBG */
+
+    return TI_OK;
+}
+
+
+/****************************************************************************************
+ *                        powerSrvSmSMEvent                                                      *
+ *****************************************************************************************
+DESCRIPTION: This function is the manager of the state macine. its move the state machine
+              from one state to the other depend on the receive event, and call to the appropriate
+              action (function) for the move between the states.
+                                                                                                                   
+INPUT:      - pCurrentState
+            - event
+            - hPowerSrvSM                       - handle to the PowerSrvSM object.
+
+OUTPUT: 
+RETURN:    TI_STATUS 
+****************************************************************************************/
+static TI_STATUS powerSrvSmSMEvent(TI_UINT8* pCurrentState,
+                                   TI_UINT8 event,
+                                   TI_HANDLE hPowerSrvSM)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    TI_STATUS status = TI_OK;
+    TI_UINT8 nextState;
+
+    status = fsm_GetNextState((fsm_stateMachine_t*)pPowerSrvSM->hFSM,
+                              (TI_UINT8)pPowerSrvSM->currentState,
+                              event,
+                              &nextState);
+    if ( status != TI_OK )
+    {
+        TRACE0(pPowerSrvSM->hReport, REPORT_SEVERITY_SM, "PowerSrvSM - State machine error, failed getting next state\n");
+        return(status);
+    }
+
+
+	TRACE3( pPowerSrvSM->hReport, REPORT_SEVERITY_INFORMATION, "powerSrvSmSMEvent: <currentState = %d, event = %d> --> nextState = %d\n", *pCurrentState, event, nextState);
+
+    status = fsm_Event(pPowerSrvSM->hFSM,
+                       pCurrentState,
+                       event,
+                       (void*)pPowerSrvSM);
+
+    return status;
+}
+
+
+/****************************************************************************************
+*                        powerSrvSMSendMBXConfiguration                                             *
+*****************************************************************************************
+DESCRIPTION: This function send configuration of the power save option that holds in the command
+                mailbox inner sturcture.
+                                                                                                                  
+INPUT:      - hPowerSrvSM                       - handle to the PowerSrvSM object.
+           - PS_disableEnable                      - true = PS , false = active
+
+OUTPUT: 
+RETURN:    TI_STATUS 
+****************************************************************************************/
+static TI_STATUS    powerSrvSMSendMBXConfiguration(TI_HANDLE hPowerSrvSM, TI_BOOL PS_disableEnable)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+    TPowerSaveParams powerSaveParams;
+    TI_STATUS status;
+
+    /*setting the params for the Hal*/
+    powerSaveParams.hangOverPeriod          = pPowerSrvSM->hangOverPeriod;
+    powerSaveParams.numNullPktRetries       = pPowerSrvSM->numNullPktRetries;
+    powerSaveParams.NullPktRateModulation   = pPowerSrvSM->NullPktRateModulation;
+    powerSaveParams.needToSendNullData      = pPowerSrvSM->pSmRequest->sendNullDataOnExit;
+    powerSaveParams.ps802_11Enable          = PS_disableEnable;
+
+    /* start the FW guard timer, which is used to protect from FW stuck */
+    tmr_StartTimer (pPowerSrvSM->hPwrSrvSmTimer,
+                    powerSrvSMTimerExpired,
+                    (TI_HANDLE)pPowerSrvSM,
+                    POWER_SAVE_GUARD_TIME_MS,
+                    TI_FALSE);
+
+    /* that command should be sent to FW just in case we moved from Active to one of the PS modes
+     * and vice versa, it shoul not be sent when moving between different PS modes */
+    status = cmdBld_CmdSetPsMode (pPowerSrvSM->hCmdBld, 
+                                  &powerSaveParams,
+                                  (void *)pPowerSrvSM->pSmRequest->powerSaveCmdResponseCB,
+                                  (pPowerSrvSM->pSmRequest->powerSaveCmdResponseCB == NULL) ? NULL : pPowerSrvSM->pSmRequest->powerSaveCBObject);
+                                      
+    if ( status != TI_OK )
+    {
+        TRACE0(pPowerSrvSM->hReport, REPORT_SEVERITY_ERROR, "Error in configuring Power Manager paramters!\n");
+    }
+
+    return status;
+}
+
+/****************************************************************************************
+*                               powerSrvSMTimerExpired                                  *
+*****************************************************************************************
+DESCRIPTION: This function is called upon timer expiry - when the FW has not returned
+             a response within the defined tme (50 ms)
+                                                                                                                  
+INPUT:      hPowerSrvSM     - handle to the PowerSrvSM object.
+            bTwdInitOccured - Indicates if TWDriver recovery occured since timer started 
+
+OUTPUT:    None
+
+RETURN:    None
+****************************************************************************************/
+static void powerSrvSMTimerExpired (TI_HANDLE hPowerSrvSM, TI_BOOL bTwdInitOccured)
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    /* Print an error message */
+    TRACE0(pPowerSrvSM->hReport, REPORT_SEVERITY_ERROR, "PS guard timer expired!\n");
+
+    /* Call the error notification callback (triggering recovery) */
+    pPowerSrvSM->failureEventCB( pPowerSrvSM->hFailureEventObj ,POWER_SAVE_FAILURE );
+}
+
+/****************************************************************************************
+ *                        powerSrvRegisterFailureEventCB                                                    *
+ ****************************************************************************************
+DESCRIPTION: Registers a failure event callback for PS SM error notifications.
+                
+                                                                                                                   
+INPUT:      - hPowerSrv         - handle to the PowerSrv object.        
+            - failureEventCB    - the failure event callback function.\n
+            - hFailureEventObj - handle to the object passed to the failure event callback function.
+
+OUTPUT: 
+RETURN:    void.
+****************************************************************************************/
+void powerSrvSM_RegisterFailureEventCB( TI_HANDLE hPowerSrvSM, 
+                                        void *failureEventCB, TI_HANDLE hFailureEventObj )
+{
+    PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)hPowerSrvSM;
+
+    pPowerSrvSM->failureEventCB = (TFailureEventCb)failureEventCB;
+    pPowerSrvSM->hFailureEventObj = hFailureEventObj;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/PowerSrvSM.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,286 @@
+/*
+ * PowerSrvSM.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 PowerSrvSM.h
+ *  \brief This is the PowerSrv module API.
+ *  \author Assaf Azulay
+ *  \date 6-Oct-2005
+ */
+
+/****************************************************************************
+ *                                                                                                        *
+ *   MODULE:  PowerSrv                                                                              *
+ *   PURPOSE: Power Server State machine API                                                    *
+ *                                                                                                              *
+ ****************************************************************************/
+
+#ifndef _POWER_SRV_SM_H_
+#define _POWER_SRV_SM_H_
+
+#include "PowerSrv_API.h"
+#include "PowerSrv.h"
+
+
+
+/*****************************************************************************
+ **         Constants                                                       **
+ *****************************************************************************/
+
+#define POWER_SAVE_GUARD_TIME_MS            5000       /* The gaurd time used to protect from FW stuck */
+
+/*****************************************************************************
+ **         Enumerations                                                    **
+ *****************************************************************************/
+
+/** \enum PowerSrvSMEvents_e */
+typedef enum 
+{
+        POWER_SRV_EVENT_REQUEST_ACTIVE , 
+    POWER_SRV_EVENT_REQUEST_PS ,
+    POWER_SRV_EVENT_SUCCESS,
+    POWER_SRV_EVENT_FAIL ,
+    POWER_SRV_SM_EVENT_NUM
+}PowerSrvSMEvents_e;
+
+/** \enum PowerSrvSMStates_e */
+typedef enum 
+{
+    POWER_SRV_STATE_ACTIVE = 0,
+    POWER_SRV_STATE_PEND_PS ,
+    POWER_SRV_STATE_PS ,
+    POWER_SRV_STATE_PEND_ACTIVE ,
+    POWER_SRV_STATE_ERROR_ACTIVE,
+    POWER_SRV_SM_STATE_NUM
+}PowerSrvSMStates_e;
+
+
+
+/*****************************************************************************
+ **         Structures                                                      **
+ *****************************************************************************/
+
+/** \struct PowerSrvSM_t */
+typedef struct
+{
+    TI_HANDLE               hCmdBld;                    /**< 
+                                                         * Handle to the power controller object via the command builder.
+                                                         * Need for configure the desired power mode policy in the system.
+                                                         */
+
+    TI_HANDLE               hOS;                        /**< Handle to the OS object. */
+
+    TI_HANDLE               hReport;                    /**< Handle to the Report module. */
+
+    TI_HANDLE               hFSM;                       /**< Handle to the State machine module. */
+
+    TI_HANDLE               hTimer;                     /**< Handle to the Timer module. */
+
+    TI_HANDLE               hPwrSrvSmTimer;             /**< Guard timer for PS commands sent to the FW */
+
+    PowerSrvSMStates_e      currentState;               /**< the current state of the state machine. */
+
+    powerSrvRequest_t*      pSmRequest;                 /**< pointer to the relevant request in the power server. */
+
+    TI_UINT8                hangOverPeriod;             /**< parameter for the FW */
+
+    TI_UINT8                numNullPktRetries;          /**< parameter for the FW */
+    
+    EHwRateBitFiled         NullPktRateModulation;      /**< parameter for the FW */
+
+    TFailureEventCb         failureEventCB;             /**< Failure event callback */
+
+    TI_HANDLE               hFailureEventObj;           /**< Failure event object (supplied to the above callback) */
+} PowerSrvSM_t;
+
+
+
+
+
+
+
+/*****************************************************************************
+ **         External data definitions                                       **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         External functions definitions                                  **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         Public Function prototypes                                      **
+ *****************************************************************************/
+
+/**
+ * \author Assaf Azulay
+ * \date 6-Oct-2005\n
+ * \brief Creates the object of the PowerSrv.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the OS.\n
+ * Return Value: TI_HANDLE - handle to the PowerSrv object.\n
+ */
+TI_HANDLE powerSrvSM_create(TI_HANDLE hOsHandle);
+
+/**
+ * \author Assaf Azulay
+ * \date 6-Oct-2005\n
+ * \brief Destroy the object of the PowerSrvSM.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrv object.\n
+ * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n
+ */
+TI_STATUS powerSrvSM_destroy(TI_HANDLE thePowerSrvSMHandle);
+
+/**
+ * \author Assaf Azulay
+ * \date 6-Oct-2005\n
+ * \brief Initialize the PowerSrvSM module.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
+ * 2) TI_HANDLE - handle to the Report object.
+ * 3) TI_HANDLE - handle to the Command Builder object.
+ * 4) TI_HANDLE - handle to the Timer module object.
+ * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n
+ */
+TI_STATUS powerSrvSM_init (TI_HANDLE hPowerSrvSM,
+                           TI_HANDLE hReport,
+                           TI_HANDLE hCmdBld,
+                           TI_HANDLE hTimer);
+
+TI_STATUS powerSrvSM_config(TI_HANDLE hPowerSrvSM,
+                            TPowerSrvInitParams *pPowerSrvInitParams);
+/**
+ * \author Assaf Azulay
+ * \date 6-Oct-2005\n
+ * \brief return the component version.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
+ * Return Value: TI_UINT32 - component version code.\n
+ */
+
+TI_STATUS powerSrvSM_SMApi(TI_HANDLE hPowerSrvSM,
+                                            PowerSrvSMEvents_e theSMEvent);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 020-Oct-2005\n
+ * \brief This function sets the current SM working request.\n
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
+ * 2) powerSrvRequest_t* pSmRequest - desierd request./n
+ * Return Value: TI_STATUS -  TI_OK.\n
+ */
+TI_STATUS powerSrvSm_setSmRequest(TI_HANDLE hPowerSrvSM,powerSrvRequest_t* pSmRequest);
+
+
+
+/**
+ * \author Assaf Azulay
+ * \date 09-Jun-2004\n
+ * \brief get the current state of the state machine.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
+ * Return Value: PowerCtrlSMStates_e.\n
+ */
+PowerSrvSMStates_e powerSrvSM_getCurrentState(TI_HANDLE hPowerSrvSM);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 20-July-2004\n
+ * \brief sets rate modulation
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
+ * 2) rate_e rate modulation
+ * Return Value: void.\n
+ */
+void powerSrvSM_setRateModulation(TI_HANDLE hPowerSrvSM, TI_UINT16 rateModulation);
+
+/**
+ * \brief sets rate modulation
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrvSM object.\n* 
+ * Return Value: TI_UINT16 Rate.\n
+ */
+TI_UINT32 powerSrvSM_getRateModulation(TI_HANDLE hPowerSrvSM);
+
+/**
+ * \author Assaf Azulay
+ * \date 20-July-2004\n
+ * \brief print configuration of the PowerSrvSM object - use for debug!
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
+ * Return Value: void.\n
+ */
+void powerSrvSM_printObject(TI_HANDLE hPowerSrvSM);
+
+/**
+ * \author Ronen Kalish
+ * \date 21-August-2006\n
+ * \brief Registers a failure event callback for power save error notifications (timer expiry).\n
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * - hPowerSrvSM      - handle to the PowerSrv object.        
+ * - failureEventCB     - the failure event callback function.
+ * - hFailureEventObj   - handle to the object passed to the failure event callback function.
+*/
+void powerSrvSM_RegisterFailureEventCB( TI_HANDLE hPowerSrvSM, 
+                                        void* failureEventCB, TI_HANDLE hFailureEventObj );
+#endif /*  _POWER_SRV_SM_H_  */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/PowerSrv_API.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,286 @@
+/*
+ * PowerSrv_API.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 powerSrv_API.h
+ *  \brief This is the Power Manager module API.
+ *  \author Yaron Menashe
+ */
+
+/****************************************************************************
+ *                                                                          *
+ *   MODULE:  Power Server                                                 *
+ *   PURPOSE: Power Server Module API                                      *
+ *                                                                          *
+ ****************************************************************************/
+
+#ifndef _POWER_SRV_API_H_
+#define _POWER_SRV_API_H_
+
+#include "MacServices_api.h"
+
+/*****************************************************************************
+ **         Constants                                                       **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         Enumerations                                                    **
+ *****************************************************************************/
+
+
+
+/*****************************************************************************
+ **         Typedefs                                                        **
+ *****************************************************************************/
+/*typedef void (*powerSaveCmdResponseCB_t )(TI_HANDLE cmdResponseHandle,TI_UINT8 MboxStatus);*/
+typedef TPowerSaveResponseCb powerSaveCmdResponseCB_t;
+/*typedef void (*powerSaveCmpltCB_t )(TI_HANDLE powerSaveCmpltHandle,TI_UINT8 PSMode,TI_UINT8 transStatus);*/
+typedef TPowerSaveCompleteCb powerSaveCmpltCB_t;
+/*****************************************************************************
+ **         Structures                                                      **
+ *****************************************************************************/
+
+
+
+
+/*****************************************************************************
+ **         External data definitions                                       **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         External functions definitions                                  **
+ *****************************************************************************/
+
+
+/*****************************************************************************
+ **         Public Function prototypes                                      **
+ *****************************************************************************/
+
+
+/**
+ * \author Assaf Azulay
+ * \date 20-Oct-2005\n
+ * \brief Creates the object of the power Server.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the OS.\n
+ * Return Value: TI_HANDLE - handle to the powerSrv object.\n
+ */
+TI_HANDLE powerSrv_create(TI_HANDLE hOs);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 27-Apr-2005\n
+ * \brief Destroy the object of the power Server.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the powerSrv object.\n
+ * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n
+ */
+TI_STATUS powerSrv_destroy(TI_HANDLE hPowerSrv);
+
+
+/**
+  * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief Initialization of the powerSrv module.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the powerSrv object.\n
+ * 3) TI_HANDLE - handle to the Report object.\n
+ * 2) TI_HANDLE - handle to the EventMbox object.\n
+ * 4) TI_HANDLE - handle to the CommandBuilder object.\n
+ * 5) TI_HANDLE - handle to the Timer module object.\n
+ * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n
+ */
+TI_STATUS powerSrv_init (TI_HANDLE hPowerSrv,
+                         TI_HANDLE hReport,
+                         TI_HANDLE hEventMbox,
+                         TI_HANDLE hCmdBld,
+                         TI_HANDLE hTimer);
+
+
+TI_STATUS powerSrv_config(TI_HANDLE 				hPowerSrv,
+				          TPowerSrvInitParams      *pPowerSrvInitParams);
+
+/**
+  * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief request PS by User
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) hPowerSrv 						- handle to the PowerSrv object.\n		
+ * 2) psMode							- Power save/Active request.\n
+ * 3) sendNullDataOnExit				- \n
+ * 4) powerSaveCompleteCBObject		- handle to the Callback functin module.\n
+ * 5) powerSaveCompleteCB				- Calback function - for success/faild notification.\n
+ * 6) powerSavecmdResponseCB			- Calback function - for GWSI success/faild notification.\n
+ * Return Value: TI_STATUS - TI_OK / PENDING / TI_NOK.\n
+ * \b Description:\n
+ * This function is a user mode request from the Power Save Server./n
+ * it will create a Request from typ "USER_REQUEST" and will try to perform the user request for PS/Active./n
+ * this will be done in respect of priority to Driver request./n
+ */
+TI_STATUS powerSrv_SetPsMode (TI_HANDLE 					hPowerSrv,
+                              E80211PsMode	                psMode,
+ 							  TI_BOOL  						sendNullDataOnExit,
+ 						      void * 						powerSaveCompleteCBObject,
+ 						      powerSaveCmpltCB_t  			powerSaveCompleteCB,
+ 						      powerSaveCmdResponseCB_t	    powerSavecmdResponseCB);
+
+
+/**
+  * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief SW configure, use to override the current PowerMode (what ever it will be) to
+ *        active/PS combined with awake/power-down. use for temporary change the system policy.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the powerSrv object.\n
+ * 2) powerSrv_RequestFor_802_11_PS_e - the driver mode obliged to be in 802.11 PS or not change.\n
+ * 3) PowerCtrl_PowerLevel_e - the desired driver power level (allowed: AWAKE or POWER DOWN).\n
+ * 4) TI_HANDLE theObjectHandle - the handle the object that need the PS success/fail notification.\n
+ * 5) ps802_11_NotificationCB_t - the callback function.\n
+ * 6) char* - the clinet name that ask for driver mode.\n
+ * Return Value: TI_STATUS - if success (already in power save) then TI_OK,\n
+ *                           if pend (wait to ACK form AP for the null data frame) then PENDING\n
+ *                           if PS isn't enabled then POWER_SAVE_802_11_NOT_ALLOWED\n
+ *                           else TI_NOK.\n
+ * \b Description:\n
+ * enter in to configuration of the driver that in higher priority from the user.\n
+ * the configuration is:\n
+ *  - to enter to802.11 PS or not (if not this isn't a request to get out from 802.11 PS).\n
+ *  - to change the HW power level to awake or power-down if not already there.
+ *    this is a must request.\n
+*/
+TI_STATUS powerSrv_ReservePS (TI_HANDLE 				hPowerSrv,
+							  E80211PsMode              psMode,
+ 						 	  TI_BOOL  					sendNullDataOnExit,
+ 							  void * 					powerSaveCBObject,
+							  powerSaveCmpltCB_t 		powerSaveCompleteCB);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief end the temporary change of system policy, and returns to the user system policy.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the powerSrv object.\n
+ * 2) char* - the clinet name that ask for driver mode.\n
+ * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n
+ * \b Description:\n
+ * enter in to configuration of the driver that in higher priority from the user.\n
+ * the configuration is:\n
+ * end the user mode configuration (driver mode priority) and returns the user configuration
+ * (user mode priority).
+*/
+TI_STATUS powerSrv_ReleasePS( 	TI_HANDLE 					hPowerSrv,
+									TI_BOOL  						sendNullDataOnExit,
+ 						 			void *  						powerSaveCBObject,
+ 									powerSaveCmpltCB_t  			powerSaveCompleteCB);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \brief reflects the actual state of the state machine
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE - handle to the powerSrv object.\n
+ * Return Value:\n 
+ * TI_BOOL - thre is in PS false otherwise.\n
+*/
+TI_BOOL powerSrv_getPsStatus(TI_HANDLE hPowerSrv);
+
+
+/**
+ * \author Assaf Azulay
+ * \date 24-Oct-2005\n
+ * \sets the rate as got from user else sets default value.\n
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE 	- handle to the powerSrv object.\n
+ * 2) TI_UINT16		- desierd rate .\n
+ * Return Value:\n 
+ * void.\n
+*/
+void powerSrv_SetRateModulation(TI_HANDLE hPowerSrv, TI_UINT16  rate);
+
+
+
+/**
+ * \author Assaf Azulay
+ * \date 9-Mar-2006\n
+ * \brief Registers a failure event callback for scan error notifications.
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * - hPowerSrv 		- handle to the PowerSrv object.		
+ * - failureEventCB 	- the failure event callback function.
+ * - hFailureEventObj 	- handle to the object passed to the failure event callback function.
+*/
+void powerSrvRegisterFailureEventCB( TI_HANDLE hPowerSrv, 
+                                     void * failureEventCB, TI_HANDLE hFailureEventObj );
+
+
+/**
+ * \date 03-Jul-2006\n
+ * \return the rate as it was seted by powerSrv_SetRateModulation.\n
+ *
+ * Function Scope \e Public.\n
+ * Parameters:\n
+ * 1) TI_HANDLE 	- handle to the powerSrv object.\n
+ * Return Value: TI_UINT16		- desierd rate .\n
+ * void.\n
+*/
+TI_UINT32 powerSrv_GetRateModulation(TI_HANDLE hPowerSrv);
+
+TI_STATUS powerSrv_restart(	TI_HANDLE hPowerSrv);
+
+#endif /*  _POWER_SRV_API_H_  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/ScanSrv.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,752 @@
+/*
+ * ScanSrv.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 ScanSrv.c
+ *  \brief This file include the scan SRV module implementation
+ *
+ *  \see   ScanSrv.h, ScanSrvSm.h, ScanSrvSm.c
+ */
+
+
+#define __FILE_ID__  FILE_ID_115
+#include "report.h"
+#include "timer.h"
+#include "ScanSrv.h"
+#include "ScanSrvSM.h"
+#include "MacServices.h"
+#include "MacServices_api.h"
+#include "eventMbox_api.h"
+#include "CmdBld.h"
+
+/**
+ * \date 16-Oct-2004\n
+ * \brief Creates the scan SRV object
+ *
+ * Function Scope \e Public.\n
+ * \param hOS - handle to the OS object.\n
+ * \return a handle to the scan SRV object, NULL if an error occurred.\n
+ */
+TI_HANDLE MacServices_scanSRV_create( TI_HANDLE hOS )
+{
+    /* allocate the scan SRV object */
+    scanSRV_t *pScanSRV = os_memoryAlloc( hOS, sizeof(scanSRV_t),MemoryNormal);
+    if ( NULL == pScanSRV )
+    {
+        WLAN_OS_REPORT( ("ERROR: Failed to create scan SRV module"));
+        return NULL;
+    }
+
+    /* allocate the state machine */
+    if ( TI_OK != fsm_Create( hOS, &(pScanSRV->SM), SCAN_SRV_NUM_OF_STATES, SCAN_SRV_NUM_OF_EVENTS ))
+    {
+        WLAN_OS_REPORT( ("ERROR: Failed to allocate scan SRV state machine"));
+        os_memoryFree( hOS, pScanSRV, sizeof(scanSRV_t));
+        return NULL;
+    }
+ 
+    /* store the OS handle */
+    pScanSRV->hOS = hOS;
+
+    return pScanSRV;
+}
+
+/**
+ * \date 29-Dec-2004\n
+ * \brief Finalizes the scan SRV module (releasing memory and timer)
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ */
+void MacServices_scanSRV_destroy( TI_HANDLE hScanSRV )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSRV;
+
+    /* free timer */
+    tmr_DestroyTimer (pScanSRV->hScanSrvTimer);
+    
+    /* free memory */
+    fsm_Unload( pScanSRV->hOS, pScanSRV->SM );
+    os_memoryFree( pScanSRV->hOS, (TI_HANDLE)pScanSRV , sizeof(scanSRV_t));
+}
+
+/**
+ * \date 29-Dec-2004\n
+ * \brief Initializes the scan SRV module, registers SCAN_COMPLETE to HAL.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param Handles of other modules.\n
+  */
+TI_STATUS MacServices_scanSRV_init (TI_HANDLE hMacServices,
+                                    TI_HANDLE hReport,
+                                    TI_HANDLE hTWD,
+                                    TI_HANDLE hTimer,
+                                    TI_HANDLE hEventMbox,
+                                    TI_HANDLE hCmdBld)
+{
+    MacServices_t* pMacServices =  (MacServices_t*)hMacServices;
+    scanSRV_t *pScanSRV =  pMacServices->hScanSRV;
+
+    /* store handles */
+    pScanSRV->hTWD = hTWD;
+    pScanSRV->hTimer = hTimer;
+    pScanSRV->hReport = hReport;
+    pScanSRV->hEventMbox = hEventMbox;
+    pScanSRV->hPowerSrv = pMacServices->hPowerSrv;
+    pScanSRV->hCmdBld = hCmdBld;
+    pScanSRV->commandResponseFunc = NULL;
+    pScanSRV->commandResponseObj = NULL;  
+
+    /* create the timer */
+    pScanSRV->hScanSrvTimer = tmr_CreateTimer (pScanSRV->hTimer);
+	if (pScanSRV->hScanSrvTimer == NULL)
+	{
+        TRACE0(pScanSRV->hReport, REPORT_SEVERITY_ERROR, "MacServices_scanSRV_init(): Failed to create hScanSrvTimer!\n");
+		return TI_NOK;
+	}
+
+    /* init state machine */
+    scanSRVSM_init ((TI_HANDLE)pScanSRV);
+
+    /* Register our scan complete handler to the HAL events mailbox */
+    eventMbox_RegisterEvent (pScanSRV->hEventMbox, 
+                              TWD_OWN_EVENT_SCAN_CMPLT, 
+                              (void *)MacServices_scanSRV_scanCompleteCB, 
+                              (TI_HANDLE)pScanSRV); 
+    eventMbox_RegisterEvent (pScanSRV->hEventMbox, 
+                              TWD_OWN_EVENT_SPS_SCAN_CMPLT, 
+                              (void *)MacServices_scanSRV_scanCompleteCB, 
+                              (TI_HANDLE)pScanSRV);
+
+    /* init other stuff */
+    pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents = 0;
+
+    TRACE0( hReport, REPORT_SEVERITY_INIT, ".....Scan SRV configured successfully.\n");
+
+    return TI_OK;
+}
+
+/**
+ * \brief Restart the scan SRV module upon recovery.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ */
+void scanSRV_restart (TI_HANDLE hScanSRV)
+{
+	scanSRV_t *pScanSRV =  (scanSRV_t *)hScanSRV;
+    /* init state machine */
+	/* initialize current state */
+	pScanSRV->SMState = SCAN_SRV_STATE_IDLE;
+
+    if (pScanSRV->bTimerRunning)
+    {
+        tmr_StopTimer (pScanSRV->hScanSrvTimer);
+        pScanSRV->bTimerRunning = TI_FALSE;
+    }
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 26-July-2006\n
+ * \brief Configures the scan SRV module with initialization values
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param hReport - handle to the report object.\n
+ * \param hTWD - handle to the HAL ctrl object.\n
+  */
+void MacServices_scanSrv_config( TI_HANDLE hMacServices, TScanSrvInitParams* pInitParams )
+{
+    MacServices_t* pMacServices =  (MacServices_t*)hMacServices;
+    scanSRV_t *pScanSRV =  pMacServices->hScanSRV;
+
+    pScanSRV->numberOfNoScanCompleteToRecovery = pInitParams->numberOfNoScanCompleteToRecovery;
+
+    /* Set Triggered scan time out per channel */
+    pScanSRV->uTriggeredScanTimeOut = pInitParams->uTriggeredScanTimeOut;
+	TWD_CmdSetSplitScanTimeOut (pScanSRV->hTWD, pScanSRV->uTriggeredScanTimeOut);
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Registers a complete callback for scan complete notifications.
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param scanCompleteCB - the complete callback function.\n
+ * \param hScanCompleteObj - handle to the object passed to the scan complete callback function.\n
+ */
+void MacServices_scanSRV_registerScanCompleteCB( TI_HANDLE hMacServices, 
+                                     TScanSrvCompleteCb scanCompleteCB, TI_HANDLE hScanCompleteObj )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)((MacServices_t*)hMacServices)->hScanSRV;
+
+    pScanSRV->scanCompleteNotificationFunc = scanCompleteCB;
+    pScanSRV->scanCompleteNotificationObj = hScanCompleteObj;
+}
+
+/**
+ * \brief Registers a failure event callback for scan error notifications.
+ *
+ * Function Scope \e member.\n
+ * \param hScanSRV - handle to the Scan SRV object.\n
+ * \param failureEventCB - the failure event callback function.\n
+ * \param hFailureEventObj - handle to the object passed to the failure event callback function.\n
+ */
+void scanSRV_registerFailureEventCB( TI_HANDLE hScanSRV, 
+                                     void * failureEventCB, TI_HANDLE hFailureEventObj )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)(hScanSRV);
+
+    pScanSRV->failureEventFunc  = (TFailureEventCb)failureEventCB;
+    pScanSRV->failureEventObj   = hFailureEventObj;
+}
+
+/**
+ * \date 27-Sep-2005\n
+ * \brief This function is the CB which is called as response to 'StartScan' or 'StopScan' \n.
+ *        here we check if there is a GWSI command response , and call it if necessary .\n
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \param MboxStatus - mailbox status. \n
+ */
+void MacServices_scanSRVCommandMailBoxCB(TI_HANDLE hScanSrv,TI_UINT16 MboxStatus)
+{
+    scanSRV_t* pScanSRV = (scanSRV_t*)hScanSrv;
+    TI_UINT16 responseStatus;
+    TCmdResponseCb CB_Func;
+    TI_HANDLE  CB_Handle;
+
+    TRACE1( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, " status %u\n",MboxStatus);
+
+    /* set response to TI_OK or TI_NOK */
+    responseStatus = ((MboxStatus > 0) ? TI_NOK : TI_OK);
+    
+    /* if we have a Response Function (only in GWSI) we set it back to NULL and then 
+        we call it */
+    if (pScanSRV->commandResponseFunc != NULL)
+    {
+        CB_Func = pScanSRV->commandResponseFunc;
+        CB_Handle = pScanSRV->commandResponseObj;
+
+        pScanSRV->commandResponseFunc = NULL;
+        pScanSRV->commandResponseObj = NULL;
+
+        CB_Func(CB_Handle, responseStatus);
+    }
+     /* if scan request failed */
+    if ( TI_OK != responseStatus )
+    {
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_ERROR, "Mail box returned error , quitting scan.\n");
+
+        /* send a scan complete event. This will do all necessary clean-up (timer, power manager, notifying scan complete) */
+        scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_SCAN_COMPLETE );
+    }
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Performs a scan
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param scanParams - the scan specific parameters.\n
+ * \param eScanresultTag - tag used for result and scan complete tracking
+ * \param bHighPriority - whether to perform a high priority (overlaps DTIM) scan.\n
+ * \param bDriverMode - whether to try to enter driver mode (with PS on) before issuing the scan command.\n
+ * \param bScanOnDriverModeError - whether to proceed with the scan if requested to enter driver mode and failed.\n
+ * \param psRequest - Parameter sent to PowerSaveServer on PS request to indicate PS on or "keep current" 
+ * \param bSendNullData - whether to send Null data when exiting driver mode on scan complete.\n
+ * \param commandResponseFunc - CB function which called after downloading the command. \n
+ * \param commandResponseObj -  The CB function Obj (Notice : last 2 params are NULL in Legacy run). \n
+ * \param psRequest - Parameter sent to PowerSaveServer on PS request to indicate PS on or "keep current" 
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */
+TI_STATUS MacServices_scanSRV_scan( TI_HANDLE hMacServices, TScanParams *scanParams, EScanResultTag eScanTag,
+                                    TI_BOOL bHighPriority, TI_BOOL bDriverMode, TI_BOOL bScanOnDriverModeError, 
+                        E80211PsMode psRequest, TI_BOOL bSendNullData,
+                        TCmdResponseCb commandResponseFunc, TI_HANDLE commandResponseObj)
+{
+   scanSRV_t *pScanSRV = (scanSRV_t*)((MacServices_t*)hMacServices)->hScanSRV;
+
+
+    TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Scan request received.\n");
+
+    /* sanity check - scan can only start if the scan SRV is idle */
+    if ( SCAN_SRV_STATE_IDLE != pScanSRV->SMState )
+    {
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_WARNING, "Scan request while scan is running!\n");
+        return TI_NOK;
+    }
+
+    /* Response function for GWSI only. In Legacy run we get NULL and never use it. */
+    pScanSRV->commandResponseFunc = commandResponseFunc;
+    pScanSRV->commandResponseObj  = commandResponseObj;
+
+    pScanSRV->bInRequest = TI_TRUE;
+    pScanSRV->returnStatus = TI_OK;
+
+    /* copy scan paramaters */
+    pScanSRV->scanParams = scanParams;
+    pScanSRV->eScanTag = eScanTag;
+    pScanSRV->uResultCount = 0;
+    pScanSRV->bHighPriority = bHighPriority;
+    pScanSRV->bScanOnDriverModeFailure = bScanOnDriverModeError;
+    pScanSRV->bSendNullData = bSendNullData;
+    pScanSRV->psRequest = psRequest;
+
+    if ( SCAN_TYPE_SPS == scanParams->scanType )
+    {
+        pScanSRV->bSPSScan = TI_TRUE;
+
+    }
+    else
+    {
+        pScanSRV->bSPSScan = TI_FALSE;
+    }
+
+
+    /* check whether the scan will overlap DTIM frame */
+    if ( (TI_FALSE == bHighPriority) && (TI_TRUE == bDriverMode))
+    {
+        pScanSRV->bDtimOverlapping = TI_FALSE;
+    }
+    else
+    {
+        pScanSRV->bDtimOverlapping = TI_TRUE;
+    }
+
+    /* mark the no scan complete flag. The purpose of this flag is to be able to identify
+       whether the scan complete is a normal process, or was it generated because a no scan ocmplete
+       was identified, a stop scan command was snet to the FW, and thus a scan complete was received.
+       In the former case we nullify the consecutive no scan complete counter, whereas in the latter
+       we do not. */
+    pScanSRV->bNoScanCompleteFlag = TI_FALSE;
+
+    /* if required to enter driver mode */
+    if ( TI_TRUE == bDriverMode )
+    {
+        pScanSRV->bExitFromDriverMode = TI_TRUE;
+        /* send a PS_REQUEST event */
+        scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&(pScanSRV->SMState), SCAN_SRV_EVENT_REQUEST_PS );
+    }
+    /* no driver mode required */
+    else
+    {
+        pScanSRV->bExitFromDriverMode = TI_FALSE;
+        /* send a PS_SUCCESS event - will start the scan */
+        scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS );
+    }
+
+    pScanSRV->bInRequest = TI_FALSE;
+    
+    return pScanSRV->returnStatus;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Sends a Stop Scan command to FW, no matter if we are in scan progress or not
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param eScanTag - scan tag, used for scan complete and result tracking
+ * \param bSendNullData - indicates whether to send Null data when exiting driver mode.\n
+ * \param commandResponseFunc - CB function which called after downloading the command. \n
+ * \param commandResponseObj -  The CB function Obj (Notice : last 2 params are NULL in Legacy run). \n
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */
+TI_STATUS MacServices_scanSRV_stopScan( TI_HANDLE hMacServices, EScanResultTag eScanTag, TI_BOOL bSendNullData,
+                                        TCmdResponseCb ScanCommandResponseCB, TI_HANDLE CB_handle )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)((MacServices_t*)hMacServices)->hScanSRV;
+    TI_INT32 stopScanStatus;
+
+    TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Stop scan request received.\n");
+
+    /* update the driver mode exit flag */
+    pScanSRV->bSendNullData = bSendNullData;
+
+    if ( TI_TRUE == pScanSRV->bSPSScan )
+    {
+        stopScanStatus = cmdBld_CmdStopSPSScan (pScanSRV->hCmdBld, eScanTag, (void *)ScanCommandResponseCB, CB_handle);
+    }
+    else
+    {
+        stopScanStatus = cmdBld_CmdStopScan (pScanSRV->hCmdBld, eScanTag, (void *)ScanCommandResponseCB, CB_handle);
+    }
+
+    if (TI_OK != stopScanStatus)
+    {
+        return TI_NOK;
+    }
+    
+    /* send a stop scan event */
+    scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_STOP_SCAN );
+
+    return pScanSRV->returnStatus;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 17-Jan-2005\n
+ * \brief Notifies the scan SRV of a FW reset (that had originally been reported by a different module).\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \return TI_OK if successful (various, TBD codes if not).\n
+ */
+TI_STATUS MacServices_scanSRV_stopOnFWReset( TI_HANDLE hMacServices )
+{
+   scanSRV_t *pScanSRV = (scanSRV_t*)((MacServices_t*)hMacServices)->hScanSRV;
+
+    TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "FW reset notification received.\n");
+
+    /* mark the return status */
+    pScanSRV->returnStatus = TI_NOK;
+
+    /* send a FW reset event */
+    return scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_FW_RESET );
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief callback function used by the power server to notify driver mode result
+ *          this CB is used in requesting PS and exiting PS.
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param psStatus - the power save request status.\n
+ */
+void MacServices_scanSRV_powerSaveCB( TI_HANDLE hScanSRV, TI_UINT8 PSMode,TI_UINT8 psStatus )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSRV;
+
+    TRACE1( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "PS Call Back status %d .\n",psStatus);
+
+    /* if driver mode enter/exit succeedded */
+    if ( (ENTER_POWER_SAVE_SUCCESS == psStatus) || (EXIT_POWER_SAVE_SUCCESS == psStatus))
+    {
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "PS successful.\n");
+
+        /* send a PS_SUCCESS event */
+        scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS );
+    }
+    /* driver mode entry failed, and scan is requested even on PS failure but we are entering PS and not Exiting */
+    else if ( (TI_TRUE == pScanSRV->bScanOnDriverModeFailure) && ( ENTER_POWER_SAVE_FAIL == psStatus))
+    {
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "PS enter failed, continune scan .\n");
+
+        /* send a PS_SUCCESS event */
+        scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS );
+    }
+    /* driver mode enter or exit failed */
+    else
+    {
+        /* if we are trying to enter PS and fail to do so - return error on scan complete */
+        if ( ENTER_POWER_SAVE_FAIL == psStatus) 
+        {
+            TRACE0( pScanSRV->hReport, REPORT_SEVERITY_WARNING, "PS enter failed . quiting scan .\n");
+            /* Set the return status  */
+            pScanSRV->returnStatus = TI_NOK;
+        }
+
+        /* send a PS FAIL event */
+        scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_FAIL );
+    }
+}
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Callback function used by the HAL ctrl to notify scan complete
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param str - pointer to scan result buffer (holding SPS status for SPS scan only!).\n
+ * \param strLen - scan result buffer length (should ALWAYS be 2, even for non SPS scans).\n
+ */
+void MacServices_scanSRV_scanCompleteCB( TI_HANDLE hScanSRV, char* str, TI_UINT32 strLen )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSRV;
+    scanCompleteResults_t   *pResult = (scanCompleteResults_t*)str;
+
+    TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Scan complete notification from TNET.\n");
+
+	/* nullify the consecutive no scan complete events counter  - only if this is a scan complete that
+       does not happen afetr a stop scan (due to a timer expiry) */
+	if ( TI_FALSE == pScanSRV->bNoScanCompleteFlag )
+    {
+        pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents = 0;
+    }
+
+    /* copy result counter and scan tag */
+    pScanSRV->uResultCount = pResult->numberOfScanResults;
+    pScanSRV->eScanTag = (EScanResultTag)pResult->scanTag;
+
+    /* copy scan SPS addmitted channels and SPS result */
+    if (TI_FALSE == pScanSRV->bSPSScan) 
+    {
+        /* normal scan - no result is available */
+        pScanSRV->bTSFError = TI_FALSE;
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Normal scan completed.\n");
+    }
+    else
+    {
+        /* SPS scan - first byte indicates whether a TSF error (AP recovery) occured */
+        if ( 0 != (pResult->scheduledScanStatus >> 24))
+        {
+            pScanSRV->bTSFError = TI_TRUE;
+        }
+        else
+        {
+            pScanSRV->bTSFError = TI_FALSE;
+        }
+
+        /* next two bytes indicates on which channels scan was attempted */
+        pScanSRV->SPSScanResult = (TI_UINT16)(pResult->scheduledScanStatus >> 16) | 0xff;
+        pScanSRV->SPSScanResult = ENDIAN_HANDLE_WORD( pScanSRV->SPSScanResult );
+        TRACE1( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "SPS scan completed. TSF error: , SPS result: %x\n", pScanSRV->SPSScanResult);
+    }
+
+    /* send a SCAN_COMPLETE event  */
+    scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_SCAN_COMPLETE );
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief called when a scan timer expires. Completes the scan and starts a recovery process.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param bTwdInitOccured - Indicates if TWDriver recovery occured since timer started.\n
+ */
+void MacServices_scanSRV_scanTimerExpired (TI_HANDLE hScanSRV, TI_BOOL bTwdInitOccured)
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSRV;
+
+    /* mark that no scan complete occured (see sanSRV_scan for more detailed explanation) */
+    pScanSRV->bNoScanCompleteFlag = TI_TRUE;
+
+    /* send a TIMER_EXPIRED event */
+    scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_TIMER_EXPIRED );
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Calculates the maximal time required for a scan operation
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param scanParams - the scan parameters
+ * \param bConsiderDTIM - whether this scan overlaps DTIM
+ * \return the time (in milliseconds)
+ */
+TI_UINT32 MacServices_scanSRVcalculateScanTimeout( TI_HANDLE hScanSRV, TScanParams* scanParams, TI_BOOL bConsiderDTIM )
+{
+    TI_UINT32 i, uDtimPeriodMs, uBeaconIntervalMs, timeout = 0;
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSRV;
+
+    /********************************************************************************
+        timeout calculation is performed according to scan type:
+        1. for normal scan, multiply the channel time by the number of channels.
+           if this scan is not overlapping DTIM, add the DTIM period (in case
+           starting the scan right now will cause the very last milliseconds of the
+           scan to overlap the next DTIM). Add the guard time.
+        2. for triggered scan, multiply the channel time plus the trigger time
+           constant (the maximum time between two frames from the Tid
+           according to which the scan is triggered) by the number of channels.
+           DTIM period is added only as precaution - since the scan is divided to
+           channels, only very few of them will be delayed due to DTIM (in the worst 
+           case), and this delay would be only the length of one channel scan.
+           Eventually, Add the guard time.
+        3. for SPS scan: Measure the time from current TSF to the TSF at which the 
+           scan is scheduled to finish (done by the scan manager, and passed as 
+           a parameter in the scan structure). Add guard time. DTIM overlapping is not 
+           considered because if the scan overlaps DTIM the channels which are 
+           scheduled during the DTIM (if any) won't be scanned.
+     ********************************************************************************/
+
+    /* get DTIM time, if scanning in connected mode and need to consider DTIM */
+    if ( bConsiderDTIM ) 
+    {  
+        /* new dtimPeriod calculation */
+        uBeaconIntervalMs = MacServices_scanSRVConvertTUToMsec (pScanSRV->uBeaconInterval);
+        uDtimPeriodMs     = uBeaconIntervalMs * pScanSRV->uDtimPeriod; 
+    }
+    else
+    {
+        uDtimPeriodMs = 0;
+    }
+
+    switch (scanParams->scanType)
+    {
+    case SCAN_TYPE_NORMAL_ACTIVE:
+    case SCAN_TYPE_NORMAL_PASSIVE:
+        /* the timeout is the scan duration on all channels */
+        for ( i = 0; i < scanParams->numOfChannels; i++ )
+        {
+            timeout += scanParams->channelEntry[ i ].normalChannelEntry.maxChannelDwellTime;
+        }
+        timeout = (timeout / 1000) + uDtimPeriodMs + SCAN_SRV_FW_GUARD_TIME_MS;
+        break;
+
+    case SCAN_TYPE_TRIGGERED_ACTIVE:
+    case SCAN_TYPE_TRIGGERED_PASSIVE:
+        /* the timeout is the scan duration on all channels, plus the maximum time that can pass 
+           between two different frames from the same Tid */
+        for ( i = 0; i < scanParams->numOfChannels; i++ )
+        {
+            timeout += scanParams->channelEntry[ i ].normalChannelEntry.maxChannelDwellTime;
+        }
+        timeout = (timeout / 1000) + uDtimPeriodMs + 
+                  ((pScanSRV->uTriggeredScanTimeOut / 1000 + 1) * scanParams->numOfChannels) + 
+                  SCAN_SRV_FW_GUARD_TIME_MS;
+        break;
+
+    case SCAN_TYPE_SPS:
+        timeout = scanParams->SPSScanDuration + SCAN_SRV_FW_GUARD_TIME_MS;
+        break;
+
+    default:
+        TRACE1( pScanSRV->hReport, REPORT_SEVERITY_ERROR, "Trying to calculate timeout for undefined scan type %d\n", scanParams->scanType);
+        break;
+    }
+    TRACE1( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "scanSRVcalculateScanTimeout, timeout = %d\n", timeout);
+
+    return timeout;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 16-Jan-2005\n
+ * \brief Convert time units (1024 usecs) to millisecs
+ *
+ * Function Scope \e Private.\n
+ * \param tu - the time in time units
+ * \return the time in milliseconds
+ */
+TI_UINT32 MacServices_scanSRVConvertTUToMsec( TI_UINT32 tu )
+{
+    return (tu * 1024) / 1000;
+}
+
+
+/**
+ * \author Arik Klein\n
+ * \brief Save DTIM and Beacon periods for scan timeout calculations
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices    - module object
+ * \param uDtimPeriod     - DTIM period in number of beacons
+ * \param uBeaconInterval - Beacon perios in TUs (1024 msec)
+ * \return void
+ */
+void MacServices_scanSrv_UpdateDtimTbtt (TI_HANDLE hMacServices, 
+                                         TI_UINT8  uDtimPeriod, 
+                                         TI_UINT16 uBeaconInterval)
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)((MacServices_t*)hMacServices)->hScanSRV;
+
+    pScanSRV->uDtimPeriod     = uDtimPeriod;
+    pScanSRV->uBeaconInterval = uBeaconInterval;
+}
+
+
+#ifdef TI_DBG
+/**
+ * \author Shirit Brook\n
+ * \date God knows when...\n
+ * \brief Prints Scan Server SM status.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the Mac Services object.\n
+ * \return always TI_OK.\n
+ */
+void MacServices_scanSrv_printDebugStatus(TI_HANDLE hMacServices)
+{
+   scanSRV_t *pScanSRV = (scanSRV_t*)((MacServices_t*)hMacServices)->hScanSRV;
+
+    WLAN_OS_REPORT(("scanSrv State="));
+    switch (pScanSRV->SMState)
+    {
+    case SCAN_SRV_STATE_IDLE:
+        WLAN_OS_REPORT((" IDLE\n"));
+        break;
+    case SCAN_SRV_STATE_PS_WAIT:
+        WLAN_OS_REPORT((" PS_WAIT\n"));
+        break;
+    case SCAN_SRV_STATE_PS_EXIT:
+        WLAN_OS_REPORT((" PS_EXIT\n"));
+        break;
+    case SCAN_SRV_STATE_SCANNING:
+        WLAN_OS_REPORT((" SCANNING\n"));
+        break;
+    case SCAN_SRV_STATE_STOPPING:
+        WLAN_OS_REPORT((" STOPPING\n"));
+        break;
+    default:
+        WLAN_OS_REPORT((" Invalid State=%d\n",pScanSRV->SMState));
+        break;
+
+    }
+
+    if (NULL != pScanSRV->scanParams)
+    {
+        WLAN_OS_REPORT(("scanSrv bExitFromDriverMode=%d, bHighPriority=%d, bInRequest=%d,\n \
+                        bScanOnDriverModeFailure=%d, bSendNullData=%d, bSPSScan=%d, bTimerRunning=%d, \n \
+                        psRequest=%d, scanType=%d\n", 
+                        pScanSRV->bExitFromDriverMode,
+                        pScanSRV->bHighPriority,
+                        pScanSRV->bInRequest,
+                        pScanSRV->bScanOnDriverModeFailure,
+                        pScanSRV->bSendNullData,
+                        pScanSRV->bSPSScan,
+                        pScanSRV->bTimerRunning,
+                        pScanSRV->psRequest,
+                        pScanSRV->scanParams->scanType));
+    }
+}
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/ScanSrv.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,310 @@
+/*
+ * ScanSrv.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 ScanSrv.h
+ *  \brief This file include private definitions for the scan SRV module.
+ *
+ *  \see   ScanSrv.c, ScanSrvSM.c, ScanSrvSM.h
+ */
+
+
+#ifndef __SCANSRV_H__
+#define __SCANSRV_H__
+
+#include "TWDriverInternal.h"
+#include "MacServices_api.h"
+#include "fsm.h"
+#include "ScanSrvSM.h"
+
+/*
+ ***********************************************************************
+ *  Constant definitions.
+ ***********************************************************************
+ */
+/* guard time for scan (added to calculated scan duration)
+   Value to support extreme case such as A2DP mode */
+#define SCAN_SRV_FW_GUARD_TIME_MS                       62000
+/* module name for driver mode requests */
+#define SCAN_SRV_NAME                                   "SSRV"
+
+
+/*
+ ***********************************************************************
+ *  Enums.
+ ***********************************************************************
+ */
+
+
+/*
+ ***********************************************************************
+ *  Typedefs.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *  Structure definitions.
+ ***********************************************************************
+ */
+
+/** \struct scanSRV_t
+ * \brief This structure contains the scan SRV object data
+ */
+typedef struct
+{
+    TI_HANDLE           hOS;                           /**< OS object handle */
+    TI_HANDLE           hReport;                       /**< report object handle */
+    TI_HANDLE           hPowerSrv;                     /**< power Server object handle */
+    TI_HANDLE           hTWD;                          /**< TWD layer handle */
+    TI_HANDLE           hTimer;                        /**< Timer module object handle */
+    TI_HANDLE           hEventMbox;                    /**< EventMbox module object handle */
+    TI_HANDLE           hCmdBld;                       /**< Command builder object handle */
+    TScanSrvCompleteCb  scanCompleteNotificationFunc;  /**< 
+                                                         * upper layer (scan concentrator) scan complete 
+                                                         * callback function
+                                                         */
+    TI_HANDLE           scanCompleteNotificationObj;    /**< 
+                                                         * upper layer (scan concentrator) scan complete
+                                                         * callback function
+                                                         */
+    
+    TCmdResponseCb      commandResponseFunc;            /**<
+                                                         * upper layer command response CB. Passed down into the HAL
+                                                         * and called when the scan command has been received by the FW
+                                                         */
+    TI_HANDLE           commandResponseObj;             /**<
+                                                         * object parameter passed to the commandResposeFunc by the HAL
+                                                         * when it is called 
+                                                         */
+    TFailureEventCb     failureEventFunc;               /**<
+                                                         * upper layer Failure Event CB.
+                                                         * called when the scan command has been Timer Expiry
+                                                         */
+    TI_HANDLE           failureEventObj;                /**<
+                                                         * object parameter passed to the failureEventFunc
+                                                         * when it is called 
+                                                         */
+    TI_UINT16           SPSScanResult;                  /**< 
+                                                         * bitmap indicating which channels were scanned
+                                                         * in an SPS scan
+                                                         */
+    TI_BOOL             bTSFError;                      /** indicates whether a TSF error occured */                                                        /**< 
+                                                         * scan result: indicates a TSF error event and 
+                                                         * which channels were scanned in SPS
+                                                         */
+    TI_BOOL             bDtimOverlapping;               /**< Indicates whether the scan is overlapping DTIM */
+    TI_BOOL             bExitFromDriverMode;            /**< 
+                                                         * Indicates whether to exit driver mode once scan 
+                                                         * is finished
+                                                         */
+    TI_BOOL             bSendNullData;                  /**< 
+                                                         * Indicates whether to send Null data when exiting driver  
+                                                         * mode once scan is finished
+                                                         */
+    TI_BOOL             bScanOnDriverModeFailure;       /**< 
+                                                         * Indicates whether to scan if driver mode entry
+                                                         * wasn't successful
+                                                         */
+    TI_BOOL             bHighPriority;                  /**<
+                                                         * Indicates whether to request high priority 
+                                                         * (overlapping DTIM) scan
+                                                         */
+    TI_BOOL             bSPSScan;                       /**< 
+                                                         * whether the running scan type is SPS (TI_TRUE)
+                                                         * or something else (TI_FALSE). Used to stop a
+                                                         * running scan.
+                                                         */
+    TScanParams*        scanParams;                     /**< scan parameters */
+    EScanResultTag      eScanTag;                       /**< scan result tag */
+    TI_UINT32           uResultCount;                   /**< number of scan results (received from the FW) */
+    TI_HANDLE           hScanSrvTimer;                  /**< scan operation timer */
+    TI_BOOL             bTimerRunning;                  /**< whether the above timer is running */
+    TI_BOOL             bInRequest;                     /**<
+                                                         * Indicates whether the SM is run within
+                                                         * the scan request context (if so, to avoid
+                                                         * re-entrance, the complete function shouldn't
+                                                         * be called on failure, but rather an invalid
+                                                         * status should be returned)
+                                                         */
+    TI_STATUS           returnStatus;                   /**< 
+                                                         * Holds the return code to the upper layer
+                                                         * Used to save errors during SM operation.
+                                                         */
+    /* state machine */
+    fsm_stateMachine_t* SM;                             /**< 
+                                                         * state machines for different
+                                                         * scan types
+                                                         */
+    scan_SRVSMStates_e  SMState;                        /**< 
+                                                         * state machine current states 
+                                                         * for different scan types
+                                                         */
+    E80211PsMode        psRequest;                      /**< 
+                                                         * Indicates if PS was requested or not
+                                                         * for current scan
+                                                         */
+    TI_UINT32           numberOfNoScanCompleteToRecovery;
+                                                        /**< 
+                                                         * The number of consecutive no scan complete
+                                                         * that will trigger a recovery notification
+                                                         */
+    TI_UINT32           currentNumberOfConsecutiveNoScanCompleteEvents;
+                                                        /**<
+                                                         * The number of consecutivre no scan complete 
+                                                         * events at present
+                                                         */
+    TI_BOOL             bNoScanCompleteFlag;            /**<
+                                                         * Indicates if the last event was start scan
+                                                         * (true) or no scan complete (false) to be able
+                                                         * to nullify correctly the above counter */
+    TI_UINT32           uTriggeredScanTimeOut;          /**<
+                                                         * Time out for starting triggered scan between 
+                                                         * 2 channels */
+    TI_UINT8                uDtimPeriod;
+    TI_UINT16               uBeaconInterval;
+} scanSRV_t;
+
+/*
+ ***********************************************************************
+ *  External data definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *  External functions definitions
+ ***********************************************************************
+ */
+
+/**
+ * \date 16-Oct-2004\n
+ * \brief Creates the scan SRV object
+ *
+ * Function Scope \e Public.\n
+ * \param hOS - handle to the OS object.\n
+ * \return a handle to the scan SRV object, NULL if an error occurred.\n
+ */
+TI_HANDLE MacServices_scanSRV_create( TI_HANDLE hOS );
+
+/**
+ * \date 29-Dec-2004\n
+ * \brief Finalizes the scan SRV module (releasing memory and timer)
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ */
+void MacServices_scanSRV_destroy( TI_HANDLE hScanSRV );
+
+/**
+ * \date 29-Dec-2004\n
+ * \brief Initializes the scan SRV module, registers SCAN_COMPLETE to HAL.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param Handles of other modules.\n
+  */
+TI_STATUS MacServices_scanSRV_init (TI_HANDLE hMacServices,
+                                    TI_HANDLE hReport,
+                                    TI_HANDLE hTWD,
+                                    TI_HANDLE hTimer,
+                                    TI_HANDLE hEventMbox,
+                                    TI_HANDLE hCmdBld);
+
+/**
+ * \author Ronen Kalish\n
+ * \date 26-July-2006\n
+ * \brief Configures the scan SRV module with initialization values
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param hReport - handle to the report object.\n
+ * \param hHalCtrl - handle to the HAL ctrl object.\n
+  */
+void MacServices_scanSrv_config( TI_HANDLE hMacServices, TScanSrvInitParams* pInitParams );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 29-Dec-2004\n
+ * \brief Calculates the maximal time required for a scan operation
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSRV - handle to the scan SRV object.\n
+ * \param scanParams - the scan parameters
+ * \param bConsiderDTIM - whether this scan overlaps DTIM
+ * \return the time (in milliseconds)
+ */
+TI_UINT32 MacServices_scanSRVcalculateScanTimeout( TI_HANDLE hScanSrv, TScanParams* scanParams, TI_BOOL bConsiderDTIM );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 16-Jan-2005\n
+ * \brief Convert time units (1024 usecs) to millisecs
+ *
+ * Function Scope \e Private.\n
+ * \param tu - the time in time units
+ * \return the time in milliseconds
+ */
+TI_UINT32 MacServices_scanSRVConvertTUToMsec( TI_UINT32 tu );
+
+/**
+ * \date 27-Sep-2005\n
+ * \brief This function is the CB which is called as response to 'StartScan' or 'StopScan' \n.
+ *        here we check if there is a GWSI command response , and call it if necessary .\n
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \param MboxStatus - mailbox status. \n
+ */
+
+void MacServices_scanSRVCommandMailBoxCB(TI_HANDLE hScanSrv,TI_UINT16 MboxStatus);
+
+
+/**
+ * \brief Registers a failure event callback for scan error notifications.
+ *
+ * Function Scope \e Public.\n
+ * \param hMacServices - handle to the MacServices object.\n
+ * \param failureEventCB - the failure event callback function.\n
+ * \param hFailureEventObj - handle to the object passed to the failure event callback function.\n
+ */
+void scanSRV_registerFailureEventCB( TI_HANDLE hScanSRV, 
+                                     void * failureEventCB, TI_HANDLE hFailureEventObj );
+
+void scanSRV_restart( TI_HANDLE hScanSRV);
+
+
+#endif /* __SCANSRV_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/ScanSrvSM.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,588 @@
+/*
+ * ScanSrvSM.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 ScanSrvSM.c
+ *  \brief This file include the scan SRV Sm implementation
+ *  \author Ronen Kalish
+ *  \date 10-Jan-2005 
+ */
+
+#define __FILE_ID__  FILE_ID_116
+#include "ScanSrvSM.h"
+#include "ScanSrv.h"
+#include "report.h"
+#include "timer.h"
+#include "MacServices_api.h"
+#include "PowerSrv_API.h"
+#include "CmdBld.h"
+
+
+/********************************************************************************/
+/*                      Internal functions prototypes.                          */
+/********************************************************************************/
+
+static TI_STATUS scanSRVSM_PsFailWhileScanning( TI_HANDLE hScanSrv );
+static TI_STATUS actionNop( TI_HANDLE hScanSrv );
+static TI_STATUS actionUnexpected( TI_HANDLE hScanSrv );
+
+
+/********************************************************************************/
+/*                      Interface functions Implementation.                     */
+/********************************************************************************/
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Initialize the scan SRV SM.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_init( TI_HANDLE hScanSrv )
+{
+    scanSRV_t* pScanSRV = (scanSRV_t*)hScanSrv;
+
+    fsm_actionCell_t    smMatrix[ SCAN_SRV_NUM_OF_STATES ][ SCAN_SRV_NUM_OF_EVENTS ] =
+    {
+        /* next state and actions for IDLE state */
+        {   
+            {SCAN_SRV_STATE_PS_WAIT, scanSRVSM_requestPS},                                /*"REQUEST_PS",*/
+            {SCAN_SRV_STATE_IDLE, actionUnexpected},                                      /*"PS_FAIL",*/
+            {SCAN_SRV_STATE_SCANNING, scanSRVSM_startActualScan},                         /*"PS_SUCCESS",  */
+            {SCAN_SRV_STATE_IDLE, actionUnexpected},                                      /*"PS_PEND",*/
+            {SCAN_SRV_STATE_IDLE, actionUnexpected},                                      /*"STOP_SCAN"*/
+            {SCAN_SRV_STATE_IDLE, actionNop},                                             /*"FW_RESET"*/
+            {SCAN_SRV_STATE_IDLE, actionUnexpected},                                      /*"TIMER_EXPIRED"*/
+            {SCAN_SRV_STATE_IDLE, actionUnexpected},                                      /*"SCAN_COMPLETE"*/
+        },
+
+
+        /* next state and actions for PS_WAIT state */
+        {   
+            {SCAN_SRV_STATE_PS_WAIT, actionUnexpected},                                   /*"REQUEST_PS",*/
+            {SCAN_SRV_STATE_PS_EXIT, scanSRVSM_releasePS},                                /*"PS_FAIL",*/
+            {SCAN_SRV_STATE_SCANNING, scanSRVSM_startActualScan},                         /*"PS_SUCCESS",  */
+            {SCAN_SRV_STATE_PS_WAIT, actionNop},                                          /*"PS_PEND",*/
+            {SCAN_SRV_STATE_STOPPING, actionNop},                                         /*"STOP_SCAN"*/
+            {SCAN_SRV_STATE_IDLE, scanSRVSM_handleRecovery},                              /*"FW_RESET"*/
+            {SCAN_SRV_STATE_PS_WAIT, actionUnexpected},                                   /*"TIMER_EXPIRED"*/
+            {SCAN_SRV_STATE_PS_WAIT, actionUnexpected},                                   /*"SCAN_COMPLETE"*/
+        },
+
+        /* next state and actions for SCANNING state */
+        {    
+            {SCAN_SRV_STATE_SCANNING, actionUnexpected},                                  /*"REQUEST_PS",*/
+            {SCAN_SRV_STATE_SCANNING, scanSRVSM_PsFailWhileScanning},                     /*"PS_FAIL",*/
+            {SCAN_SRV_STATE_SCANNING, actionUnexpected},                                  /*"PS_SUCCESS",  */
+            {SCAN_SRV_STATE_SCANNING, actionUnexpected},                                  /*"PS_PEND",*/
+            {SCAN_SRV_STATE_STOPPING, actionNop   },                                      /*"STOP_SCAN"*/
+            {SCAN_SRV_STATE_IDLE, scanSRVSM_handleRecovery},                              /*"FW_RESET"*/
+            {SCAN_SRV_STATE_SCANNING, scanSRVSM_handleTimerExpiry},                       /*"TIMER_EXPIRED"*/
+            {SCAN_SRV_STATE_PS_EXIT, scanSRVSM_releasePS},                                /*"SCAN_COMPLETE"*/
+
+        },
+
+        /* next state and actions for STOPPING state */
+        {   
+            {SCAN_SRV_STATE_STOPPING, actionUnexpected},                                  /*"REQUEST_PS",*/
+            {SCAN_SRV_STATE_PS_EXIT, scanSRVSM_releasePS},                                /*"PS_FAIL",*/
+            {SCAN_SRV_STATE_PS_EXIT, scanSRVSM_releasePS},                                /*"PS_SUCCESS",  */
+            {SCAN_SRV_STATE_STOPPING, actionUnexpected},                                  /*"PS_PEND",*/
+            {SCAN_SRV_STATE_STOPPING, actionNop     },                                    /*"STOP_SCAN"*/
+            {SCAN_SRV_STATE_IDLE, scanSRVSM_handleRecovery},                              /*"FW_RESET"*/
+            {SCAN_SRV_STATE_STOPPING, scanSRVSM_handleTimerExpiry},                       /*"TIMER_EXPIRED"*/
+            {SCAN_SRV_STATE_PS_EXIT, scanSRVSM_releasePS}                                 /*"SCAN_COMPLETE"*/
+
+        } ,
+
+        /* next state and actions for PS_EXIT state */
+        {   
+            {SCAN_SRV_STATE_PS_EXIT, actionUnexpected},                                   /*"REQUEST_PS",*/
+            {SCAN_SRV_STATE_IDLE, scanSRVSM_notifyScanComplete},                          /*"PS_FAIL",*/
+            {SCAN_SRV_STATE_IDLE, scanSRVSM_notifyScanComplete},                          /*"PS_SUCCESS",  */
+            {SCAN_SRV_STATE_PS_EXIT, actionNop},                                          /*"PS_PEND",*/
+            {SCAN_SRV_STATE_PS_EXIT, actionNop},                                          /*"STOP_SCAN"*/
+            {SCAN_SRV_STATE_IDLE, scanSRVSM_handleRecovery},                              /*"FW_RESET"*/
+            {SCAN_SRV_STATE_PS_EXIT, actionUnexpected},                                   /*"TIMER_EXPIRED"*/
+            {SCAN_SRV_STATE_PS_EXIT, actionUnexpected},                                   /*"SCAN_COMPLETE"*/
+        }
+    };
+
+    /* initialize current state */
+    pScanSRV->SMState = SCAN_SRV_STATE_IDLE;
+
+    /* configure the state machine */
+    return fsm_Config( pScanSRV->SM, (fsm_Matrix_t)smMatrix, 
+                       (TI_UINT8)SCAN_SRV_NUM_OF_STATES, (TI_UINT8)SCAN_SRV_NUM_OF_EVENTS, 
+                       (fsm_eventActivation_t)scanSRVSM_SMEvent, pScanSRV->hOS );
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Processes an event.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \param currentState - the current scan SRV SM state.\n
+ * \param event - the event to handle.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_SMEvent( TI_HANDLE hScanSrv, scan_SRVSMStates_e* currentState, 
+                             scan_SRVSMEvents_e event )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t *)hScanSrv;
+    TI_STATUS status = TI_OK;
+    TI_UINT8 nextState;
+
+    /* obtain the next state */
+    status = fsm_GetNextState( pScanSRV->SM, *(TI_UINT8*)currentState, (TI_UINT8)event, &nextState );
+    if ( status != TI_OK )
+    {
+        TRACE2(pScanSRV->hReport, REPORT_SEVERITY_ERROR, "Failed getting scan SRV next state. state = %d event = %d\n", (TI_UINT8)*currentState,(TI_UINT8)event);
+        return TI_NOK;
+    }
+
+	TRACE3(pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "scanSRVSM_SMEvent: <currentState = %d, event = %d> --> nextState = %d\n", *currentState, event, nextState);
+
+    /* move */
+    return fsm_Event( pScanSRV->SM, (TI_UINT8*)currentState, (TI_UINT8)event, hScanSrv );
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Request to enter driver mode from the power manager module.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_requestPS( TI_HANDLE hScanSrv )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
+    TI_STATUS psStatus;
+
+    TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Requesting Driver mode from PowerSave Srv.\n");
+   
+    psStatus = powerSrv_ReservePS(  pScanSRV->hPowerSrv,
+                                    pScanSRV->psRequest,
+                                    pScanSRV->bSendNullData,
+                                    hScanSrv,
+                                    MacServices_scanSRV_powerSaveCB);
+
+    switch (psStatus)
+    {
+    /* if successful */
+    case POWER_SAVE_802_11_IS_CURRENT:
+        /* send a PS_SUCCESS event */
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Driver mode successful, continuing to scan.\n");
+        return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS );
+
+    /* if pending */
+    case POWER_SAVE_802_11_PENDING:
+    case TI_OK:
+        /* send a PS_PEND event */
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Driver mode pending, Waiting.\n");
+        return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_PEND );
+
+    /* if not successful */
+    default:
+
+        /* mark not to exit from driver mode (no entry was performed) */
+        pScanSRV->bExitFromDriverMode = TI_FALSE;
+
+        /* if still wishing to scan */
+        if ( pScanSRV->bScanOnDriverModeFailure )
+        {
+            /* send a PS_SUCCESS event - scan will proceed regardless of the error */
+            TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Driver mode failed, continuing to scan.\n");
+            scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS );
+        }
+        /* otherwise, return */
+        else
+        {
+            /* mark the return code */
+            pScanSRV->returnStatus = TI_NOK;
+            /* send a PS_FAIL event */
+            TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Driver mode failed, aborting scan.\n");
+            scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_FAIL );
+        }
+        break;
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \date 6-Oct-2005\n
+ * \brief Request to release PS mode from the PowerSRV , and wait for answer.\n\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+
+TI_STATUS scanSRVSM_releasePS( TI_HANDLE hScanSrv )
+{
+      scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
+      TI_STATUS psStatus;
+    
+     /* stop timer */
+    if ( TI_TRUE == pScanSRV->bTimerRunning )
+    {
+        tmr_StopTimer (pScanSRV->hScanSrvTimer);
+        pScanSRV->bTimerRunning = TI_FALSE;
+    }
+  
+    /* if exit from driver mode requested, do so */
+    if ( TI_TRUE == pScanSRV->bExitFromDriverMode )
+    {
+        /* here we need to get an answer if we succeeded to exit driver mode */
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Releasing Driver mode from Power Srv.\n");
+ 
+        psStatus = powerSrv_ReleasePS(  pScanSRV->hPowerSrv,
+                                pScanSRV->bSendNullData,
+                                hScanSrv,
+                                MacServices_scanSRV_powerSaveCB);
+
+
+    }
+    else            /* no need to exit PS - send PS_SUCCESS */
+    {
+        return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS );
+    }
+
+
+    switch (psStatus)
+    {
+        /* if successful */
+    case POWER_SAVE_802_11_IS_CURRENT:
+        /* send a PS_SUCCESS event */
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Driver mode exit successful, scan done.\n");
+        return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_SUCCESS );
+        
+        /* if pending */
+    case POWER_SAVE_802_11_PENDING:
+    case TI_OK:
+        /* stay in the PS_EXIT state */
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Driver mode exit pending, Waiting.\n");
+        break; 
+        
+        /* if not successful */
+    default:
+        
+        /* send a PS_FAIL event */
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, ": Driver mode exit failed, scan done.");
+        return scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_PS_FAIL );
+
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Send the scan command to the firmware.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_startActualScan( TI_HANDLE hScanSrv )
+{ 
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
+
+ 
+    /* start the timer */
+    pScanSRV->bTimerRunning = TI_TRUE;
+    tmr_StartTimer (pScanSRV->hScanSrvTimer,
+                    MacServices_scanSRV_scanTimerExpired,
+                    (TI_HANDLE)pScanSRV,
+                    MacServices_scanSRVcalculateScanTimeout (hScanSrv, pScanSRV->scanParams, !pScanSRV->bDtimOverlapping), 
+                    TI_FALSE);
+    
+    TRACE1( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "Sending scan , type: %x to HAL.\n",pScanSRV->scanParams->scanType);
+    
+    /* start the scan */
+            /* we send the MacServices_scanSRVCommandMailBoxCB to be called when this command is recieved */
+    if ( SCAN_TYPE_SPS == pScanSRV->scanParams->scanType )
+    {
+        pScanSRV->returnStatus = cmdBld_CmdStartSPSScan (pScanSRV->hCmdBld, pScanSRV->scanParams, pScanSRV->eScanTag,
+                                                         (void *)MacServices_scanSRVCommandMailBoxCB, hScanSrv);
+    }
+    else
+    {    
+        pScanSRV->returnStatus = cmdBld_CmdStartScan (pScanSRV->hCmdBld, pScanSRV->scanParams, pScanSRV->eScanTag, 
+                                                      pScanSRV->bHighPriority , (void *)MacServices_scanSRVCommandMailBoxCB, 
+                                                      hScanSrv);
+    }
+    /* if scan request failed */
+    if ( TI_OK != pScanSRV->returnStatus )
+    {
+        TRACE1( pScanSRV->hReport, REPORT_SEVERITY_ERROR, "HAL returned code %d for scan request, quitting scan.\n", pScanSRV->returnStatus);
+
+        /* send a scan complete event. This will do all necessary clean-up (timer, power manager, notifying scan complete) */
+        scanSRVSM_SMEvent( hScanSrv, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_SCAN_COMPLETE );
+    }
+    
+    return TI_OK;
+}
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Notifies scan complete to upper layer.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_notifyScanComplete( TI_HANDLE hScanSrv )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
+    TCmdResponseCb CB_Func;
+    TI_HANDLE  CB_Handle;
+    TI_STATUS PSMode;
+
+    /* call the scan complete CB - only if not currently running from within a request context! */
+    if ( TI_FALSE == pScanSRV->bInRequest )
+    {   
+        /* this means that ResponseFunc was not called yet , so we call it before ScanComplete */
+        if (pScanSRV->commandResponseFunc) 
+        {
+            /* must erase CB function before calling it to enable nested scans */
+            CB_Func = pScanSRV->commandResponseFunc;
+            CB_Handle = pScanSRV->commandResponseObj;
+
+            pScanSRV->commandResponseFunc = NULL;
+            pScanSRV->commandResponseObj = NULL;
+            
+            /* if we reached here than response status was TI_OK */
+            CB_Func(CB_Handle, TI_OK);
+             
+        }
+        /* if function returns TI_TRUE than we are in PS mode , else - not */
+        PSMode = powerSrv_getPsStatus(pScanSRV->hPowerSrv) ? POWER_SAVE_802_11_SUCCESS : POWER_SAVE_802_11_FAIL;
+
+        TRACE2( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "scanSRVSM_notifyScanComplete status = 0x%x PSMode = 0x%x\n",pScanSRV->returnStatus,PSMode);
+
+
+        TRACE0(pScanSRV->hReport, REPORT_SEVERITY_INFORMATION , "scanSRVSM_notifyScanComplete: call TWD_OWN_EVENT_SCAN_CMPLT CB. In std MacServices_scanSRV_scanCompleteCB()\n");
+
+        pScanSRV->scanCompleteNotificationFunc( pScanSRV->scanCompleteNotificationObj,
+                                    pScanSRV->eScanTag,
+                                    pScanSRV->uResultCount,
+                                    pScanSRV->SPSScanResult, 
+                                    pScanSRV->bTSFError,
+                                    pScanSRV->returnStatus, 
+                                    PSMode );
+    }
+
+    return TI_OK;
+}
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Handles a timer expiry event - starts a recovery process.
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_handleTimerExpiry( TI_HANDLE hScanSrv )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
+
+    /* 
+     * No scan complete bug workaround:
+     * Only after a consecutive configurable number of no scan complete events the recovery trigger
+     * will be issued. This is done as a workaround for a bug in the FW where if a channel is too
+     * loaded it wouldn't be able to send a probe request and will get stuck waiting for this channel
+     */
+
+    pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents++;
+
+    if ( pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents >= 
+         pScanSRV->numberOfNoScanCompleteToRecovery )
+    {
+        TRACE0( pScanSRV->hReport, REPORT_SEVERITY_ERROR, ": Timer expired. Starting recovery process.\n");
+
+        pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents = 0;
+
+        /* mark the return status */
+        pScanSRV->returnStatus = TI_NOK;
+
+        /* mark that the timer is no longer running */
+        pScanSRV->bTimerRunning = TI_FALSE;
+
+        /* call the recovery module */
+        pScanSRV->failureEventFunc(pScanSRV->failureEventObj ,NO_SCAN_COMPLETE_FAILURE);
+    }
+    else
+    {
+        TRACE2( pScanSRV->hReport, REPORT_SEVERITY_ERROR, ": Timer expired. consecutive failures:%d, threshold:%d, still not calling recovery.\n", pScanSRV->currentNumberOfConsecutiveNoScanCompleteEvents, pScanSRV->numberOfNoScanCompleteToRecovery);
+
+        /* send a top scan command, which can help solving the FW bug described above */
+        if ( TI_FALSE == pScanSRV->bSPSScan )
+        {
+            cmdBld_CmdStopScan (pScanSRV->hCmdBld, pScanSRV->eScanTag, NULL, NULL);
+        }
+        else
+        {
+            cmdBld_CmdStopSPSScan (pScanSRV->hCmdBld, pScanSRV->eScanTag, NULL, NULL);
+        }
+
+        /* imitate a scan complete event to the SM */
+        pScanSRV->bTSFError = TI_FALSE;
+        pScanSRV->SPSScanResult = 0xffff;
+        scanSRVSM_SMEvent( (TI_HANDLE)pScanSRV, (scan_SRVSMStates_e*)&pScanSRV->SMState, SCAN_SRV_EVENT_SCAN_COMPLETE );
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \author Shirit Brook\n
+ * \date 10-Jan-2005\n
+ * \brief Handles PS Fail event while in Scanning - Indicate not to Exit PS.
+ * This event can be reached when Roaming is invoked while in Scanning state.
+ * The PM Module is stopped and generates PS Fail to all its clients.
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+static TI_STATUS scanSRVSM_PsFailWhileScanning( TI_HANDLE hScanSrv )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
+
+    TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "scanSRVSM_PsFailWhileScanning. Indicate not to Enter PS.\n");
+
+    pScanSRV->bExitFromDriverMode = TI_FALSE;
+
+    return TI_OK;
+}
+
+
+/**
+ * \author Ronen Kalish\n
+ * \date 17-Jan-2005\n
+ * \brief Handles a FW reset event (one that was detected outside the scan SRV) by stopping the timer.
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_handleRecovery( TI_HANDLE hScanSrv )
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
+
+    TRACE0( pScanSRV->hReport, REPORT_SEVERITY_INFORMATION, "FW reset event from outside.\n");
+ 
+    /* The Power Manager is responsible to exit PS mode in recovery. Also, the scan CB is not called - 
+       The SCR is responsible to notify scan concentrator of the event (which actually notifies scan SRV */
+
+    /* if timer is running - stop it */
+    if ( TI_TRUE == pScanSRV->bTimerRunning )
+    {
+        tmr_StopTimer (pScanSRV->hScanSrvTimer);
+        pScanSRV->bTimerRunning = TI_FALSE;
+    }
+    else
+    {
+        /* shouldn't happen - only called if timer is supposedly running */
+        TRACE1( pScanSRV->hReport, REPORT_SEVERITY_WARNING, "SM: External FW reset in state %d and timer is not running?", pScanSRV->SMState);
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 11-Jan-2005\n
+ * \brief Handles an unexpected event.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return always TI_OK.\n
+ */
+static TI_STATUS actionUnexpected( TI_HANDLE hScanSrv ) 
+{
+    scanSRV_t *pScanSRV = (scanSRV_t*)hScanSrv;
+
+    TRACE1( pScanSRV->hReport, REPORT_SEVERITY_ERROR, "Scan SRV state machine error, unexpected Event, state=%d\n\n", pScanSRV->SMState);
+
+    if ( pScanSRV->bTimerRunning )
+    {
+        tmr_StopTimer (pScanSRV->hScanSrvTimer);
+        pScanSRV->bTimerRunning = TI_FALSE;
+    }
+
+    /* we must clean the old command response CB since they are no longer relevant 
+      since the state machine may be corrupted */
+    pScanSRV->commandResponseFunc = NULL;
+    pScanSRV->commandResponseObj = NULL;
+
+    /* indicate the unexpected event in the return status */
+    pScanSRV->returnStatus = TI_NOK;
+    
+    return TI_OK;
+}
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Handles an event that doesn't require any action.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return always TI_OK.\n
+ */
+static TI_STATUS actionNop( TI_HANDLE hScanSrv )
+{   
+    return TI_OK;
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/ScanSrvSM.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,216 @@
+/*
+ * ScanSrvSM.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 ScanSrvSM.h
+ *  \brief This file include definitions for the scan SRV SM module.
+ *  \author Ronen Kalish
+ *  \date 10-Jan-2005
+ */
+
+#ifndef __SCANSRVSM_H__
+#define __SCANSRVSM_H__
+
+#include "fsm.h"
+
+/*
+ ***********************************************************************
+ *	Constant definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	Enums.
+ ***********************************************************************
+ */
+
+/** \enum scan_SRVSMEvents_e
+ * \brief enumerates the different scan SRV SM events
+ */
+typedef enum
+{
+    SCAN_SRV_EVENT_REQUEST_PS = 0,
+    SCAN_SRV_EVENT_PS_FAIL,
+    SCAN_SRV_EVENT_PS_SUCCESS,
+    SCAN_SRV_EVENT_PS_PEND,
+    SCAN_SRV_EVENT_STOP_SCAN,
+    SCAN_SRV_EVENT_FW_RESET,
+    SCAN_SRV_EVENT_TIMER_EXPIRED,
+    SCAN_SRV_EVENT_SCAN_COMPLETE,
+    SCAN_SRV_NUM_OF_EVENTS
+} scan_SRVSMEvents_e;
+
+/** \enum scan_SRVSMStates_e
+ * \brief enumerates the different scan SRV SM states
+ */
+typedef enum
+{
+	SCAN_SRV_STATE_IDLE = 0,
+    SCAN_SRV_STATE_PS_WAIT,
+	SCAN_SRV_STATE_SCANNING,
+	SCAN_SRV_STATE_STOPPING,
+	SCAN_SRV_STATE_PS_EXIT,
+	SCAN_SRV_NUM_OF_STATES
+} scan_SRVSMStates_e;
+
+/*
+ ***********************************************************************
+ *	Typedefs.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	Structure definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	External data definitions.
+ ***********************************************************************
+ */
+
+/*
+ ***********************************************************************
+ *	External functions definitions
+ ***********************************************************************
+ */
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Initialize the scan SRV SM.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_init( TI_HANDLE hScanSrv );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Processes an event.
+ *
+ * Function Scope \e Public.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \param currentState - the current scan SRV SM state.\n
+ * \param event - the event to handle.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_SMEvent( TI_HANDLE hScanSrv, scan_SRVSMStates_e* currentState, 
+                             scan_SRVSMEvents_e event );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Request to enter driver mode from the power manager module.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_requestPS( TI_HANDLE hScanSrv );
+
+/**
+ * \date 6-Oct-2005\n
+ * \brief Request to release PS mode from the PowerSRV , and wait for answer.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_releasePS( TI_HANDLE hScanSrv );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Send the scan command to the firmware.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_startActualScan( TI_HANDLE hScanSrv );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Send a stop scan command to the firmware.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_stopActualScan( TI_HANDLE hScanSrv );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Notifies scan complete to upper layer.\n
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_notifyScanComplete( TI_HANDLE hScanSrv );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 10-Jan-2005\n
+ * \brief Handles a timer expiry event - starts a recovery process.
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_handleTimerExpiry( TI_HANDLE hScanSrv );
+
+/**
+ * \author Ronen Kalish\n
+ * \date 17-Jan-2005\n
+ * \brief Handles a FW reset event (one that was detected outside the scan SRV) by stopping the timer.
+ *
+ * Function Scope \e Private.\n
+ * \param hScanSrv - handle to the scan SRV object.\n
+ * \return TI_OK if successful, TI_NOK otherwise.\n
+ */
+TI_STATUS scanSRVSM_handleRecovery( TI_HANDLE hScanSrv );
+
+#endif /* __SCANSRVSM_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/MacServices/measurementSrvDbgPrint.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,96 @@
+/*
+ * measurementSrvDbgPrint.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 measurementSrvDbgPrint.c
+ *  \brief This file include variuos measurement SRV debug print facilities
+ *  \author Ronen Kalish
+ *  \date 23-December-2005
+ */
+
+#define __FILE_ID__  FILE_ID_111
+#include "report.h"
+#include "TWDriver.h"
+#include "MeasurementSrvSM.h"
+#include "MeasurementSrv.h"
+#include "measurementSrvDbgPrint.h"
+
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 23-December-2005\n
+ * \brief Prints a measurement request.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param pMsrRequest - the measurement request.\n
+ */
+void measurementSRVPrintRequest( TI_HANDLE hMeasurementSRV, TMeasurementRequest *pMsrRequest )
+{
+#ifdef TI_DBG    
+	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+	TI_INT32 i;
+
+TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "Measurement request:\n");
+TRACE5( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "band: %d, channel:%d, TX power level: %d, start time: %x-%x\n", pMsrRequest->band, pMsrRequest->channel, pMsrRequest->txPowerDbm, INT64_HIGHER(pMsrRequest->startTime), INT64_LOWER(pMsrRequest->startTime));
+	for ( i = 0; i < pMsrRequest->numberOfTypes; i++ )
+	{
+		measurementSRVPrintTypeRequest( hMeasurementSRV, &(pMsrRequest->msrTypes[ i ]));
+	}
+#endif /* TI_DBG */
+
+}
+
+/** 
+ * \author Ronen Kalish\n
+ * \date 23-December-2005\n
+ * \brief Prints a measurement type request.\n
+ *
+ * Function Scope \e Public.\n
+ * \param hMeasurementSRV - handle to the measurement SRV object.\n
+ * \param pMsrTypeRequest - the measurement type request.\n
+ */
+void measurementSRVPrintTypeRequest( TI_HANDLE hMeasurementSRV, TMeasurementTypeRequest* pMsrTypeRequest )
+{
+#ifdef TI_DBG    
+	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
+
+TRACE4( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "Measurement type request: type: %d, duration:%d, scan mode: %d, reserved: %d", pMsrTypeRequest->msrType, pMsrTypeRequest->duration, pMsrTypeRequest->scanMode, pMsrTypeRequest->reserved);
+
+#endif /* TI_DBG */
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/Device.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,424 @@
+/*
+ * Device.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  Device.h
+ *   PURPOSE: Contains Wlan hardware registers defines/structures
+ *   
+ ****************************************************************************/
+
+#ifndef DEVICE_H
+#define DEVICE_H
+
+#include "Device1273.h"
+
+
+#define ACX_PHI_CCA_THRSH_ENABLE_ENERGY_D	0x140A
+#define ACX_PHI_CCA_THRSH_DISABLE_ENERGY_D	0xFFEF
+
+/*
+ * Wlan hardware Registers.
+ */
+
+/*======================================================================
+                      Interrupt Registers                               
+=======================================================================*/
+
+#define ACX_REG_INTERRUPT_TRIG		( INT_TRIG )
+
+#define ACX_REG_INTERRUPT_TRIG_H	 ( INT_TRIG_H )
+
+/*=============================================
+  Host Interrupt Mask Register - 32bit (RW)
+  ------------------------------------------  
+  Setting a bit in this register masks the
+  corresponding interrupt to the host.
+  0 - RX0		- Rx first dubble buffer Data Interrupt
+  1 - TXD		- Tx Data Interrupt
+  2 - TXXFR		- Tx Transfer Interrupt
+  3 - RX1		- Rx second dubble buffer Data Interrupt
+  4 - RXXFR		- Rx Transfer Interrupt
+  5 - EVENT_A	- Event Mailbox interrupt
+  6 - EVENT_B	- Event Mailbox interrupt
+  7 - WNONHST	- Wake On Host Interrupt
+  8 - TRACE_A	- Debug Trace interrupt
+  9 - TRACE_B	- Debug Trace interrupt
+ 10 - CDCMP		- Command Complete Interrupt
+ 11 -
+ 12 -
+ 13 -
+ 14 - ICOMP		- Initialization Complete Interrupt
+ 16 - SG SE		- Soft Gemini - Sense enable interrupt
+ 17 - SG SD		- Soft Gemini - Sense disable interrupt
+ 18 -			- 
+ 19 -			- 
+ 20 -			- 
+ 21-			- 
+ Default: 0x0001
+*==============================================*/
+#define ACX_REG_INTERRUPT_MASK				( HINT_MASK )
+
+/*=============================================
+  Host Interrupt Mask Set 16bit, (Write only) 
+  ------------------------------------------  
+ Setting a bit in this register sets          
+ the corresponding bin in ACX_HINT_MASK register
+ without effecting the mask                   
+ state of other bits (0 = no effect).         
+==============================================*/
+#define ACX_HINT_MASK_SET_REG          HINT_MASK_SET
+
+/*=============================================
+  Host Interrupt Mask Clear 16bit,(Write only)
+  ------------------------------------------  
+ Setting a bit in this register clears        
+ the corresponding bin in ACX_HINT_MASK register
+ without effecting the mask                   
+ state of other bits (0 = no effect).         
+=============================================*/
+#define ACX_HINT_MASK_CLR_REG          HINT_MASK_CLR
+
+/*=============================================
+  Host Interrupt Status Nondestructive Read   
+  16bit,(Read only)                           
+  ------------------------------------------  
+ The host can read this register to determine 
+ which interrupts are active.                 
+ Reading this register doesn't                
+ effect its content.                          
+=============================================*/
+#define ACX_REG_INTERRUPT_NO_CLEAR			( HINT_STS_ND )
+
+/*=============================================
+  Host Interrupt Status Clear on Read  Register
+  16bit,(Read only)                           
+  ------------------------------------------  
+ The host can read this register to determine 
+ which interrupts are active.                 
+ Reading this register clears it,             
+ thus making all interrupts inactive.         
+==============================================*/
+#define ACX_REG_INTERRUPT_CLEAR				( HINT_STS_CLR )
+
+/*=============================================
+  Host Interrupt Acknowledge Register         
+  16bit,(Write only)                          
+  ------------------------------------------  
+ The host can set individual bits in this     
+ register to clear (acknowledge) the corresp. 
+ interrupt status bits in the HINT_STS_CLR and
+ HINT_STS_ND registers, thus making the       
+ assotiated interrupt inactive. (0-no effect) 
+==============================================*/
+#define ACX_REG_INTERRUPT_ACK				( HINT_ACK )
+
+
+/*===============================================
+   Host Software Reset - 32bit RW 
+ ------------------------------------------
+    [31:1] Reserved 
+        0  SOFT_RESET Soft Reset  - When this bit is set,
+         it holds the Wlan hardware in a soft reset state. 
+         This reset disables all MAC and baseband processor 
+         clocks except the CardBus/PCI interface clock. 
+         It also initializes all MAC state machines except 
+         the host interface. It does not reload the
+         contents of the EEPROM. When this bit is cleared 
+         (not self-clearing), the Wlan hardware
+         exits the software reset state.
+===============================================*/
+#define ACX_REG_SLV_SOFT_RESET				( SLV_SOFT_RESET )
+	#define SLV_SOFT_RESET_BIT		0x00000001
+
+/*===============================================
+ EEPROM Burst Read Start  - 32bit RW 
+ ------------------------------------------
+ [31:1] Reserved 
+     0  ACX_EE_START -  EEPROM Burst Read Start 0
+        Setting this bit starts a burst read from 
+        the external EEPROM. 
+        If this bit is set (after reset) before an EEPROM read/write, 
+        the burst read starts at EEPROM address 0.
+        Otherwise, it starts at the address 
+        following the address of the previous access. 
+        TheWlan hardware hardware clears this bit automatically.
+        
+        Default: 0x00000000
+*================================================*/
+#define ACX_REG_EE_START					( EE_START )
+	#define START_EEPROM_MGR	0x00000001
+
+/*=======================================================================
+                        Embedded ARM CPU Control
+========================================================================*/
+/*===============================================
+ Halt eCPU   - 32bit RW 
+ ------------------------------------------
+    0 HALT_ECPU Halt Embedded CPU - This bit is the 
+      compliment of bit 1 (MDATA2) in the SOR_CFG register. 
+      During a hardware reset, this bit holds 
+      the inverse of MDATA2.
+      When downloading firmware from the host, 
+      set this bit (pull down MDATA2). 
+      The host clears this bit after downloading the firmware into 
+      zero-wait-state SSRAM.
+      When loading firmware from Flash, clear this bit (pull up MDATA2) 
+      so that the eCPU can run the bootloader code in Flash
+    HALT_ECPU eCPU State
+    --------------------
+    1 halt eCPU
+    0 enable eCPU
+===============================================*/
+#define ACX_REG_ECPU_CONTROL				( ECPU_CTRL )
+
+
+/*=======================================================================
+                    Command/Information Mailbox Pointers
+========================================================================*/
+
+/*===============================================
+   Command Mailbox Pointer - 32bit RW 
+ ------------------------------------------
+    This register holds the start address of 
+    the command mailbox located in the Wlan hardware memory. 
+    The host must read this pointer after a reset to 
+    find the location of the command mailbox. 
+    The Wlan hardware initializes the command mailbox 
+    pointer with the default address of the command mailbox.
+    The command mailbox pointer is not valid until after 
+    the host receives the Init Complete interrupt from 
+    the Wlan hardware.
+===============================================*/
+#define REG_COMMAND_MAILBOX_PTR				( SCR_PAD0 ) 
+
+/*===============================================
+   Information Mailbox Pointer - 32bit RW 
+ ------------------------------------------
+    This register holds the start address of 
+    the information mailbox located in the Wlan hardware memory. 
+    The host must read this pointer after a reset to find 
+    the location of the information mailbox. 
+    The Wlan hardware initializes the information mailbox pointer 
+    with the default address of the information mailbox. 
+    The information mailbox pointer is not valid 
+    until after the host receives the Init Complete interrupt from
+    the Wlan hardware.
+===============================================*/
+#define REG_EVENT_MAILBOX_PTR				( SCR_PAD1 ) 
+
+
+/*=======================================================================
+                   Misc
+========================================================================*/
+
+
+#define REG_ENABLE_TX_RX				( IO_CONTROL_ENABLE ) 
+/*
+ * Rx configuration (filter) information element
+ * ---------------------------------------------
+ */
+#define REG_RX_CONFIG				( RX_CFG ) 
+#define REG_RX_FILTER				( RX_FILTER_CFG ) 
+
+#define RX_CFG_ENABLE_PHY_HEADER_PLCP	0x0002	
+#define RX_CFG_PROMISCUOUS				0x0008	/* promiscuous - receives all valid frames */
+#define RX_CFG_BSSID					0x0020	/* receives frames from any BSSID */
+#define RX_CFG_MAC						0x0010	/* receives frames destined to any MAC address */
+#define RX_CFG_ENABLE_ONLY_MY_DEST_MAC	0x0010	
+#define RX_CFG_ENABLE_ANY_DEST_MAC		0x0000	
+#define RX_CFG_ENABLE_ONLY_MY_BSSID		0x0020  
+#define RX_CFG_ENABLE_ANY_BSSID			0x0000  
+#define RX_CFG_DISABLE_BCAST			0x0200	/* discards all broadcast frames */
+#define RX_CFG_ENABLE_ONLY_MY_SSID		0x0400
+#define RX_CFG_ENABLE_RX_CMPLT_FCS_ERROR 0x0800
+#define RX_CFG_COPY_RX_STATUS			0x2000
+#define RX_CFG_TSF						 0x10000
+
+#define RX_CONFIG_OPTION_ANY_DST_MY_BSS		( RX_CFG_ENABLE_ANY_DEST_MAC     | RX_CFG_ENABLE_ONLY_MY_BSSID)
+#define RX_CONFIG_OPTION_MY_DST_ANY_BSS		( RX_CFG_ENABLE_ONLY_MY_DEST_MAC | RX_CFG_ENABLE_ANY_BSSID)
+#define RX_CONFIG_OPTION_ANY_DST_ANY_BSS	( RX_CFG_ENABLE_ANY_DEST_MAC     | RX_CFG_ENABLE_ANY_BSSID)
+#define RX_CONFIG_OPTION_MY_DST_MY_BSS		( RX_CFG_ENABLE_ONLY_MY_DEST_MAC | RX_CFG_ENABLE_ONLY_MY_BSSID)
+
+#define RX_CONFIG_OPTION_FOR_SCAN           ( RX_CFG_ENABLE_PHY_HEADER_PLCP  | RX_CFG_ENABLE_RX_CMPLT_FCS_ERROR | RX_CFG_COPY_RX_STATUS | RX_CFG_TSF)
+#define RX_CONFIG_OPTION_FOR_MEASUREMENT    ( RX_CFG_ENABLE_ANY_DEST_MAC )
+#define RX_CONFIG_OPTION_FOR_JOIN    		( RX_CFG_ENABLE_ONLY_MY_BSSID | RX_CFG_ENABLE_ONLY_MY_DEST_MAC )
+#define RX_CONFIG_OPTION_FOR_IBSS_JOIN    	( RX_CFG_ENABLE_ONLY_MY_SSID  | RX_CFG_ENABLE_ONLY_MY_DEST_MAC )
+
+#define RX_FILTER_OPTION_DEF			( CFG_RX_MGMT_EN | CFG_RX_DATA_EN | CFG_RX_CTL_EN | CFG_RX_RCTS_ACK | CFG_RX_BCN_EN  | CFG_RX_AUTH_EN  | CFG_RX_ASSOC_EN)
+#define RX_FILTER_OPTION_FILTER_ALL		0
+#define RX_FILTER_OPTION_DEF_PRSP_BCN	( CFG_RX_PRSP_EN | CFG_RX_MGMT_EN | CFG_RX_CTL_EN | CFG_RX_RCTS_ACK | CFG_RX_BCN_EN)
+#define RX_FILTER_OPTION_JOIN			( CFG_RX_MGMT_EN | CFG_RX_DATA_EN | CFG_RX_CTL_EN | CFG_RX_BCN_EN   | CFG_RX_AUTH_EN | CFG_RX_ASSOC_EN | CFG_RX_RCTS_ACK | CFG_RX_PRSP_EN)
+
+
+/*===============================================
+   Phy regs
+ ===============================================*/
+#define ACX_PHY_ADDR_REG                SBB_ADDR
+#define ACX_PHY_DATA_REG                SBB_DATA
+#define ACX_PHY_CTRL_REG                SBB_CTL
+#define ACX_PHY_REG_WR_MASK             0x00000001ul
+#define ACX_PHY_REG_RD_MASK             0x00000002ul    
+
+
+/*===============================================
+ EEPROM Read/Write Request 32bit RW 
+ ------------------------------------------
+ 1 EE_READ - EEPROM Read Request 1 - Setting this bit 
+   loads a single byte of data into the EE_DATA 
+   register from the EEPROM location specified in 
+   the EE_ADDR register. 
+   The Wlan hardware hardware clears this bit automatically. 
+   EE_DATA is valid when this bit is cleared.
+ 0 EE_WRITE  - EEPROM Write Request  - Setting this bit 
+   writes a single byte of data from the EE_DATA register into the
+   EEPROM location specified in the EE_ADDR register. 
+   The Wlan hardware hardware clears this bit automatically.
+*===============================================*/
+#define ACX_EE_CTL_REG                      EE_CTL
+#define EE_WRITE                            0x00000001ul
+#define EE_READ                             0x00000002ul
+
+/*===============================================
+ EEPROM Address  - 32bit RW 
+ ------------------------------------------
+ This register specifies the address 
+ within the EEPROM from/to which to read/write data.
+===============================================*/
+#define ACX_EE_ADDR_REG                     EE_ADDR
+
+/*===============================================
+ EEPROM Data  - 32bit RW 
+ ------------------------------------------
+    This register either holds the read 8 bits of 
+    data from the EEPROM or the write data 
+    to be written to the EEPROM.
+===============================================*/
+#define ACX_EE_DATA_REG                     EE_DATA
+
+/*===============================================
+ EEPROM Base Address  - 32bit RW 
+ ------------------------------------------
+    This register holds the upper nine bits 
+    [23:15] of the 24-bit Wlan hardware memory 
+    address for burst reads from EEPROM accesses. 
+    The EEPROM provides the lower 15 bits of this address. 
+    The MSB of the address from the EEPROM is ignored.
+===============================================*/
+#define ACX_EE_CFG                          EE_CFG  
+
+/*===============================================
+  GPIO Output Values  -32bit, RW
+ ------------------------------------------
+    [31:16]  Reserved 
+    [15: 0]  Specify the output values (at the output driver inputs) for
+             GPIO[15:0], respectively.
+===============================================*/
+#define ACX_GPIO_OUT_REG            GPIO_OUT
+#define ACX_MAX_GPIO_LINES          15
+
+/*===============================================
+  Contention window  -32bit, RW
+ ------------------------------------------
+    [31:26]  Reserved 
+    [25:16]  Max (0x3ff)
+    [15:07]  Reserved
+    [06:00]  Current contention window value - default is 0x1F
+===============================================*/
+#define ACX_CONT_WIND_CFG_REG    CONT_WIND_CFG
+#define ACX_CONT_WIND_MIN_MASK   0x0000007f
+#define ACX_CONT_WIND_MAX        0x03ff0000
+
+/*
+ * Indirect slave register/memory registers
+ * ----------------------------------------
+ */
+#define HW_SLAVE_REG_ADDR_REG		0x00000004
+#define HW_SLAVE_REG_DATA_REG		0x00000008
+#define HW_SLAVE_REG_CTRL_REG		0x0000000c
+
+#define SLAVE_AUTO_INC				0x00010000
+#define SLAVE_NO_AUTO_INC			0x00000000
+#define SLAVE_HOST_LITTLE_ENDIAN	0x00000000
+
+#define HW_SLAVE_MEM_ADDR_REG		SLV_MEM_ADDR
+#define HW_SLAVE_MEM_DATA_REG		SLV_MEM_DATA
+#define HW_SLAVE_MEM_CTRL_REG		SLV_MEM_CTL
+#define HW_SLAVE_MEM_ENDIAN_REG		SLV_END_CTL
+
+#define HW_FUNC_EVENT_INT_EN		0x8000
+#define HW_FUNC_EVENT_MASK_REG		0x00000034
+
+#define ACX_MAC_TIMESTAMP_REG	(MAC_TIMESTAMP)
+
+/*===============================================
+  HI_CFG Interface Configuration Register Values
+ ------------------------------------------
+===============================================*/
+#define HI_CFG_UART_ENABLE          0x00000004
+#define HI_CFG_RST232_ENABLE        0x00000008
+#define HI_CFG_CLOCK_REQ_SELECT     0x00000010
+#define HI_CFG_HOST_INT_ENABLE      0x00000020
+#define HI_CFG_VLYNQ_OUTPUT_ENABLE  0x00000040
+#define HI_CFG_HOST_INT_ACTIVE_LOW  0x00000080
+#define HI_CFG_UART_TX_OUT_GPIO_15  0x00000100
+#define HI_CFG_UART_TX_OUT_GPIO_14  0x00000200
+#define HI_CFG_UART_TX_OUT_GPIO_7   0x00000400
+
+/*
+ * NOTE: USE_ACTIVE_HIGH compilation flag should be defined in makefile
+ *       for platforms using active high interrupt level
+ */
+#ifdef USE_IRQ_ACTIVE_HIGH
+#define HI_CFG_DEF_VAL              \
+        HI_CFG_UART_ENABLE |        \
+        HI_CFG_RST232_ENABLE |      \
+        HI_CFG_CLOCK_REQ_SELECT |   \
+        HI_CFG_HOST_INT_ENABLE
+#else
+#define HI_CFG_DEF_VAL              \
+        HI_CFG_UART_ENABLE |        \
+        HI_CFG_RST232_ENABLE |      \
+        HI_CFG_CLOCK_REQ_SELECT |   \
+        HI_CFG_HOST_INT_ENABLE |    \
+        HI_CFG_HOST_INT_ACTIVE_LOW
+#endif
+
+#endif   /* DEVICE_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/Device1273.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,987 @@
+/*
+ * Device1273.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+/**********************************************************************************************************************
+
+  FILENAME:       Device1273.h
+
+  DESCRIPTION:    TNETW1273 Registes addresses/defintion
+
+
+
+***********************************************************************************************************************/
+
+#ifndef DEVICE1273_H
+#define DEVICE1273_H
+
+
+/* Base addresses*/
+/* They are not used inside registers definition in purpose to allow this header file*/
+/* to be used as an easy reference to register -> address date base. Keep this as it*/
+/* is very powerful for debugging purpose.*/
+#define REGISTERS_BASE	0x00300000
+#define INT_BASE		0x00300400
+#define REG_CONFIG_BASE	0x00300800
+#define CLK_BASE		0x00300C00
+#define SDMA_BASE		0x00301000
+#define AES_BASE		0x00301400
+#define WEP_BASE		0x00301800
+#define TKIP_BASE		0x00301C00
+#define SEEPROM_BASE	0x00302000
+#define PAR_HOST_BASE	0x00302400
+#define SDIO_BASE		0x00302800
+#define UART_BASE		0x00302C00
+#define USB11_BASE		0x00304000
+#define LDMA_BASE		0x00304400
+#define RX_BASE			0x00304800
+#define ACCESS_BASE		0x00304c00
+#define TX_BASE			0x00305000
+#define RMAC_CSR_BASE	0x00305400
+#define AFE_PM			0x00305800
+#define VLYNQ_BASE		0x00308000
+#define PCI_BASE		0x00308400
+#define USB20_BASE		0x0030A000
+#define DRPW_BASE		0x00310000
+#define PHY_BASE		0x003C0000
+
+/* DRPw init scratch register */
+#define DRPW_SCRATCH_START             (DRPW_BASE + 0x002C)
+
+/* System DMA registers*/
+/* Order of registers was changed*/
+#define DMA_GLB_CFG                    (REGISTERS_BASE + 0x1000)
+#define DMA_HDESC_OFFSET               (REGISTERS_BASE + 0x1004)
+#define DMA_HDATA_OFFSET               (REGISTERS_BASE + 0x1008)
+#define DMA_CFG0                       (REGISTERS_BASE + 0x100C) /* SDMA_HOST_CFG0 changed*/
+#define DMA_CTL0                       (REGISTERS_BASE + 0x1010) /* SDMA_CTRL0 changed*/
+#define DMA_LENGTH0                    (REGISTERS_BASE + 0x1014)
+#define DMA_L_ADDR0                    (REGISTERS_BASE + 0x1018) /* SDMA_RD_ADDR ?*/
+#define DMA_L_PTR0                     (REGISTERS_BASE + 0x101C) /* SDMA_RD_OFFSET ?*/
+#define DMA_H_ADDR0                    (REGISTERS_BASE + 0x1020) /* SDMA_WR_ADDR ?*/
+#define DMA_H_PTR0                     (REGISTERS_BASE + 0x1024) /* SDMA_WR_OFFSET ?*/
+#define DMA_STS0                       (REGISTERS_BASE + 0x1028) /* Changed*/
+#define DMA_CFG1                       (REGISTERS_BASE + 0x1030) /* SDMA_HOST_CFG1 changed*/
+#define DMA_CTL1                       (REGISTERS_BASE + 0x1034) /* SDMA_CTRL1 changed*/
+#define DMA_LENGTH1                    (REGISTERS_BASE + 0x1038)
+#define DMA_L_ADDR1                    (REGISTERS_BASE + 0x103C)
+#define DMA_L_PTR1                     (REGISTERS_BASE + 0x1040)
+#define DMA_H_ADDR1                    (REGISTERS_BASE + 0x1044)
+#define DMA_H_PTR1                     (REGISTERS_BASE + 0x1048)
+#define DMA_STS1                       (REGISTERS_BASE + 0x104C)
+#define DMA_HFRM_PTR                   (REGISTERS_BASE + 0x1050) /* New ?*/
+#define DMA_DEBUG                      (REGISTERS_BASE + 0x1054) /* Changed*/
+
+/* Local DMA registers*/
+/* number changed from 4 to 2*/
+#define LDMA_DEBUG                     (REGISTERS_BASE + 0x4400)
+#define LDMA_CTL0                      (REGISTERS_BASE + 0x4404) /* Add 2 bits to support fix address (FIFO)*/
+#define LDMA_STATUS0                   (REGISTERS_BASE + 0x4408)
+#define LDMA_LENGTH0                   (REGISTERS_BASE + 0x440c)
+#define LDMA_RD_ADDR0                  (REGISTERS_BASE + 0x4410)
+#define LDMA_RD_OFFSET0                (REGISTERS_BASE + 0x4414)
+#define LDMA_WR_ADDR0                  (REGISTERS_BASE + 0x4418)
+#define LDMA_WR_OFFSET0                (REGISTERS_BASE + 0x441c)
+#define LDMA_CTL1                      (REGISTERS_BASE + 0x4428) /* Add 2 bits to support fix address (FIFO)*/
+#define LDMA_STATUS1                   (REGISTERS_BASE + 0x442c)
+#define LDMA_LENGTH1                   (REGISTERS_BASE + 0x4430)
+#define LDMA_RD_ADDR1                  (REGISTERS_BASE + 0x4434)
+#define LDMA_RD_OFFSET1                (REGISTERS_BASE + 0x4438)
+#define LDMA_WR_ADDR1                  (REGISTERS_BASE + 0x443c)
+#define LDMA_WR_OFFSET1                (REGISTERS_BASE + 0x4440)
+/* For TNETW compatability (if willbe )*/
+#define LDMA_CUR_RD_PTR0               LDMA_RD_ADDR0
+#define LDMA_CUR_WR_PTR0               LDMA_WR_ADDR0
+#define LDMA_CUR_RD_PTR1               LDMA_RD_ADDR1
+#define LDMA_CUR_WR_PTR1               LDMA_WR_ADDR1
+
+/* Host Slave registers*/
+#define SLV_SOFT_RESET                 (REGISTERS_BASE + 0x0000) /* self clearing*/
+#define SLV_REG_ADDR                   (REGISTERS_BASE + 0x0004)
+#define SLV_REG_DATA                   (REGISTERS_BASE + 0x0008)
+#define SLV_REG_ADATA                  (REGISTERS_BASE + 0x000c)
+#define SLV_MEM_CP                     (REGISTERS_BASE + 0x0010)
+#define SLV_MEM_ADDR                   (REGISTERS_BASE + 0x0014)
+#define SLV_MEM_DATA                   (REGISTERS_BASE + 0x0018)
+#define SLV_MEM_QOS_DATA               (REGISTERS_BASE + 0x001A)
+#define SLV_MEM_CTL                    (REGISTERS_BASE + 0x001c) /* bit 19 moved to PCMCIA_CTL*/
+#define SLV_END_CTL                    (REGISTERS_BASE + 0x0020) /* 2 bits moved to ENDIAN_CTL*/
+
+/* Timer registers*/
+/* Timer1/2 count MAC clocks*/
+/* Timer3/4/5 count usec*/
+#define TIM1_CTRL                      (REGISTERS_BASE + 0x0918)
+#define TIM1_LOAD                      (REGISTERS_BASE + 0x091C)
+#define TIM1_CNT                       (REGISTERS_BASE + 0x0920)
+#define TIM2_CTRL                      (REGISTERS_BASE + 0x0924)
+#define TIM2_LOAD                      (REGISTERS_BASE + 0x0928)
+#define TIM2_CNT                       (REGISTERS_BASE + 0x092C)
+#define TIM3_CTRL                      (REGISTERS_BASE + 0x0930)
+#define TIM3_LOAD                      (REGISTERS_BASE + 0x0934)
+#define TIM3_CNT                       (REGISTERS_BASE + 0x0938)
+#define TIM4_CTRL                      (REGISTERS_BASE + 0x093C)
+#define TIM4_LOAD                      (REGISTERS_BASE + 0x0940)
+#define TIM4_CNT                       (REGISTERS_BASE + 0x0944)
+#define TIM5_CTRL                      (REGISTERS_BASE + 0x0948)
+#define TIM5_LOAD                      (REGISTERS_BASE + 0x094C)
+#define TIM5_CNT                       (REGISTERS_BASE + 0x0950)
+
+/* Watchdog registers*/
+#define WDOG_CTRL                      (REGISTERS_BASE + 0x0954)
+#define WDOG_LOAD                      (REGISTERS_BASE + 0x0958)
+#define WDOG_CNT                       (REGISTERS_BASE + 0x095C)
+#define WDOG_STS                       (REGISTERS_BASE + 0x0960)
+#define WDOG_FEED                      (REGISTERS_BASE + 0x0964)
+
+/* Interrupt registers*/
+/* 64 bit interrupt sources registers ws ced. sme interupts were removed and new ones were added*/
+/* Order was changed*/
+#define FIQ_MASK                       (REGISTERS_BASE + 0x0400)
+#define FIQ_MASK_L                     (REGISTERS_BASE + 0x0400)
+#define FIQ_MASK_H                     (REGISTERS_BASE + 0x0404)
+#define FIQ_MASK_SET                   (REGISTERS_BASE + 0x0408)
+#define FIQ_MASK_SET_L                 (REGISTERS_BASE + 0x0408)
+#define FIQ_MASK_SET_H                 (REGISTERS_BASE + 0x040C)
+#define FIQ_MASK_CLR                   (REGISTERS_BASE + 0x0410)
+#define FIQ_MASK_CLR_L                 (REGISTERS_BASE + 0x0410)
+#define FIQ_MASK_CLR_H                 (REGISTERS_BASE + 0x0414)
+#define IRQ_MASK                       (REGISTERS_BASE + 0x0418)
+#define IRQ_MASK_L                     (REGISTERS_BASE + 0x0418)
+#define IRQ_MASK_H                     (REGISTERS_BASE + 0x041C)
+#define IRQ_MASK_SET                   (REGISTERS_BASE + 0x0420)
+#define IRQ_MASK_SET_L                 (REGISTERS_BASE + 0x0420)
+#define IRQ_MASK_SET_H                 (REGISTERS_BASE + 0x0424)
+#define IRQ_MASK_CLR                   (REGISTERS_BASE + 0x0428)
+#define IRQ_MASK_CLR_L                 (REGISTERS_BASE + 0x0428)
+#define IRQ_MASK_CLR_H                 (REGISTERS_BASE + 0x042C)
+#define ECPU_MASK                      (REGISTERS_BASE + 0x0448)
+#define FIQ_STS_L                      (REGISTERS_BASE + 0x044C)
+#define FIQ_STS_H                      (REGISTERS_BASE + 0x0450)
+#define IRQ_STS_L                      (REGISTERS_BASE + 0x0454)
+#define IRQ_STS_H                      (REGISTERS_BASE + 0x0458)
+#define INT_STS_ND                     (REGISTERS_BASE + 0x0464)
+#define INT_STS_RAW_L                  (REGISTERS_BASE + 0x0464)
+#define INT_STS_RAW_H                  (REGISTERS_BASE + 0x0468)
+#define INT_STS_CLR                    (REGISTERS_BASE + 0x04B4)
+#define INT_STS_CLR_L                  (REGISTERS_BASE + 0x04B4)
+#define INT_STS_CLR_H                  (REGISTERS_BASE + 0x04B8)
+#define INT_ACK                        (REGISTERS_BASE + 0x046C)
+#define INT_ACK_L                      (REGISTERS_BASE + 0x046C)
+#define INT_ACK_H                      (REGISTERS_BASE + 0x0470)
+#define INT_TRIG                       (REGISTERS_BASE + 0x0474)
+#define INT_TRIG_L                     (REGISTERS_BASE + 0x0474)
+#define INT_TRIG_H                     (REGISTERS_BASE + 0x0478)
+#define HOST_STS_L                     (REGISTERS_BASE + 0x045C)
+#define HOST_STS_H                     (REGISTERS_BASE + 0x0460)
+#define HOST_MASK                      (REGISTERS_BASE + 0x0430)
+#define HOST_MASK_L                    (REGISTERS_BASE + 0x0430)
+#define HOST_MASK_H                    (REGISTERS_BASE + 0x0434)
+#define HOST_MASK_SET                  (REGISTERS_BASE + 0x0438)
+#define HOST_MASK_SET_L                (REGISTERS_BASE + 0x0438)
+#define HOST_MASK_SET_H                (REGISTERS_BASE + 0x043C)
+#define HOST_MASK_CLR                  (REGISTERS_BASE + 0x0440)
+#define HOST_MASK_CLR_L                (REGISTERS_BASE + 0x0440)
+#define HOST_MASK_CLR_H                (REGISTERS_BASE + 0x0444)
+
+/* GPIO Interrupts*/
+#define GPIO_INT_STS                   (REGISTERS_BASE + 0x0484) /* 22 GPIOs*/
+#define GPIO_INT_ACK                   (REGISTERS_BASE + 0x047C)
+#define GPIO_INT_MASK                  (REGISTERS_BASE + 0x0480)
+#define GPIO_POS_MASK                  (REGISTERS_BASE + 0x04BC) /* New*/
+#define GPIO_NEG_MASK                  (REGISTERS_BASE + 0x04C0) /* New*/
+
+/* Protocol Interrupts*/
+#define PROTO_INT_STS                  (REGISTERS_BASE + 0x0490) /* Add 2 PHY->MAC source interrupts*/
+#define PROTO_INT_ACK                  (REGISTERS_BASE + 0x0488)
+#define PROTO_INT_MASK                 (REGISTERS_BASE + 0x048C)
+
+/* Host Interrupts - The following Addresses are for 1273 */
+#define HINT_MASK                      (REGISTERS_BASE + 0x04DC)
+#define HINT_MASK_SET                  (REGISTERS_BASE + 0x04E0)
+#define HINT_MASK_CLR                  (REGISTERS_BASE + 0x04E4)
+#define HINT_STS_ND_MASKED             (REGISTERS_BASE + 0x04EC)
+#define HINT_STS_ND  		           (REGISTERS_BASE + 0x04E8)	/* 1150 spec calls this HINT_STS_RAW*/
+#define HINT_STS_CLR                   (REGISTERS_BASE + 0x04F8)
+#define HINT_ACK                       (REGISTERS_BASE + 0x04F0)
+#define HINT_TRIG                      (REGISTERS_BASE + 0x04F4)
+
+/* Clock registers*/
+#define CLK_CFG                        (REGISTERS_BASE + 0x0C00) /* new ARM clock bit */
+#define CLK_CTRL                       (REGISTERS_BASE + 0x0C04) /* changed*/
+#define BLK_RST                        (REGISTERS_BASE + 0x0C08) /* changed*/
+#define CFG_USEC_STB                   (REGISTERS_BASE + 0x0C0C)
+#define ARM_GATE_CLK_REG               (REGISTERS_BASE + 0x0C10) /* new*/
+#define BUSY_STAT_REG                  (REGISTERS_BASE + 0x0C14) /* new*/
+#define CFG_PHY_CLK88                  (REGISTERS_BASE + 0x0C18)
+#define DYNAMIC_CLKGATE                (REGISTERS_BASE + 0x0C1C) /* new*/
+
+/* AES registers*/
+/* Major changes to this module*/
+#define AES_START                      (REGISTERS_BASE + 0x1400)
+#define AES_CFG                        (REGISTERS_BASE + 0x1404)
+#define AES_CTL                        (REGISTERS_BASE + 0x1408)
+#define AES_STATUS                     (REGISTERS_BASE + 0x140C)
+#define AES_LENGTH                     (REGISTERS_BASE + 0x1410)
+#define AES_RD_ADDR                    (REGISTERS_BASE + 0x1414)
+#define AES_RD_OFFSET                  (REGISTERS_BASE + 0x1418)
+#define AES_WR_ADDR                    (REGISTERS_BASE + 0x141C)
+#define AES_WR_OFFSET                  (REGISTERS_BASE + 0x1420)
+#define AES_CUR_RD_PTR                 (REGISTERS_BASE + 0x1424)
+#define AES_CUR_WR_PTR                 (REGISTERS_BASE + 0x1428)
+#define AES_KEY_0                      (REGISTERS_BASE + 0x142C)
+#define AES_KEY_1                      (REGISTERS_BASE + 0x1430)
+#define AES_KEY_2                      (REGISTERS_BASE + 0x1434)
+#define AES_KEY_3                      (REGISTERS_BASE + 0x1438)
+#define AES_NONCE_0                    (REGISTERS_BASE + 0x143C)
+#define AES_NONCE_1                    (REGISTERS_BASE + 0x1440)
+#define AES_NONCE_2                    (REGISTERS_BASE + 0x1444)
+#define AES_NONCE_3                    (REGISTERS_BASE + 0x1448)
+#define AES_MIC_0                      (REGISTERS_BASE + 0x144C)
+#define AES_MIC_1                      (REGISTERS_BASE + 0x1450)
+#define AES_MIC_2                      (REGISTERS_BASE + 0x1454)
+#define AES_MIC_3                      (REGISTERS_BASE + 0x1458)
+#define AES_ASSO_DATA_0                (REGISTERS_BASE + 0x145C)
+#define AES_ASSO_DATA_1                (REGISTERS_BASE + 0x1460)
+#define AES_ASSO_DATA_2                (REGISTERS_BASE + 0x1464)
+#define AES_ASSO_DATA_3                (REGISTERS_BASE + 0x1468)
+#define AES_NUM_OF_ROUNDS              (REGISTERS_BASE + 0x146C)
+#define AES_TX_QUEUE_PTR               (REGISTERS_BASE + 0x1470)
+#define AES_RX_QUEUE_PTR               (REGISTERS_BASE + 0x1474)
+#define AES_STACK                      (REGISTERS_BASE + 0x1478)
+#define AES_INT_RAW                    (REGISTERS_BASE + 0x147C)
+#define AES_INT_MASK                   (REGISTERS_BASE + 0x1480)
+#define AES_INT_STS                    (REGISTERS_BASE + 0x1484)
+
+/* WEP registers*/
+/* Order was changed*/
+#define DEC_CTL                        (REGISTERS_BASE + 0x1800)
+#define DEC_STATUS                     (REGISTERS_BASE + 0x1804)
+#define DEC_MBLK                       (REGISTERS_BASE + 0x1808)
+#define DEC_KEY_ADDR                   (REGISTERS_BASE + 0x180C)
+#define DEC_KEY_LEN                    (REGISTERS_BASE + 0x1810)
+#define DEC_ADDR_UPPER_BYTE            (REGISTERS_BASE + 0x1814) /* new*/
+#define DEC_LEN                        (REGISTERS_BASE + 0x1818)
+#define DEC_OFFSET                     (REGISTERS_BASE + 0x181C)
+#define DEC_WR_MBLK                    (REGISTERS_BASE + 0x1820)
+#define DEC_WR_OFFSET                  (REGISTERS_BASE + 0x1824)
+
+/* TKIP MICHAEL reisters*/
+/* order changed*/
+#define MCHL_START0                    (REGISTERS_BASE + 0x1C00)
+#define MCHL_DMV_START_MBLK0           (REGISTERS_BASE + 0x1C04) /* Changed to 23:5 format*/
+#define MCHL_DMV_CUR_MBLK0             (REGISTERS_BASE + 0x1C10)
+#define MCHL_DMV_OFFSET0               (REGISTERS_BASE + 0x1C08)
+#define MCHL_DMV_LENGTH0               (REGISTERS_BASE + 0x1C0C)
+#define MCHL_DMV_CFG0                  (REGISTERS_BASE + 0x1C14)
+#define MCHL_KEY_L0                    (REGISTERS_BASE + 0x1C18)
+#define MCHL_KEY_H0                    (REGISTERS_BASE + 0x1C1C)
+#define MCHL_MIC_L0                    (REGISTERS_BASE + 0x1C20)
+#define MCHL_MIC_H0                    (REGISTERS_BASE + 0x1C24)
+#define MCHL_START1                    (REGISTERS_BASE + 0x1C28)
+#define MCHL_DMV_START_MBLK1           (REGISTERS_BASE + 0x1C2C) /* Changed to 23:5 format*/
+#define MCHL_DMV_CUR_MBLK1             (REGISTERS_BASE + 0x1C38)
+#define MCHL_DMV_OFFSET1               (REGISTERS_BASE + 0x1C30)
+#define MCHL_DMV_LENGTH1               (REGISTERS_BASE + 0x1C34)
+#define MCHL_DMV_CFG1                  (REGISTERS_BASE + 0x1C3C)
+#define MCHL_KEY_L1                    (REGISTERS_BASE + 0x1C40)
+#define MCHL_KEY_H1                    (REGISTERS_BASE + 0x1C44)
+#define MCHL_MIC_L1                    (REGISTERS_BASE + 0x1C48)
+#define MCHL_MIC_H1                    (REGISTERS_BASE + 0x1C4C)
+#define MCHL_CTL0                      (REGISTERS_BASE + 0x1C50) /* new name MCHL_CTRL0*/
+#define MCHL_CTL1                      (REGISTERS_BASE + 0x1C54) /* new name MCHL_CTRL1*/
+#define MCHL_UPPER_BYTE_ADDR0          (REGISTERS_BASE + 0x1C58) /* new*/
+#define MCHL_UPPER_BYTE_ADDR1          (REGISTERS_BASE + 0x1C5C) /* new*/
+
+/* SEEPROM registers*/
+#define EE_CFG                         (REGISTERS_BASE + 0x0820)
+#define EE_CTL                         (REGISTERS_BASE + 0x2000)
+#define EE_DATA                        (REGISTERS_BASE + 0x2004)
+#define EE_ADDR                        (REGISTERS_BASE + 0x2008)
+
+/* Parallel Host (PCI/CARDBUS/PCMCIA/GS*/
+#define CIS_LADDR                      (REGISTERS_BASE + 0x2400)
+#define HI_CTL                         (REGISTERS_BASE + 0x2404)
+#define LPWR_MGT                       (REGISTERS_BASE + 0x2408)
+/*#define PDR0                         (REGISTERS_BASE + 0x04ec)*/
+/*#define PDR1                         (REGISTERS_BASE + 0x04f0)*/
+/*#define PDR2                         (REGISTERS_BASE + 0x04f4)*/
+/*#define PDR3                         (REGISTERS_BASE + 0x04f8)*/
+/*#define BAR2_ENABLE                  (REGISTERS_BASE + 0x04fc)*/
+/*#define BAR2_TRANS                   (REGISTERS_BASE + 0x0500)*/
+/*#define BAR2_MASK                    (REGISTERS_BASE + 0x0504)*/
+#define PCI_MEM_SIZE1                  (REGISTERS_BASE + 0x2428)
+#define PCI_MEM_OFFSET1                (REGISTERS_BASE + 0x242C)
+#define PCI_MEM_OFFSET2                (REGISTERS_BASE + 0x2430)
+/*#define PCI_IO_SIZE1                 (REGISTERS_BASE + 0x0514)*/
+/*#define PCI_IO_OFFSET1               (REGISTERS_BASE + 0x0518)*/
+/*#define PCI_IO_OFFSET2               (REGISTERS_BASE + 0x051c)*/
+/*#define PCI_CFG_OFFSET               (REGISTERS_BASE + 0x0520)*/
+#define PCMCIA_CFG                     (REGISTERS_BASE + 0x2444)
+#define PCMCIA_CTL                     (REGISTERS_BASE + 0x2448)
+#define PCMCIA_CFG2                    (REGISTERS_BASE + 0x244C) /* new*/
+#define SRAM_PAGE                      (REGISTERS_BASE + 0x2450)
+#define CFG_PULLUPDN                   (REGISTERS_BASE + 0x2454)
+#define CIS_MAP                        (REGISTERS_BASE + 0x2458) /* new*/
+#define ENDIAN_CTRL                    (REGISTERS_BASE + 0x245C) /* new*/
+#define GS_SLEEP_ACCESS                (REGISTERS_BASE + 0x2480) /* new*/
+#define PCMCIA_PWR_DN                  (REGISTERS_BASE + 0x04C4) 
+#define PCI_OUTPUT_DLY_CFG             (REGISTERS_BASE + 0x2464) /* new*/
+
+/* VLYNQ registers*/
+/* VLYNQ2 was removed from hardware*/
+#define VL1_REV_ID                     (REGISTERS_BASE + 0x8000) /* VLYNQ_REVISION*/
+#define VL1_CTL                        (REGISTERS_BASE + 0x8004) /* VLYNQ_ CONTROL*/
+#define VL1_STS                        (REGISTERS_BASE + 0x8008) /* VLYNQ_STATUS*/
+#define VLYNQ_INTVEC                   (REGISTERS_BASE + 0x800C)
+#define VL1_INT_STS                    (REGISTERS_BASE + 0x8010) /* VLYNQ_INTCR*/
+#define VL1_INT_PEND                   (REGISTERS_BASE + 0x8014) /* VLYNQ_INTSR*/
+#define VL1_INT_PTR                    (REGISTERS_BASE + 0x8018) /* VLYNQ_INTPTR*/
+#define VL1_TX_ADDR                    (REGISTERS_BASE + 0x801C) /* VLYNQ_TX_MAP_ADDR*/
+#define VL1_RX_SIZE1                   (REGISTERS_BASE + 0x8020) /* VLYNQ_RX_MAP_SIZE1*/
+#define VL1_RX_OFF1                    (REGISTERS_BASE + 0x8024) /* VLYNQ_RX_MAP_OFFSET1*/
+#define VL1_RX_SIZE2                   (REGISTERS_BASE + 0x8028) /* VLYNQ_RX_MAP_SIZE2*/
+#define VL1_RX_OFF2                    (REGISTERS_BASE + 0x802C) /* VLYNQ_RX_MAP_OFFSET2*/
+#define VL1_RX_SIZE3                   (REGISTERS_BASE + 0x8030) /* VLYNQ_RX_MAP_SIZE3*/
+#define VL1_RX_OFF3                    (REGISTERS_BASE + 0x8034) /* VLYNQ_RX_MAP_OFFSET3*/
+#define VL1_RX_SIZE4                   (REGISTERS_BASE + 0x8038) /* VLYNQ_RX_MAP_SIZE4*/
+#define VL1_RX_OFF4                    (REGISTERS_BASE + 0x803C) /* VLYNQ_RX_MAP_OFFSET4*/
+#define VL1_CHIP_VER                   (REGISTERS_BASE + 0x8040) /* VLYNQ_CHIP_VER*/
+#define VLYNQ_AUTONEG                  (REGISTERS_BASE + 0x8044)
+#define VLYNQ_MANNEG                   (REGISTERS_BASE + 0x8048)
+#define VLYNQ_NEGSTAT                  (REGISTERS_BASE + 0x804C)
+#define VLYNQ_ENDIAN                   (REGISTERS_BASE + 0x805C)
+#define VL1_INT_VEC3_0                 (REGISTERS_BASE + 0x8060) /* VLYNQ_HW_INT3TO0_CFG*/
+#define VL1_INT_VEC7_4                 (REGISTERS_BASE + 0x8064) /* VLYNQ_HW_INT7TO4_CFG*/
+/* VLYNQ Remote configuration registers*/
+#define VL1_REM_REV_ID                 (REGISTERS_BASE + 0x8080) /* VLYNQ_REM_REVISION*/
+#define VL1_REM_CTL                    (REGISTERS_BASE + 0x8084) /* VLYNQ_REM_ CONTROL*/
+#define VL1_REM_STS                    (REGISTERS_BASE + 0x8088) /* VLYNQ_REM_STATUS*/
+#define VLYNQ_REM_INTVEC               (REGISTERS_BASE + 0x808C)
+#define VL1_REM_INT_STS                (REGISTERS_BASE + 0x8090) /* VLYNQ_REM_INTCR*/
+#define VL1_REM_INT_PEND               (REGISTERS_BASE + 0x8094) /* VLYNQ_REM_INTSR*/
+#define VL1_REM_INT_PTR                (REGISTERS_BASE + 0x8098) /* VLYNQ_REM_INTPTR*/
+#define VL1_REM_TX_ADDR                (REGISTERS_BASE + 0x809C) /* VLYNQ_REM_TX_MAP_ADDR*/
+#define VL1_REM_RX_SIZE1               (REGISTERS_BASE + 0x80A0) /* VLYNQ_REM_RX_MAP_SIZE1*/
+#define VL1_REM_RX_OFF1                (REGISTERS_BASE + 0x80A4) /* VLYNQ_REM_RX_MAP_OFFSET1*/
+#define VL1_REM_RX_SIZE2               (REGISTERS_BASE + 0x80A8) /* VLYNQ_REM_RX_MAP_SIZE2*/
+#define VL1_REM_RX_OFF2                (REGISTERS_BASE + 0x80AC) /* VLYNQ_REM_RX_MAP_OFFSET2*/
+#define VL1_REM_RX_SIZE3               (REGISTERS_BASE + 0x80B0) /* VLYNQ_REM_RX_MAP_SIZE3*/
+#define VL1_REM_RX_OFF3                (REGISTERS_BASE + 0x80B4) /* VLYNQ_REM_RX_MAP_OFFSET3*/
+#define VL1_REM_RX_SIZE4               (REGISTERS_BASE + 0x80B8) /* VLYNQ_REM_RX_MAP_SIZE4*/
+#define VL1_REM_RX_OFF4                (REGISTERS_BASE + 0x80BC) /* VLYNQ_REM_RX_MAP_OFFSET4*/
+#define VL1_REM_CHIP_VER               (REGISTERS_BASE + 0x80C0) /* VLYNQ_REM_CHIP_VER*/
+#define VLYNQ_REM_AUTONEG              (REGISTERS_BASE + 0x80C4)
+#define VLYNQ_REM_MANNEG               (REGISTERS_BASE + 0x80C8)
+#define VLYNQ_REM_NEGSTAT              (REGISTERS_BASE + 0x80CC)
+#define VLYNQ_REM_ENDIAN               (REGISTERS_BASE + 0x80DC)
+#define VL1_REM_INT_VEC3_0             (REGISTERS_BASE + 0x80E0) /* VLYNQ_REM_HW_INT3TO0_CFG*/
+#define VL1_REM_INT_VEC7_4             (REGISTERS_BASE + 0x80E4) /* VLYNQ_REM_HW_INT7TO4_CFG*/
+
+/* PCIIF*/
+/**/
+#define PCI_ID_REG                     (REGISTERS_BASE + 0x8400)
+#define PCI_STATUS_SET_REG             (REGISTERS_BASE + 0x8410)
+#define PCI_STATUS_CLR_REG             (REGISTERS_BASE + 0x8414)
+#define PCI_HIMASK_SET_REG             (REGISTERS_BASE + 0x8420)
+#define PCI_HIMASK_CLR_REG             (REGISTERS_BASE + 0x8424)
+#define PCI_AMASK_SET_REG              (REGISTERS_BASE + 0x8430)
+#define PCI_AMASK_CLR_REG              (REGISTERS_BASE + 0x8434)
+#define PCI_CLKRUN_REG                 (REGISTERS_BASE + 0x8438)
+#define PCI_BE_VENDOR_ID_REG           (REGISTERS_BASE + 0x8500)
+#define PCI_BE_COMMAND_REG             (REGISTERS_BASE + 0x8504)
+#define PCI_BE_REVISION_REG            (REGISTERS_BASE + 0x8508)
+#define PCI_BE_CL_SIZE_REG             (REGISTERS_BASE + 0x850C)
+#define PCI_BE_BAR0_MASK_REG           (REGISTERS_BASE + 0x8510)
+#define PCI_BE_BAR1_MASK_REG           (REGISTERS_BASE + 0x8514)
+#define PCI_BE_BAR2_MASK_REG           (REGISTERS_BASE + 0x8518)
+#define PCI_BE_BAR3_MASK_REG           (REGISTERS_BASE + 0x851C)
+#define PCI_BE_CIS_PTR_REG             (REGISTERS_BASE + 0x8528)
+#define PCI_BE_SUBSYS_ID_REG           (REGISTERS_BASE + 0x852C)
+#define PCI_BE_CAP_PTR_REG             (REGISTERS_BASE + 0x8534)
+#define PCI_BE_INTR_LINE_REG           (REGISTERS_BASE + 0x853C)
+#define PCI_BE_PM_CAP_REG              (REGISTERS_BASE + 0x8540)
+#define PCI_BE_PM_CTRL_REG             (REGISTERS_BASE + 0x8544)
+#define PCI_BE_PM_D0_CTRL_REG          (REGISTERS_BASE + 0x8560)
+#define PCI_BE_PM_D1_CTRL_REG          (REGISTERS_BASE + 0x8564)
+#define PCI_BE_PM_D2_CTRL_REG          (REGISTERS_BASE + 0x8568)
+#define PCI_BE_PM_D3_CTRL_REG          (REGISTERS_BASE + 0x856C)
+#define PCI_BE_SLV_CFG_REG             (REGISTERS_BASE + 0x8580)
+#define PCI_BE_ARB_CTRL_REG            (REGISTERS_BASE + 0x8584)
+                                       
+#define FER                            (REGISTERS_BASE + 0x85A0) /* PCI_BE_STSCHG_FE_REG*/
+#define FEMR                           (REGISTERS_BASE + 0x85A4) /* PCI_BE_STSCHG_FEM_REG*/
+#define FPSR                           (REGISTERS_BASE + 0x85A8) /* PCI_BE_STSCHG_FPS_REG*/
+#define FFER                           (REGISTERS_BASE + 0x85AC) /* PCI_BE_STSCHG_FFE_REG*/
+
+#define PCI_BE_BAR0_TRANS_REG          (REGISTERS_BASE + 0x85C0)
+#define PCI_BE_BAR1_TRANS_REG          (REGISTERS_BASE + 0x85C4)
+#define PCI_BE_BAR2_TRANS_REG          (REGISTERS_BASE + 0x85C8)
+#define PCI_BE_BAR3_TRANS_REG          (REGISTERS_BASE + 0x85CC)
+#define PCI_BE_BAR4_TRANS_REG          (REGISTERS_BASE + 0x85D0)
+#define PCI_BE_BAR5_TRANS_REG          (REGISTERS_BASE + 0x85D4)
+#define PCI_BE_BAR0_REG                (REGISTERS_BASE + 0x85E0)
+#define PCI_BE_BAR1_REG                (REGISTERS_BASE + 0x85E4)
+#define PCI_BE_BAR2_REG                (REGISTERS_BASE + 0x85E8)
+#define PCI_BE_BAR3_REG                (REGISTERS_BASE + 0x85EC)
+
+#define PCI_PROXY_DATA                 (REGISTERS_BASE + 0x8700)
+#define PCI_PROXY_ADDR                 (REGISTERS_BASE + 0x8704)
+#define PCI_PROXY_CMD                  (REGISTERS_BASE + 0x8708)
+#define PCI_CONTROL                    (REGISTERS_BASE + 0x8710)
+
+/* USB1.1 registers*/
+/**/
+#define USB_STS_CLR                    (REGISTERS_BASE + 0x4000)
+#define USB_STS_ND                     (REGISTERS_BASE + 0x4004)
+#define USB_INT_ACK                    (REGISTERS_BASE + 0x4008)
+#define USB_MASK                       (REGISTERS_BASE + 0x400c)
+#define USB_MASK_SET                   (REGISTERS_BASE + 0x4010)
+#define USB_MASK_CLR                   (REGISTERS_BASE + 0x4014)
+#define USB_WU                         (REGISTERS_BASE + 0x4018)
+#define USB_EP0_OUT_PTR                (REGISTERS_BASE + 0x401c)
+#define USB_EP0_OUT_VLD                (REGISTERS_BASE + 0x4020)
+#define USB_EP0_OUT_LEN                (REGISTERS_BASE + 0x4024)
+#define USB_EP0_IN_PTR                 (REGISTERS_BASE + 0x4028)
+#define USB_EP0_IN_VLD                 (REGISTERS_BASE + 0x402c)
+#define USB_EP0_IN_LEN                 (REGISTERS_BASE + 0x4030)
+#define USB_EP1_CFG                    (REGISTERS_BASE + 0x4034)
+#define USB_EP1_OUT_INT_CFG            (REGISTERS_BASE + 0x4038)
+#define USB_EP1_OUT_PTR                (REGISTERS_BASE + 0x403c)
+#define USB_EP1_OUT_VLD                (REGISTERS_BASE + 0x4040)
+#define USB_EP1_OUT_CUR_MBLK           (REGISTERS_BASE + 0x4044)
+#define USB_EP1_OUT_LEN                (REGISTERS_BASE + 0x4048)
+#define USB_EP1_IN_START_MBLK          (REGISTERS_BASE + 0x404c)
+#define USB_EP1_IN_LAST_MBLK           (REGISTERS_BASE + 0x4050)
+#define USB_EP1_IN_VLD                 (REGISTERS_BASE + 0x4054)
+
+#define USB_EP2_PTR                    (REGISTERS_BASE + 0x405c)
+#define USB_EP2_VLD                    (REGISTERS_BASE + 0x4060)
+#define USB_EP2_LEN                    (REGISTERS_BASE + 0x4064)
+#define USB_EP3_OUT_PTR0               (REGISTERS_BASE + 0x4068)
+#define USB_EP3_OUT_VLD0               (REGISTERS_BASE + 0x406c)
+#define USB_EP3_OUT_LEN0               (REGISTERS_BASE + 0x4070)
+#define USB_EP3_OUT_PTR1               (REGISTERS_BASE + 0x4074)
+#define USB_EP3_OUT_VLD1               (REGISTERS_BASE + 0x4078)
+#define USB_EP3_OUT_LEN1               (REGISTERS_BASE + 0x407c)
+#define USB_EP3_IN_PTR0                (REGISTERS_BASE + 0x4080)
+#define USB_EP3_IN_VLD0                (REGISTERS_BASE + 0x4084)
+#define USB_EP3_IN_LEN0                (REGISTERS_BASE + 0x4088)
+#define USB_EP3_IN_PTR1                (REGISTERS_BASE + 0x408c)
+#define USB_EP3_IN_VLD1                (REGISTERS_BASE + 0x4090)
+#define USB_EP3_IN_LEN1                (REGISTERS_BASE + 0x4094)
+#define USB_EP1_OUT_END_MBLK           (REGISTERS_BASE + 0x4098)
+#define USB_EP0_OUT_SETUP              (REGISTERS_BASE + 0x409c)
+#define USB_EP0_STALL                  (REGISTERS_BASE + 0x40a0)
+#define USB_EP1_IN_OFFSET              (REGISTERS_BASE + 0x40a4)
+
+/* Device Configuration registers*/
+#define SOR_CFG                        (REGISTERS_BASE + 0x0800)
+#define ECPU_CTRL                      (REGISTERS_BASE + 0x0804)
+#define HI_CFG                         (REGISTERS_BASE + 0x0808)
+#define EE_START                       (REGISTERS_BASE + 0x080C)
+
+/* IO Control registers*/
+#define SERIAL_HOST_IOCFG0             (REGISTERS_BASE + 0x0894) /* new*/
+#define SERIAL_HOST_IOCFG1             (REGISTERS_BASE + 0x0898) /* new*/
+#define SERIAL_HOST_IOCFG2             (REGISTERS_BASE + 0x089C) /* new*/
+#define SERIAL_HOST_IOCFG3             (REGISTERS_BASE + 0x08A0) /* new*/
+#define GPIO_IOCFG0                    (REGISTERS_BASE + 0x08F4) /* new*/
+#define GPIO_IOCFG1                    (REGISTERS_BASE + 0x08F8) /* new*/
+#define GPIO_IOCFG2                    (REGISTERS_BASE + 0x08FC) /* new*/
+#define GPIO_IOCFG3                    (REGISTERS_BASE + 0x0900) /* new*/
+#define CHIP_ID_B                      (REGISTERS_BASE + 0x5674) /* new*/
+#define CHIP_ID                        CHIP_ID_B/* Leave for TNETW compatability*/
+#define CHIP_ID_1273_PG10              (0x04030101)
+#define CHIP_ID_1273_PG20              (0x04030111)
+
+#define SYSTEM                         (REGISTERS_BASE + 0x0810)
+#define PCI_ARB_CFG                    (REGISTERS_BASE + 0x0814)
+#define BOOT_IRAM_CFG                  (REGISTERS_BASE + 0x0818)
+#define IO_CONTROL_ENABLE              (REGISTERS_BASE + 0x5450)
+#define MBLK_CFG                       (REGISTERS_BASE + 0x5460)
+#define RS232_BITINTERVAL              (REGISTERS_BASE + 0x0824)
+#define TEST_PORT                      (REGISTERS_BASE + 0x096C)
+#define DEBUG_PORT                     (REGISTERS_BASE + 0x0970)
+#define HOST_WR_ACCESS_REG             (REGISTERS_BASE + 0x09F8)
+
+/* GPIO registers*/
+#define GPIO_OE                        (REGISTERS_BASE + 0x082C) /* 22 GPIOs*/
+#define GPIO_OUT                       (REGISTERS_BASE + 0x0834)
+#define GPIO_IN                        (REGISTERS_BASE + 0x0830)
+#define GPO_CFG                        (REGISTERS_BASE + 0x083C)
+#define GPIO_SELECT                    (REGISTERS_BASE + 0x614C)
+#define GPIO_OE_RADIO                  (REGISTERS_BASE + 0x6140)
+#define PWRDN_BUS_L                    (REGISTERS_BASE + 0x0844)
+#define PWRDN_BUS_H                    (REGISTERS_BASE + 0x0848)
+#define DIE_ID_L                       (REGISTERS_BASE + 0x088C)
+#define DIE_ID_H                       (REGISTERS_BASE + 0x0890)
+
+/* Power Management registers*/
+/* */
+#define ELP_START                      (REGISTERS_BASE + 0x5800)
+#define ELP_CFG_MODE                   (REGISTERS_BASE + 0x5804)
+#define ELP_CMD                        (REGISTERS_BASE + 0x5808)
+#define PLL_CAL_TIME                   (REGISTERS_BASE + 0x5810)
+#define CLK_REQ_TIME                   (REGISTERS_BASE + 0x5814)
+#define CLK_BUF_TIME                   (REGISTERS_BASE + 0x5818)
+
+#define CFG_PLL_SYNC_CNT               (REGISTERS_BASE + 0x5820) /* Points to the CFG_PLL_SYNC_CNT_xx registers set*/
+#define CFG_PLL_SYNC_CNT_I             (REGISTERS_BASE + 0x5820)
+#define CFG_PLL_SYNC_CNT_II            (REGISTERS_BASE + 0x5824)
+#define CFG_PLL_SYNC_CNT_III           (REGISTERS_BASE + 0x5828)
+
+#define CFG_ELP_SLEEP_CNT              (REGISTERS_BASE + 0x5830) /* Points to the CFG_ELP_SLEEP_CNT_xx registers set*/
+#define CFG_ELP_SLEEP_CNT_I            (REGISTERS_BASE + 0x5830)
+#define CFG_ELP_SLEEP_CNT_II           (REGISTERS_BASE + 0x5834)
+#define CFG_ELP_SLEEP_CNT_III          (REGISTERS_BASE + 0x5838)
+#define CFG_ELP_SLEEP_CNT_IV           (REGISTERS_BASE + 0x583c)
+
+#define ELP_SLEEP_CNT                  (REGISTERS_BASE + 0x5840) /* Points to the ELP_SLEEP_CNT_xx registers set*/
+#define ELP_SLEEP_CNT_I                (REGISTERS_BASE + 0x5840)
+#define ELP_SLEEP_CNT_II               (REGISTERS_BASE + 0x5844)
+#define ELP_SLEEP_CNT_III              (REGISTERS_BASE + 0x5848)
+#define ELP_SLEEP_CNT_IV               (REGISTERS_BASE + 0x584c)
+
+#define ELP_WAKE_UP_STS                (REGISTERS_BASE + 0x5850)
+#define CFG_SLP_CLK_SEL                (REGISTERS_BASE + 0x5860)
+#define CFG_SLP_CLK_EN                 (REGISTERS_BASE + 0x5870)
+
+#define CFG_WAKE_UP_EN_I               (REGISTERS_BASE + 0x5880)
+#define CFG_WAKE_UP_EN_II              (REGISTERS_BASE + 0x5884)
+#define CFG_WAKE_UP_EN_III             (REGISTERS_BASE + 0x5888)
+
+#define CFG_ELP_PWRDN_I                (REGISTERS_BASE + 0x5890)
+#define CFG_ELP_PWRDN_II               (REGISTERS_BASE + 0x5894)
+#define CFG_ELP_PWRDN_III              (REGISTERS_BASE + 0x5898)
+
+#define CFG_POWER_DOWN_I               (REGISTERS_BASE + 0x58a0)
+#define CFG_POWER_DOWN_II              (REGISTERS_BASE + 0x58a4)
+#define CFG_POWER_DOWN_III             (REGISTERS_BASE + 0x58a8)
+
+#define CFG_BUCK_TESTMODE_I            (REGISTERS_BASE + 0x58b0)
+#define CFG_BUCK_TESTMODE_II           (REGISTERS_BASE + 0x58b4)
+
+#define POWER_STATUS_I                 (REGISTERS_BASE + 0x58C0)
+#define POWER_STATUS_II                (REGISTERS_BASE + 0x58C4)
+
+#define DIGLDO_BIAS_PROG_I             (REGISTERS_BASE + 0x58d0)
+#define DIGLDO_BIAS_PROG_II            (REGISTERS_BASE + 0x58d4)
+
+#define LDO2P8_BIAS_PROG_I             (REGISTERS_BASE + 0x58e0)
+#define LDO2P8_BIAS_PROG_II            (REGISTERS_BASE + 0x58e4)
+
+#define ADCLDO_BIAS_PROG               (REGISTERS_BASE + 0x58f0)
+
+#define REFSYS_PROG_I                  (REGISTERS_BASE + 0x5910)
+#define REFSYS_PROG_II                 (REGISTERS_BASE + 0x5914)
+
+#define PM_TEST_I                      (REGISTERS_BASE + 0x5920)
+#define PM_TEST_II                     (REGISTERS_BASE + 0x5924)
+
+#define POR_PROG                       (REGISTERS_BASE + 0x5930)
+
+#define TEST_PIN_DIR_I                 (REGISTERS_BASE + 0x5940)
+#define TEST_PIN_DIR_II                (REGISTERS_BASE + 0x5944)
+
+#define PROC_CTL                       (REGISTERS_BASE + 0x5950)
+
+#define ADC_REF_WAKEUP_I               (REGISTERS_BASE + 0x5960)
+#define ADC_REF_WAKEUP_II              (REGISTERS_BASE + 0x5964)
+#define ADC_REF_WAKEUP_III             (REGISTERS_BASE + 0x5968)
+#define ADC_REF_WAKEUP_IV              (REGISTERS_BASE + 0x596C)
+
+#define VREG_WAKEUP_I                  (REGISTERS_BASE + 0x5970)
+#define VREG_WAKEUP_II                 (REGISTERS_BASE + 0x5974)
+#define VREG_WAKEUP_III                (REGISTERS_BASE + 0x5978)
+#define VREG_WAKEUP_IV                 (REGISTERS_BASE + 0x597C)
+
+#define PLL_WAKEUP_I                   (REGISTERS_BASE + 0x5980)
+#define PLL_WAKEUP_II                  (REGISTERS_BASE + 0x5984)
+#define PLL_WAKEUP_III                 (REGISTERS_BASE + 0x5988)
+#define PLL_WAKEUP_IV                  (REGISTERS_BASE + 0x598C)
+
+#define XTALOSC_WAKEUP_I               (REGISTERS_BASE + 0x5990)
+#define XTALOSC_WAKEUP_II              (REGISTERS_BASE + 0x5994)
+#define XTALOSC_WAKEUP_III             (REGISTERS_BASE + 0x5998)
+#define XTALOSC_WAKEUP_IV              (REGISTERS_BASE + 0x599C)
+
+/* ----------*/
+
+#define PLL_PARAMETERS                 (REGISTERS_BASE + 0x6040)
+#define WU_COUNTER_PAUSE               (REGISTERS_BASE + 0x6008)
+#define WELP_ARM_COMMAND               (REGISTERS_BASE + 0x6100)
+
+/* ----------*/
+
+#define POWER_MGMT2                    (REGISTERS_BASE + 0x0840)
+#define POWER_MGMT                     (REGISTERS_BASE + 0x5098)
+#define MAC_HW_DOZE                    (REGISTERS_BASE + 0x090c)
+#define ECPU_SLEEP                     (REGISTERS_BASE + 0x0840)
+#define DOZE_CFG                       (REGISTERS_BASE + 0x54bc)
+#define DOZE2_CFG                      (REGISTERS_BASE + 0x081c)
+#define WAKEUP_CFG                     (REGISTERS_BASE + 0x54c0)
+#define WAKEUP_TIME_L                  (REGISTERS_BASE + 0x54c8)
+#define WAKEUP_TIME_H                  (REGISTERS_BASE + 0x54c4)
+
+/**/
+
+/*#define CPU_WAIT_CFG                 (f0020)*/
+/*#define CFG_QOS_ACM                  (f0046)*/
+
+/* Scratch Pad registers*/
+#define SCR_PAD0                       (REGISTERS_BASE + 0x5608)
+#define SCR_PAD1                       (REGISTERS_BASE + 0x560C)
+#define SCR_PAD2                       (REGISTERS_BASE + 0x5610)
+#define SCR_PAD3                       (REGISTERS_BASE + 0x5614)
+#define SCR_PAD4                       (REGISTERS_BASE + 0x5618)
+#define SCR_PAD4_SET                   (REGISTERS_BASE + 0x561C)
+#define SCR_PAD4_CLR                   (REGISTERS_BASE + 0x5620)
+#define SCR_PAD5                       (REGISTERS_BASE + 0x5624)
+#define SCR_PAD5_SET                   (REGISTERS_BASE + 0x5628)
+#define SCR_PAD5_CLR                   (REGISTERS_BASE + 0x562C)
+#define SCR_PAD6                       (REGISTERS_BASE + 0x5630)
+#define SCR_PAD7                       (REGISTERS_BASE + 0x5634)
+#define SCR_PAD8                       (REGISTERS_BASE + 0x5638)
+#define SCR_PAD9                       (REGISTERS_BASE + 0x563C)
+
+/* Spare registers*/
+#define SPARE_A1                       (REGISTERS_BASE + 0x0994)
+#define SPARE_A2                       (REGISTERS_BASE + 0x0998)
+#define SPARE_A3                       (REGISTERS_BASE + 0x099C)
+#define SPARE_A4                       (REGISTERS_BASE + 0x09A0)
+#define SPARE_A5                       (REGISTERS_BASE + 0x09A4)
+#define SPARE_A6                       (REGISTERS_BASE + 0x09A8)
+#define SPARE_A7                       (REGISTERS_BASE + 0x09AC)
+#define SPARE_A8                       (REGISTERS_BASE + 0x09B0)
+#define SPARE_B1                       (REGISTERS_BASE + 0x5420)
+#define SPARE_B2                       (REGISTERS_BASE + 0x5424)
+#define SPARE_B3                       (REGISTERS_BASE + 0x5428)
+#define SPARE_B4                       (REGISTERS_BASE + 0x542C)
+#define SPARE_B5                       (REGISTERS_BASE + 0x5430)
+#define SPARE_B6                       (REGISTERS_BASE + 0x5434)
+#define SPARE_B7                       (REGISTERS_BASE + 0x5438)
+#define SPARE_B8                       (REGISTERS_BASE + 0x543C)
+
+/* RMAC registers (Raleigh MAC)*/
+
+/* Station registers*/
+#define DEV_MODE                       (REGISTERS_BASE + 0x5464)
+#define STA_ADDR_L                     (REGISTERS_BASE + 0x546C)
+#define STA_ADDR_H                     (REGISTERS_BASE + 0x5470)
+#define BSSID_L                        (REGISTERS_BASE + 0x5474)
+#define BSSID_H                        (REGISTERS_BASE + 0x5478)
+#define AID_CFG                        (REGISTERS_BASE + 0x547C)
+#define BASIC_RATE_CFG                 (REGISTERS_BASE + 0x4C6C)
+#define BASIC_RATE_TX_CFG              (REGISTERS_BASE + 0x55F0)
+
+/* Protocol timers registers*/
+#define IFS_CFG0                       (REGISTERS_BASE + 0x5494)
+#define IFS_CFG1                       (REGISTERS_BASE + 0x5498)
+#define TIMEOUT_CFG                    (REGISTERS_BASE + 0x549C)
+#define CONT_WIND_CFG                  (REGISTERS_BASE + 0x54A0)
+#define BCN_INT_CFG                    (REGISTERS_BASE + 0x54A4)
+#define RETRY_CFG                      (REGISTERS_BASE + 0x54A8)
+#define DELAY_CFG                      (REGISTERS_BASE + 0x54B0)
+
+/* Hardware Override registers*/
+#define CCA_CFG                        (REGISTERS_BASE + 0x54CC)
+#define CCA_FILTER_CFG                 (REGISTERS_BASE + 0x5480)
+#define RADIO_PLL_CFG                  (REGISTERS_BASE + 0x555C)
+#define CCA_MON                        (REGISTERS_BASE + 0x54D0)
+#define TX_FRM_CTL                     (REGISTERS_BASE + 0x54D4)
+#define CONT_TX_EN                     (REGISTERS_BASE + 0x50EC)
+#define PHY_STANDBY_EN                 (REGISTERS_BASE + 0x5668)
+
+/* Transmit Setup registers*/
+#define TX_PING_PONG                   (REGISTERS_BASE + 0x5090)
+#define TX_CFG0                        (REGISTERS_BASE + 0x5000)
+#define TX_CFG1                        (REGISTERS_BASE + 0x5004)
+#define TX_CFG2                        (REGISTERS_BASE + 0x5008)
+#define MAX_LIFETIME                   (REGISTERS_BASE + 0x50FC)
+#define TX_PANG_SEL                    (REGISTERS_BASE + 0x50E0)
+#define TX_PANG0                       (REGISTERS_BASE + 0x50A0)
+#define TX_PING0                       (REGISTERS_BASE + 0x5010)
+#define TX_PONG0                       (REGISTERS_BASE + 0x5050)
+#define TX_PANG1                       (REGISTERS_BASE + 0x50A4)
+#define TX_PING1                       (REGISTERS_BASE + 0x5014)
+#define TX_PONG1                       (REGISTERS_BASE + 0x5054)
+#define TX_PANG2                       (REGISTERS_BASE + 0x50A8)
+#define TX_PING2                       (REGISTERS_BASE + 0x5018)
+#define TX_PONG2                       (REGISTERS_BASE + 0x5058)
+#define TX_PANG3                       (REGISTERS_BASE + 0x50AC)
+#define TX_PING3                       (REGISTERS_BASE + 0x501C)
+#define TX_PONG3                       (REGISTERS_BASE + 0x505C)
+#define TX_PANG4                       (REGISTERS_BASE + 0x50B0)
+#define TX_PING4                       (REGISTERS_BASE + 0x5020)
+#define TX_PONG4                       (REGISTERS_BASE + 0x5060)
+#define TX_PANG5                       (REGISTERS_BASE + 0x50B4)
+#define TX_PING5                       (REGISTERS_BASE + 0x5024)
+#define TX_PONG5                       (REGISTERS_BASE + 0x5064)
+#define TX_PANG6                       (REGISTERS_BASE + 0x50B8)
+#define TX_PING6                       (REGISTERS_BASE + 0x5028)
+#define TX_PONG6                       (REGISTERS_BASE + 0x5068)
+#define TX_PANG7                       (REGISTERS_BASE + 0x50BC)
+#define TX_PING7                       (REGISTERS_BASE + 0x502C)
+#define TX_PONG7                       (REGISTERS_BASE + 0x506C)
+#define TX_PANG8                       (REGISTERS_BASE + 0x50C0)
+#define TX_PING8                       (REGISTERS_BASE + 0x5030)
+#define TX_PONG8                       (REGISTERS_BASE + 0x5070)
+#define TX_PANG9                       (REGISTERS_BASE + 0x50C4)
+#define TX_PING9                       (REGISTERS_BASE + 0x5034)
+#define TX_PONG9                       (REGISTERS_BASE + 0x5074)
+#define TX_PANG10                      (REGISTERS_BASE + 0x50C8)
+#define TX_PING10                      (REGISTERS_BASE + 0x5038)
+#define TX_PONG10                      (REGISTERS_BASE + 0x5078)
+#define TX_PANG11                      (REGISTERS_BASE + 0x50CC)
+#define TX_PING11                      (REGISTERS_BASE + 0x503C)
+#define TX_PONG11                      (REGISTERS_BASE + 0x507C)
+
+/* Transmit Status registers*/
+#define TX_STATUS                      (REGISTERS_BASE + 0x509C)
+#define TX_PANG_EXCH                   (REGISTERS_BASE + 0x50D0)
+#define TX_PING_EXCH                   (REGISTERS_BASE + 0x5040)
+#define TX_PONG_EXCH                   (REGISTERS_BASE + 0x5080)
+#define TX_PANG_ATT                    (REGISTERS_BASE + 0x50D4)
+#define TX_PING_ATT                    (REGISTERS_BASE + 0x5044)
+#define TX_PONG_ATT                    (REGISTERS_BASE + 0x5084)
+#define TX_PANG_TIMESTAMP              (REGISTERS_BASE + 0x50DC)
+#define TX_PING_TIMESTAMP              (REGISTERS_BASE + 0x504C)
+#define TX_PONG_TIMESTAMP              (REGISTERS_BASE + 0x508C)
+
+/* Transmit State registers*/
+#define TX_STATE                       (REGISTERS_BASE + 0x5094)
+#define TX_PANG_OVRD_CFG               (REGISTERS_BASE + 0x50D8)
+#define TX_PING_OVRD_CFG               (REGISTERS_BASE + 0x5048)
+#define TX_PONG_OVRD_CFG               (REGISTERS_BASE + 0x5088)
+#define TX_HOLD_CFG                    (REGISTERS_BASE + 0x54D8)
+#define TSF_ADJ_CFG1                   (REGISTERS_BASE + 0x54DC)
+#define TSF_ADJ_CFG2                   (REGISTERS_BASE + 0x54E0)
+#define TSF_ADJ_CFG3                   (REGISTERS_BASE + 0x54E4)
+#define TSF_ADJ_CFG4                   (REGISTERS_BASE + 0x54E8)
+#define CFG_OFDM_TIMES0                (REGISTERS_BASE + 0x5648)
+#define CFG_OFDM_TIMES1                (REGISTERS_BASE + 0x564C)
+
+/* Beacon/Probe Response registers*/
+#define PRB_ADDR                       (REGISTERS_BASE + 0x54EC)
+#define PRB_LENGTH                     (REGISTERS_BASE + 0x54F0)
+#define BCN_ADDR                       (REGISTERS_BASE + 0x54F4)
+#define BCN_LENGTH                     (REGISTERS_BASE + 0x54F8)
+#define TIM_VALID0                     (REGISTERS_BASE + 0x54FC)
+#define TIM_ADDR0                      (REGISTERS_BASE + 0x5500)
+#define TIM_LENGTH0                    (REGISTERS_BASE + 0x5504)
+#define TIM_VALID1                     (REGISTERS_BASE + 0x5654)
+#define TIM_ADDR1                      (REGISTERS_BASE + 0x5658)
+#define TIM_LENGTH1                    (REGISTERS_BASE + 0x565C)
+#define TIM_SELECT                     (REGISTERS_BASE + 0x5660)
+#define TSF_CFG                        (REGISTERS_BASE + 0x5508)
+
+/* Other Hardware Generated Frames regi*/
+#define CTL_FRM_CFG                    (REGISTERS_BASE + 0x550C)
+#define MGMT_FRM_CFG                   (REGISTERS_BASE + 0x5510)
+#define CFG_ANT_SEL                    (REGISTERS_BASE + 0x5664)
+#define RMAC_ADDR_BASE                 (REGISTERS_BASE + 0x5680) /* new*/
+
+/* Protocol Interface Read Write Interf*/
+#define TXSIFS_TIMER                   (REGISTERS_BASE + 0x4C00)
+#define TXPIFS_TIMER                   (REGISTERS_BASE + 0x4C04)
+#define TXDIFS_TIMER                   (REGISTERS_BASE + 0x4C08)
+#define SLOT_TIMER                     (REGISTERS_BASE + 0x4C0C)
+#define BACKOFF_TIMER                  (REGISTERS_BASE + 0x4C10)
+#define BCN_PSP_TIMER                  (REGISTERS_BASE + 0x4C14)
+#define NAV                            (REGISTERS_BASE + 0x4C18)
+#define TSF_L                          (REGISTERS_BASE + 0x4C1C)
+#define TSF_H                          (REGISTERS_BASE + 0x4C20)
+#define TSF_PREV_L                     (REGISTERS_BASE + 0x4CC4) /* new */
+#define TSF_PREV_H                     (REGISTERS_BASE + 0x4CC8) /* new */
+#define TOUT_TIMER                     (REGISTERS_BASE + 0x4C2C)
+#define NEXT_TBTT_L                    (REGISTERS_BASE + 0x4C30)
+#define NEXT_TBTT_H                    (REGISTERS_BASE + 0x4C34)
+#define DTIM_CNT                       (REGISTERS_BASE + 0x4C38)
+#define CONT_WIND                      (REGISTERS_BASE + 0x4C3C)
+#define PRSP_REQ                       (REGISTERS_BASE + 0x4C40)
+#define PRSP_DA_L                      (REGISTERS_BASE + 0x4C44)
+#define PRSP_DA_H                      (REGISTERS_BASE + 0x4C48)
+#define PRSP_RETRY                     (REGISTERS_BASE + 0x4C4C)
+#define PSPOLL_REQ                     (REGISTERS_BASE + 0x4C50)
+#define NEXT_SEQ_NUM                   (REGISTERS_BASE + 0x4C54)
+#define PRSP_SEQ_NUM                   (REGISTERS_BASE + 0x4C58)
+#define BCN_SEQ_NUM                    (REGISTERS_BASE + 0x4C5C)
+#define MED_USAGE                      (REGISTERS_BASE + 0x4C24)
+#define MED_USAGE_TM                   (REGISTERS_BASE + 0x4C28)
+#define PRB_DLY                        (REGISTERS_BASE + 0x4C60)
+#define STA_SRC                        (REGISTERS_BASE + 0x4C64)
+#define STA_LRC                        (REGISTERS_BASE + 0x4C68)
+#define CFG_ACM                        (REGISTERS_BASE + 0x4C70)
+#define RAND_NUMB                      (REGISTERS_BASE + 0x4C6C)
+#define CFG_ACK_CTS_DOT11A             (REGISTERS_BASE + 0x4C74)
+#define CFG_ACK_CTS_DOT11B             (REGISTERS_BASE + 0x4C78)
+#define ACM_IFS_CFG0                   (REGISTERS_BASE + 0x4C7C)
+#define ACM_IFS_CFG1                   (REGISTERS_BASE + 0x4C80)
+#define ACM_IFS_CFG2                   (REGISTERS_BASE + 0x4C84)
+#define ACM_IFS_CFG3                   (REGISTERS_BASE + 0x4C88)
+#define ACK_CTS_FRM_CFG                (REGISTERS_BASE + 0x4C8C)
+#define CFG_RX_TSTMP_DLY0              (REGISTERS_BASE + 0x4C90)
+#define CFG_RX_TSTMP_DLY1              (REGISTERS_BASE + 0x4C94)
+#define CFG_RX_TSTMP_DLY2              (REGISTERS_BASE + 0x4C98)
+#define CFG_RX_TSTMP_DLY3              (REGISTERS_BASE + 0x4C9C)
+#define CCA_BUSY                       (REGISTERS_BASE + 0x4CA0)
+#define CCA_BUSY_CLR                   (REGISTERS_BASE + 0x4CA4)
+#define CCA_IDLE                       (REGISTERS_BASE + 0x4CA8)
+#define CCA_IDLE_CLR                   (REGISTERS_BASE + 0x4CAC)
+
+/* Receive Manager registers*/
+#define RX_HEAD_PTR                    (REGISTERS_BASE + 0x567C) /* new*/
+#define RX_TAIL_PTR                    (REGISTERS_BASE + 0x4898) /* new*/
+#define RX_CURR_PTR                    (REGISTERS_BASE + 0x5678) /* new*/
+#define RX_RESET                       (REGISTERS_BASE + 0x4800)
+#define RX_MODMODE                     (REGISTERS_BASE + 0x4838) /* new*/
+#define MAC_HEADER_BYTECNT             (REGISTERS_BASE + 0x4890)
+#define RX_MAC_BYTECNT_INT             (REGISTERS_BASE + 0x489C)
+#define MAC_HEADER_WORD0               (REGISTERS_BASE + 0x4868)
+#define MAC_HEADER_WORD1               (REGISTERS_BASE + 0x486C)
+#define MAC_HEADER_WORD2               (REGISTERS_BASE + 0x4870)
+#define MAC_HEADER_WORD3               (REGISTERS_BASE + 0x4874)
+#define MAC_HEADER_WORD4               (REGISTERS_BASE + 0x4878)
+#define MAC_HEADER_WORD5               (REGISTERS_BASE + 0x487C)
+#define MAC_HEADER_WORD6               (REGISTERS_BASE + 0x4880)
+#define MAC_HEADER_WORD7               (REGISTERS_BASE + 0x4884)
+#define MAC_HEADER_WORD8               (REGISTERS_BASE + 0x4888)
+#define MAC_HEADER_WORD9               (REGISTERS_BASE + 0x488C)
+#define RX_CFG                         (REGISTERS_BASE + 0x5514)
+#define RX_FILTER_CFG                  (REGISTERS_BASE + 0x55B4)
+#define RX_MC0_L                       (REGISTERS_BASE + 0x5518)
+#define RX_MC0_H                       (REGISTERS_BASE + 0x551C)
+#define RX_MC1_L                       (REGISTERS_BASE + 0x5520)
+#define RX_MC1_H                       (REGISTERS_BASE + 0x5524)
+#define STA_SSID0                      (REGISTERS_BASE + 0x4804)
+#define STA_SSID1                      (REGISTERS_BASE + 0x4808)
+#define STA_SSID2                      (REGISTERS_BASE + 0x480C)
+#define STA_SSID3                      (REGISTERS_BASE + 0x4810)
+#define STA_SSID4                      (REGISTERS_BASE + 0x4814)
+#define STA_SSID5                      (REGISTERS_BASE + 0x4818)
+#define STA_SSID6                      (REGISTERS_BASE + 0x481C)
+#define STA_SSID7                      (REGISTERS_BASE + 0x4820)
+#define SSID_LEN                       (REGISTERS_BASE + 0x4824)
+#define RX_FREE_MEM                    (REGISTERS_BASE + 0x5528)
+#define RX_CURR_MEM                    (REGISTERS_BASE + 0x552C)
+#define MAC_TIMESTAMP                  (REGISTERS_BASE + 0x5560) /* Check place*/
+#define RX_TIMESTAMP                   (REGISTERS_BASE + 0x5564)
+#define RX_FRM_PTR                     (REGISTERS_BASE + 0x5568)
+#define RX_FRM_LEN                     (REGISTERS_BASE + 0x556C)
+#define RX_PLCP_HDR                    (REGISTERS_BASE + 0x5570)
+#define RX_PLCP_SIGNAL                 (REGISTERS_BASE + 0x5574)
+#define RX_PLCP_SERVICE                (REGISTERS_BASE + 0x5578) /* 16 bits ?*/
+#define RX_PLCP_LENGTH                 (REGISTERS_BASE + 0x557C)
+#define RX_FRM_CTL                     (REGISTERS_BASE + 0x5580)
+#define RX_DUR_ID                      (REGISTERS_BASE + 0x5584)
+#define RX_ADDR1_L                     (REGISTERS_BASE + 0x5588)
+#define RX_ADDR1_H                     (REGISTERS_BASE + 0x558C)
+#define RX_ADDR2_L                     (REGISTERS_BASE + 0x5590)
+#define RX_ADDR2_H                     (REGISTERS_BASE + 0x5594)
+#define RX_ADDR3_L                     (REGISTERS_BASE + 0x5598)
+#define RX_ADDR3_H                     (REGISTERS_BASE + 0x559C)
+#define RX_SEQ_CTL                     (REGISTERS_BASE + 0x55A0)
+#define RX_WEP_IV                      (REGISTERS_BASE + 0x55A4)
+#define RX_TIME_L                      (REGISTERS_BASE + 0x55A8)
+#define RX_TIME_H                      (REGISTERS_BASE + 0x55AC)
+#define RX_STATUS                      (REGISTERS_BASE + 0x55B0)
+#define PLCP_ERR_CNT                   (REGISTERS_BASE + 0x4828)
+#define FCS_ERR_CNT                    (REGISTERS_BASE + 0x482C)
+#define RX_OVERFLOW_CNT                (REGISTERS_BASE + 0x4830)
+#define RX_DEBUG1                      (REGISTERS_BASE + 0x4858)
+#define RX_DEBUG2                      (REGISTERS_BASE + 0x485C)
+#define RX_QOS_CFG                     (REGISTERS_BASE + 0x4848)
+#define RX_QOS_CTL                     (REGISTERS_BASE + 0x4844)
+#define RX_QOS_STATUS                  (REGISTERS_BASE + 0x4854) /* new name RX_QOS_STS*/
+#define RX_TXOP_HOLDER_L               (REGISTERS_BASE + 0x484C)
+#define RX_TXOP_HOLDER_H               (REGISTERS_BASE + 0x4850)
+#define RX_FRM_CNT                     (REGISTERS_BASE + 0x4834) /* what is RX_FRM_CTR*/
+#define CONS_FCS_ERR_CNT               (REGISTERS_BASE + 0x483C)
+#define CONS_FCS_ERR_CFG               (REGISTERS_BASE + 0x4840)
+#define RX_QOS_CTL_MASK                (REGISTERS_BASE + 0x48A0) /* new*/
+#define RX_QOS_ACK_EN                  (REGISTERS_BASE + 0x48A4) /* new*/
+#define RX_QOS_NOACK_EN                (REGISTERS_BASE + 0x48A8) /* new*/
+#define RX_QOS_ACK_BITMAP              (REGISTERS_BASE + 0x48AC) /* new*/
+
+/* Baseband Processor registers*/
+#define SBB_CFG                        (REGISTERS_BASE + 0x55C8)
+#define SBB_ADDR                       (REGISTERS_BASE + 0x55D0)
+#define SBB_DATA                       (REGISTERS_BASE + 0x55D4)
+#define SBB_CTL                        (REGISTERS_BASE + 0x55D8)
+
+/* Radio Control Interface registers*/
+#define RCI_CTL                        (REGISTERS_BASE + 0x55DC)
+#define RCI_DATA                       (REGISTERS_BASE + 0x55E0)
+#define RCI_CFG1                       (REGISTERS_BASE + 0x55E4)
+#define RCI_CFG2                       (REGISTERS_BASE + 0x55E8)
+#define RCI_CFG3                       (REGISTERS_BASE + 0x55EC)
+
+#define TNET1150_LAST_REG_ADDR			PCI_CONTROL
+
+#define ECPU_CONTROL_HALT			   0x00000101				
+
+/*0x03bc00 address is 1KB from end of FW RAM in 125x chip*/
+#define FW_STATIC_NVS_TRAGET_ADDRESS   0x03bc00
+
+/* Command mail box address */
+#define CMD_MBOX_ADDRESS               0x407B4
+
+/* Top Register */
+#define INDIRECT_REG1                  (REGISTERS_BASE + 0x9B0)
+#define OCP_POR_CTR                    (REGISTERS_BASE + 0x9B4)
+#define OCP_POR_WDATA                  (REGISTERS_BASE + 0x9B8)
+#define OCP_DATA_RD                    (REGISTERS_BASE + 0x9BC)
+#define OCP_CMD                        (REGISTERS_BASE + 0x9C0)
+#define FUNC7_SEL                      0xC8C
+#define FUNC7_PULL                     0xCB0
+#define FN0_CCCR_REG_32                0x64  
+
+#define PLL_PARAMETERS_CLK_VAL_19_2M   0x01			
+#define PLL_PARAMETERS_CLK_VAL_26M     0x02				
+#define PLL_PARAMETERS_CLK_VAL_38_4M   0x03				
+#define PLL_PARAMETERS_CLK_VAL_52M     0x04				
+
+#define WU_COUNTER_PAUSE_VAL           0x3FF
+
+/* Base band clocker register */
+#define WELP_ARM_COMMAND_VAL           0x4
+
+/* Command mail box address */
+#define CMD_MBOX_ADDRESS               0x407B4
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriver.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1827 @@
+/*
+ * TWDriver.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TWDriver.c 
+ *  \brief TI WLAN Hardware Access Driver
+ *
+ *  \see   TWDriver.h 
+ */
+
+#define __FILE_ID__  FILE_ID_117
+#include "report.h"
+#include "TWDriver.h"
+#include "MacServices_api.h"
+#include "txCtrlBlk_api.h"
+#include "txHwQueue_api.h"
+#include "txXfer_api.h"
+#include "txResult_api.h"
+#include "rxXfer_api.h"
+#include "TwIf.h"
+#include "FwEvent_api.h"
+#include "CmdMBox_api.h"
+#include "CmdQueue_api.h"
+#include "eventMbox_api.h"
+#include "fwDebug_api.h"
+#include "osApi.h"
+#include "TWDriverInternal.h"
+#include "HwInit_api.h"
+#include "CmdBld.h"
+#include "RxQueue_api.h"
+
+
+
+void TWD_CheckSRConfigParams(TTwd  *pTWD, ACXSmartReflexConfigParams_t *tSmartReflexParams);
+
+
+#define TWD_CB_MODULE_OWNER_MASK    0xff00
+#define TWD_CB_TYPE_MASK            0x00ff
+
+#define FREF_CLK_FREQ_MASK      0x7
+
+
+
+
+TI_HANDLE TWD_Create (TI_HANDLE hOs)
+{
+    TTwd *pTWD;
+
+    /* Allocate the TNETW_Driver module */
+    pTWD = (TTwd *)os_memoryAlloc (hOs, sizeof(TTwd),MemoryNormal);
+    if (pTWD == NULL)
+    {
+        return NULL;
+    }
+
+    os_memoryZero (hOs, pTWD, sizeof(TTwd));
+
+    pTWD->hOs = hOs;
+
+    /* Create TwIf module */
+    pTWD->hTwIf = twIf_Create (hOs);
+    if (pTWD->hTwIf == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"twIf_Create failed\n");
+        WLAN_OS_REPORT(("twIf_Create failed\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    /* Create command builder module */
+    pTWD->hCmdBld = cmdBld_Create (hOs);
+    if (pTWD->hCmdBld == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"cmdBld_Create failed\n");
+        WLAN_OS_REPORT(("cmdBld_Create failed\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    /* Create the MAC Services module */
+    pTWD->hMacServices = MacServices_create (hOs);
+    if (pTWD->hMacServices == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE, "TWD MacServices_create failed!!!\n");
+        WLAN_OS_REPORT(("TWD MacServices_create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    /* Create the Ctrl module */
+    pTWD->hCmdQueue = cmdQueue_Create (hOs);
+    if (pTWD->hCmdQueue == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE, "TWD cmdQueue_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD cmdQueue_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    /* 
+     * Create the FW-Transfer modules:
+     */
+
+    pTWD->hTxXfer = txXfer_Create (hOs);
+    if (pTWD->hTxXfer == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"TWD txXfer_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD txXfer_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    pTWD->hTxResult = txResult_Create (hOs);
+    if (pTWD->hTxResult == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"TWD txResult_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD txResult_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    pTWD->hRxXfer = rxXfer_Create (hOs);
+    if (pTWD->hRxXfer == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"TWD rxXfer_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD rxXfer_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    pTWD->hFwEvent = fwEvent_Create (hOs);
+    if (pTWD->hFwEvent == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE, "TWD fwEvent_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD fwEvent_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    pTWD->hEventMbox = eventMbox_Create (hOs);
+    if (pTWD->hEventMbox == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE, "TWD eventMbox_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD eventMbox_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+#ifdef TI_DBG
+    pTWD->hFwDbg = fwDbg_Create (hOs);
+    if (pTWD->hFwDbg == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"TWD fwDbg_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD fwDbg_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+#endif /* TI_DBG */
+
+    pTWD->hCmdMbox = cmdMbox_Create (hOs);
+    if (pTWD->hCmdMbox == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"TWD cmdMbox_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD cmdMbox_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    pTWD->hRxQueue = RxQueue_Create (hOs);
+    if (pTWD->hRxQueue == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE, "TWD RxQueue_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD RxQueue_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+
+    /* 
+     * Create the Data-Services modules:
+     */
+
+    pTWD->hTxCtrlBlk = txCtrlBlk_Create (hOs);
+    if (pTWD->hTxCtrlBlk == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE, "TWD txCtrlBlk_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD txCtrlBlk_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    pTWD->hTxHwQueue = txHwQueue_Create (hOs);
+    if (pTWD->hTxHwQueue == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE, "TWD txHwQueue_Create failed!!!\n");
+        WLAN_OS_REPORT(("TWD txHwQueue_Create failed!!!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    pTWD->hHwInit = hwInit_Create (hOs);
+    if (pTWD->hHwInit == NULL)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"wInit_Create failed!\n"); 
+        WLAN_OS_REPORT (("wInit_Create failed!\n"));
+        TWD_Destroy ((TI_HANDLE)pTWD);
+        return NULL;
+    }
+
+    WLAN_INIT_REPORT (("TWD_Create: CREATED !!!\n"));
+
+    return (TI_HANDLE)pTWD;
+}
+
+TI_STATUS TWD_Destroy (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+    
+    WLAN_INIT_REPORT(("TWD_Destroy: called\n"));
+    if (pTWD == NULL) 
+    {
+        return TI_NOK;
+    }
+
+    if (pTWD->hTwIf != NULL)
+    {
+        twIf_Destroy (pTWD->hTwIf);
+        pTWD->hTwIf = NULL;
+    }
+
+    /* Free the Command Builder */
+    if (pTWD->hCmdBld != NULL)
+    {
+        cmdBld_Destroy (pTWD->hCmdBld);
+        pTWD->hCmdBld = NULL;
+    }
+    WLAN_INIT_REPORT(("TWD_Destroy: Command Builder released\n"));
+    
+    /* Free the MAC Services */
+    if (pTWD->hMacServices != NULL)
+    {
+        MacServices_destroy(pTWD->hMacServices);
+        pTWD->hMacServices = NULL;
+    }
+    WLAN_INIT_REPORT(("TWD_Destroy: Mac Services released\n"));
+    
+    /*
+     * Free the Ctrl modules
+     */
+    if (pTWD->hCmdQueue != NULL)
+    {
+        cmdQueue_Destroy(pTWD->hCmdQueue);
+        pTWD->hCmdQueue = NULL;
+    }
+
+    /* 
+     * Free the FW-Transfer modules:
+     */
+    if (pTWD->hTxXfer != NULL)
+    {
+        txXfer_Destroy (pTWD->hTxXfer);
+        pTWD->hTxXfer = NULL;
+    }
+
+    if (pTWD->hTxResult != NULL)
+    {
+        txResult_Destroy (pTWD->hTxResult);
+        pTWD->hTxResult = NULL;
+    }
+
+    if (pTWD->hRxXfer != NULL)
+    {
+        rxXfer_Destroy (pTWD->hRxXfer);
+        pTWD->hRxXfer = NULL;
+    }
+
+    if (pTWD->hEventMbox != NULL) 
+    {
+        eventMbox_Destroy (pTWD->hEventMbox);
+        pTWD->hEventMbox = NULL;
+    }
+
+#ifdef TI_DBG
+    if (pTWD->hFwDbg != NULL)
+    {
+        fwDbg_Destroy (pTWD->hFwDbg);
+        pTWD->hFwDbg = NULL;
+    }
+#endif /* TI_DBG */
+
+    if (pTWD->hFwEvent != NULL)
+    {
+        fwEvent_Destroy (pTWD->hFwEvent);
+        pTWD->hFwEvent = NULL;
+    }
+
+    if (pTWD->hCmdMbox != NULL)
+    {
+        cmdMbox_Destroy (pTWD->hCmdMbox);
+        pTWD->hCmdMbox = NULL;
+    }
+
+    if (pTWD->hRxQueue != NULL)
+    {
+        RxQueue_Destroy (pTWD->hRxQueue);
+		pTWD->hRxQueue = NULL;
+    }
+
+    /* 
+     * Free the Data-Services modules:
+     */
+
+    if (pTWD->hTxCtrlBlk != NULL)
+    {
+        txCtrlBlk_Destroy (pTWD->hTxCtrlBlk);
+        pTWD->hTxCtrlBlk = NULL;
+    }
+
+    if (pTWD->hTxHwQueue != NULL)
+    {
+        txHwQueue_Destroy (pTWD->hTxHwQueue);
+        pTWD->hTxHwQueue = NULL;
+    }
+    
+    if (pTWD->hHwInit != NULL)
+    {
+        hwInit_Destroy (pTWD->hHwInit);
+        pTWD->hHwInit = NULL;
+    }
+
+    os_memoryFree (pTWD->hOs, (TI_HANDLE)pTWD, sizeof(TTwd));
+    
+    WLAN_INIT_REPORT(("TWD_Destroy pTNETW_Driver released!!!\n"));
+    
+    return TI_OK;
+}
+
+
+/**
+ * \brief HW Init Callback
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return void 
+ * 
+ * \par Description
+ * Static CB function
+ * Called during TWD Module Init by hwInit_Init in order to complete the HW Configuration init
+ * 
+ * \sa     TWD_InitHw
+ */ 
+static void TWD_InitHwCb (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_InitHwCb: call fInitHwCb CB. In std drvMain_InitHwCb()\n");
+
+    hwInit_InitPolarity(pTWD->hHwInit);
+
+}
+
+void TWD_Init (TI_HANDLE    hTWD, 
+			   TI_HANDLE 	hReport, 
+               TI_HANDLE 	hUser, 
+			   TI_HANDLE 	hTimer, 
+			   TI_HANDLE 	hContext, 
+			   TI_HANDLE 	hTxnQ, 
+               TTwdCallback fInitHwCb, 
+               TTwdCallback fInitFwCb, 
+               TTwdCallback fConfigFwCb,
+			   TTwdCallback	fStopCb,
+			   TTwdCallback fInitFailCb)
+{ 
+    TTwd *pTWD 				= (TTwd *)hTWD;
+    pTWD->bInitSuccess 		= TI_FALSE;
+    pTWD->bRecoveryEnabled 	= TI_FALSE;
+    pTWD->hReport           = hReport;
+    pTWD->hUser 			= hUser;
+    pTWD->hTimer            = hTimer;
+    pTWD->hContext          = hContext;
+    pTWD->hTxnQ             = hTxnQ;
+    pTWD->fInitHwCb 		= fInitHwCb;
+    pTWD->fInitFwCb 		= fInitFwCb;
+    pTWD->fConfigFwCb 		= fConfigFwCb;
+    pTWD->fStopCb 			= fStopCb;
+    pTWD->fInitFailCb       = fInitFailCb;
+
+    TRACE1(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_Init: %x\n", hTWD);
+
+    /* FwEvent should be configured first */
+    fwEvent_Init (pTWD->hFwEvent, hTWD);
+
+    eventMbox_Config (pTWD->hEventMbox, pTWD->hTwIf, pTWD->hReport, pTWD->hFwEvent, pTWD->hCmdBld);
+
+    cmdQueue_Init (pTWD->hCmdQueue, 
+                     pTWD->hCmdMbox, 
+                     pTWD->hReport, 
+                     pTWD->hTwIf,
+                     pTWD->hTimer);
+
+    /* Configure Command Builder */ 
+    cmdBld_Config (pTWD->hCmdBld, 
+                   pTWD->hReport, 
+                   (void *)TWD_FinalizeDownload, 
+                   hTWD, 
+                   pTWD->hEventMbox, 
+                   pTWD->hCmdQueue,
+                   pTWD->hTwIf);
+
+    hwInit_Init (pTWD->hHwInit,
+                   pTWD->hReport, 
+                   hTWD, 
+	               hTWD, 
+		           (TFinalizeCb)TWD_FinalizeDownload, 
+                   TWD_InitHwCb);
+
+    /*
+     * Initialize the FW-Transfer modules
+     */
+    txXfer_Init (pTWD->hTxXfer, pTWD->hReport, pTWD->hTwIf);
+
+    txResult_Init (pTWD->hTxResult, pTWD->hReport, pTWD->hTwIf);
+
+    rxXfer_Init (pTWD->hRxXfer, pTWD->hFwEvent, pTWD->hReport, pTWD->hTwIf, pTWD->hRxQueue);
+
+    RxQueue_Init (pTWD->hRxQueue, pTWD->hReport);
+
+  #ifdef TI_DBG
+    fwDbg_Init (pTWD->hFwDbg, pTWD->hReport, pTWD->hTwIf);
+  #endif /* TI_DBG */
+
+    /* Initialize the MAC Services */
+    MacServices_init (pTWD->hMacServices, 
+                      pTWD->hReport, 
+                      hTWD, 
+                      pTWD->hCmdBld, 
+                      pTWD->hEventMbox,
+                      pTWD->hTimer);
+
+    /*
+     * Initialize the Data-Services modules
+     */
+    txCtrlBlk_Init (pTWD->hTxCtrlBlk, pTWD->hReport, pTWD->hContext);
+    txHwQueue_Init (pTWD->hTxHwQueue, pTWD->hReport);
+
+    /* Initialize the TwIf module */
+    twIf_Init (pTWD->hTwIf, pTWD->hReport, pTWD->hContext, pTWD->hTxnQ, (TRecoveryCb)TWD_StopComplete, hTWD);
+}
+
+ TI_STATUS TWD_InitHw (TI_HANDLE hTWD, 
+					  TI_UINT8 *pbuf, 
+					  TI_UINT32 length)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+    TI_STATUS eStatus;
+    
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_InitHw: called\n");
+
+    hwInit_SetNvsImage (pTWD->hHwInit, pbuf, length);
+
+     /* 
+     * Update the TwIf that the HW is awake 
+     * This will protect the initialization process from going to sleep
+     * After the firmware initializations completed (TWD_EnableExternalEvents), the sleep will be enabled 
+     */
+    twIf_Awake (pTWD->hTwIf);
+    twIf_HwAvailable (pTWD->hTwIf);
+
+    /* This initiates the HW init sequence */
+    eStatus = hwInit_Boot(pTWD->hHwInit);
+    if (eStatus == TXN_STATUS_ERROR)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR , "TWD_InitHw: hwInit_Boot failed\n");
+        return TI_NOK;
+    }
+
+    return TI_OK;
+}
+
+TI_STATUS TWD_BusOpen (TI_HANDLE hTWD, void* pParams)
+{
+	TTwd *pTWD = (TTwd *)hTWD;
+	TI_STATUS uStatus;
+	
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_BusOpen: called\n");
+
+    /*uStatus = TNETWIF_Open(pTWD->hTNETWIF, pParams);*/
+    uStatus = TI_OK;
+
+	return uStatus;	
+}
+
+TI_STATUS TWD_BusClose (TI_HANDLE hTWD)
+{
+	TTwd *pTWD = (TTwd *)hTWD;
+	TI_STATUS uStatus;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_BusClose: called\n");
+
+	/*uStatus = TNETWIF_Close(pTWD->hTNETWIF);*/
+    uStatus = TI_OK;
+
+	return uStatus;	
+}
+
+TI_STATUS TWD_InitFw (TI_HANDLE hTWD, TFileInfo *pFileInfo)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+    TI_STATUS status;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_InitFw: called\n");
+
+    /* check Parameters */
+    if (( pTWD == NULL ) || ( pFileInfo == NULL ))
+    {
+        return (TI_NOK);
+    }
+
+    hwInit_SetFwImage (pTWD->hHwInit, pFileInfo);
+    
+    /* This will initiate the download to the FW */
+    status = hwInit_LoadFw(pTWD->hHwInit);
+
+    if (status == TXN_STATUS_ERROR)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR , "TWD_InitFw: failed to initialize FW\n");
+
+        return TI_NOK;
+    }
+
+    return TI_OK;
+}
+
+/**
+ * \brief  Propagate interrogate results
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  status       - callback status
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Static CB function
+ * Propagate interrogate results between TX and RX modules
+ * Called by TWD_ConfigFw
+ * 
+ * \sa
+ */ 
+static TI_STATUS TWD_ConfigFwCb (TI_HANDLE hTWD, TI_STATUS status)
+{
+    TTwd        *pTWD = (TTwd *)hTWD;
+    TDmaParams  *pDmaParams = &DB_DMA(pTWD->hCmdBld);
+
+    /* 
+     * Store the addresses of the cyclic buffer (Rx/Tx) 
+     * and the path status and control (Tx/Rx) in the corresponding modules
+     */
+    txResult_setHwInfo (pTWD->hTxResult, pDmaParams);
+
+    RxXfer_ReStart (pTWD->hRxXfer);
+    txXfer_Restart (pTWD->hTxXfer);
+
+    rxXfer_SetRxDirectAccessParams (pTWD->hRxXfer, pDmaParams);
+
+    /* Provide number of HW Tx-blocks and descriptors to Tx-HW-Queue module */
+    txHwQueue_SetHwInfo (pTWD->hTxHwQueue, pDmaParams);
+
+    /* If the configure complete function was registered, we call it here - end of TWD_Configure stage */
+    if (pTWD->fConfigFwCb) 
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ConfigFwCb: call TWD_OWNER_SELF_CONFIG CB. In std drvMain_ConfigFwCb()\n");
+
+        pTWD->fConfigFwCb (pTWD->hUser, TI_OK);
+    }   
+
+    return TI_OK;
+}
+
+
+TI_STATUS TWD_SetDefaults (TI_HANDLE hTWD, TTwdInitParams *pInitParams)
+{
+    TTwd         *pTWD = (TTwd *)hTWD;
+
+    TWlanParams         *pWlanParams = &DB_WLAN(pTWD->hCmdBld);
+    TKeepAliveList      *pKlvParams = &DB_KLV(pTWD->hCmdBld);
+    IniFileRadioParam   *pRadioParams = &DB_RADIO(pTWD->hCmdBld);
+    IniFileGeneralParam *pGenParams = &DB_GEN(pTWD->hCmdBld);
+    TRateMngParams      *pRateMngParams = &DB_RM(pTWD->hCmdBld);
+    TSmartReflexParams  *pSmartReflex = &DB_SR(pTWD->hCmdBld); 
+    TI_UINT32            k, uIndex;
+    int iParam;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_SetDefaults: called\n");
+
+    pTWD->bRecoveryEnabled = pInitParams->tGeneral.halCtrlRecoveryEnable;
+
+    pWlanParams->PacketDetectionThreshold   = pInitParams->tGeneral.packetDetectionThreshold;
+    pWlanParams->qosNullDataTemplateSize    = pInitParams->tGeneral.qosNullDataTemplateSize;
+    pWlanParams->PsPollTemplateSize         = pInitParams->tGeneral.PsPollTemplateSize;
+    pWlanParams->probeResponseTemplateSize  = pInitParams->tGeneral.probeResponseTemplateSize;
+    pWlanParams->probeRequestTemplateSize   = pInitParams->tGeneral.probeRequestTemplateSize;
+    pWlanParams->beaconTemplateSize         = pInitParams->tGeneral.beaconTemplateSize;
+    pWlanParams->nullTemplateSize           = pInitParams->tGeneral.nullTemplateSize;
+    pWlanParams->disconnTemplateSize        = pInitParams->tGeneral.disconnTemplateSize;
+    /* Beacon broadcast options */
+    pWlanParams->BcnBrcOptions.BeaconRxTimeout      = pInitParams->tGeneral.BeaconRxTimeout;
+    pWlanParams->BcnBrcOptions.BroadcastRxTimeout   = pInitParams->tGeneral.BroadcastRxTimeout;
+    pWlanParams->BcnBrcOptions.RxBroadcastInPs      = pInitParams->tGeneral.RxBroadcastInPs;
+    pWlanParams->ConsecutivePsPollDeliveryFailureThreshold = pInitParams->tGeneral.ConsecutivePsPollDeliveryFailureThreshold;
+    
+    pWlanParams->RxDisableBroadcast         = pInitParams->tGeneral.halCtrlRxDisableBroadcast;
+    pWlanParams->calibrationChannel2_4      = pInitParams->tGeneral.halCtrlCalibrationChannel2_4;
+    pWlanParams->calibrationChannel5_0      = pInitParams->tGeneral.halCtrlCalibrationChannel5_0;
+    
+    /* Not used but need by Palau */
+    pWlanParams->RtsThreshold               = pInitParams->tGeneral.halCtrlRtsThreshold;
+    pWlanParams->CtsToSelf                  = CTS_TO_SELF_DISABLE; 
+    
+    pWlanParams->WiFiWmmPS                  = pInitParams->tGeneral.WiFiWmmPS;
+    
+    pWlanParams->MaxTxMsduLifetime          = pInitParams->tGeneral.halCtrlMaxTxMsduLifetime;  
+    pWlanParams->MaxRxMsduLifetime          = pInitParams->tGeneral.halCtrlMaxRxMsduLifetime;  
+    
+    pWlanParams->rxTimeOut.psPoll           = pInitParams->tGeneral.rxTimeOut.psPoll;  
+    pWlanParams->rxTimeOut.UPSD             = pInitParams->tGeneral.rxTimeOut.UPSD;  
+    
+    /* RSSI/SNR Weights for Average calculations */
+    pWlanParams->tRssiSnrWeights.rssiBeaconAverageWeight = pInitParams->tGeneral.uRssiBeaconAverageWeight;
+    pWlanParams->tRssiSnrWeights.rssiPacketAverageWeight = pInitParams->tGeneral.uRssiPacketAverageWeight;
+    pWlanParams->tRssiSnrWeights.snrBeaconAverageWeight  = pInitParams->tGeneral.uSnrBeaconAverageWeight ;
+    pWlanParams->tRssiSnrWeights.snrPacketAverageWeight  = pInitParams->tGeneral.uSnrPacketAverageWeight ;
+    
+    /* PM config params */
+    pWlanParams->uHostClkSettlingTime       = pInitParams->tGeneral.uHostClkSettlingTime;
+    pWlanParams->uHostFastWakeupSupport     = pInitParams->tGeneral.uHostFastWakeupSupport;
+    
+    /* No used */
+    pWlanParams->FragmentThreshold          = pInitParams->tGeneral.halCtrlFragThreshold;
+    pWlanParams->ListenInterval             = (TI_UINT8)pInitParams->tGeneral.halCtrlListenInterval;
+    pWlanParams->RateFallback               = pInitParams->tGeneral.halCtrlRateFallbackRetry;        
+    pWlanParams->MacClock                   = pInitParams->tGeneral.halCtrlMacClock;     
+    pWlanParams->ArmClock                   = pInitParams->tGeneral.halCtrlArmClock;     
+
+    /* Data interrupts pacing */
+    pWlanParams->TxCompletePacingThreshold  = pInitParams->tGeneral.TxCompletePacingThreshold; 
+    pWlanParams->TxCompletePacingTimeout    = pInitParams->tGeneral.TxCompletePacingTimeout;  
+    pWlanParams->RxIntrPacingThreshold      = pInitParams->tGeneral.RxIntrPacingThreshold;     
+    pWlanParams->RxIntrPacingTimeout        = pInitParams->tGeneral.RxIntrPacingTimeout;      
+    
+    /* Configure ARP IP */
+    
+    pWlanParams->isArpIpFilteringEnabled    = pInitParams->tArpIpFilter.isFilterEnabled;
+    IP_COPY (pWlanParams->arp_IP_addr, pInitParams->tArpIpFilter.addr);
+    
+    /* Configure address group */
+    pWlanParams->numGroupAddrs = pInitParams->tMacAddrFilter.numOfMacAddresses;
+    pWlanParams->isMacAddrFilteringnabled = pInitParams->tMacAddrFilter.isFilterEnabled;
+    
+    for (k = 0; k < pWlanParams->numGroupAddrs; k++)
+    {
+        MAC_COPY (pWlanParams->aGroupAddr[k], pInitParams->tMacAddrFilter.macAddrTable[k]); 
+    }
+
+  
+    /* CoexActivity Table */
+    TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetDefaults: coex numOfElements %d\n", pInitParams->tGeneral.halCoexActivityTable.numOfElements);
+
+    pWlanParams->tWlanParamsCoexActivityTable.numOfElements = 0;
+    for (iParam=0; iParam < (int)pInitParams->tGeneral.halCoexActivityTable.numOfElements; iParam++)
+    {
+        TCoexActivity *pSaveCoex = &pWlanParams->tWlanParamsCoexActivityTable.entry[0];
+        TCoexActivity *pParmCoex = &pInitParams->tGeneral.halCoexActivityTable.entry[0];
+        int i, saveIndex;
+
+        /* Check if to overwrite existing entry or put on last index */
+        for (i=0; i<iParam; i++)
+        {
+            if ((pSaveCoex[i].activityId == pParmCoex[iParam].activityId) && (pSaveCoex[i].coexIp == pParmCoex[iParam].coexIp))
+            {
+                break;
+            }
+        }
+
+        if (i == iParam)
+        {
+            /* new entry */
+            saveIndex = pWlanParams->tWlanParamsCoexActivityTable.numOfElements;
+            pWlanParams->tWlanParamsCoexActivityTable.numOfElements++; 
+        }
+        else
+        {
+            /* overwrite existing */
+            saveIndex = i;
+        }
+
+        TRACE4(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetDefaults: save coex Param %d in index %d, %d %d\n", iParam, saveIndex, pParmCoex[iParam].coexIp, pParmCoex[iParam].activityId);
+
+        pSaveCoex[saveIndex].coexIp          = pParmCoex[iParam].coexIp;
+        pSaveCoex[saveIndex].activityId      = pParmCoex[iParam].activityId;
+        pSaveCoex[saveIndex].defaultPriority = pParmCoex[iParam].defaultPriority;
+        pSaveCoex[saveIndex].raisedPriority  = pParmCoex[iParam].raisedPriority;
+        pSaveCoex[saveIndex].minService      = pParmCoex[iParam].minService;
+        pSaveCoex[saveIndex].maxService      = pParmCoex[iParam].maxService;
+    }
+
+    /* configure keep-alive default mode to enabled */
+    pKlvParams->enaDisFlag = TI_TRUE;
+    for (uIndex = 0; uIndex < KLV_MAX_TMPL_NUM; uIndex++)
+    {
+        pKlvParams->keepAliveParams[ uIndex ].enaDisFlag = TI_FALSE;
+    }
+
+    /* Configure the Tx-HW-Queue module */
+    txHwQueue_Config (pTWD->hTxHwQueue, pInitParams);
+    
+    /* Configure the MAC services */ 
+    MacServices_config (pTWD->hMacServices, pInitParams);   
+
+    /* 
+     * 802.11n
+     */
+    pWlanParams->tTwdHtCapabilities.b11nEnable =            pInitParams->tGeneral.b11nEnable;
+    /* Configure HT capabilities setting */
+    pWlanParams->tTwdHtCapabilities.uChannelWidth =         CHANNEL_WIDTH_20MHZ;                  
+    pWlanParams->tTwdHtCapabilities.uRxSTBC =               RXSTBC_SUPPORTED_ONE_SPATIAL_STREAM;
+    pWlanParams->tTwdHtCapabilities.uMaxAMSDU =             MAX_MSDU_3839_OCTETS;                         
+    pWlanParams->tTwdHtCapabilities.uMaxAMPDU =             MAX_MPDU_8191_OCTETS;
+    pWlanParams->tTwdHtCapabilities.uAMPDUSpacing =         AMPDU_SPC_16_MICROSECONDS;
+    pWlanParams->tTwdHtCapabilities.aRxMCS[0] =             (MCS_SUPPORT_MCS_0 |
+                                                             MCS_SUPPORT_MCS_1 |
+                                                             MCS_SUPPORT_MCS_2 |
+                                                             MCS_SUPPORT_MCS_3 |
+                                                             MCS_SUPPORT_MCS_4 |
+                                                             MCS_SUPPORT_MCS_5 |
+                                                             MCS_SUPPORT_MCS_6 |
+                                                             MCS_SUPPORT_MCS_7);
+    os_memoryZero (pTWD->hOs, pWlanParams->tTwdHtCapabilities.aRxMCS + 1, RX_TX_MCS_BITMASK_SIZE - 1);
+    pWlanParams->tTwdHtCapabilities.aTxMCS[0]  =             (MCS_SUPPORT_MCS_0 |
+                                                              MCS_SUPPORT_MCS_1 |
+                                                              MCS_SUPPORT_MCS_2 |
+                                                              MCS_SUPPORT_MCS_3 |
+                                                              MCS_SUPPORT_MCS_4 |
+                                                              MCS_SUPPORT_MCS_5 |
+                                                              MCS_SUPPORT_MCS_6 |
+                                                              MCS_SUPPORT_MCS_7);
+    os_memoryZero (pTWD->hOs, pWlanParams->tTwdHtCapabilities.aTxMCS + 1, RX_TX_MCS_BITMASK_SIZE - 1);
+    pWlanParams->tTwdHtCapabilities.uRxMaxDataRate =         MCS_HIGHEST_SUPPORTED_RECEPTION_DATA_RATE_IN_MBIT_S;          
+    pWlanParams->tTwdHtCapabilities.uPCOTransTime =          PCO_TRANS_TIME_NO_TRANSITION;
+    pWlanParams->tTwdHtCapabilities.uHTCapabilitiesBitMask = (CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT |
+                                                              CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS);
+    pWlanParams->tTwdHtCapabilities.uMCSFeedback =           MCS_FEEDBACK_NO; 
+
+    os_memoryCopy(pTWD->hOs, (void*)pRadioParams, (void*)&pInitParams->tIniFileRadioParams, sizeof(IniFileRadioParam));
+    os_memoryCopy(pTWD->hOs, (void*)pGenParams, (void*)&pInitParams->tPlatformGenParams, sizeof(IniFileGeneralParam));
+    
+    os_memoryCopy (pTWD->hOs,
+                   (void*)&(pWlanParams->tFmCoexParams),
+                   (void*)&(pInitParams->tGeneral.tFmCoexParams),
+                   sizeof(TFmCoexParams));
+
+    /* Rate management params */
+    pRateMngParams->rateMngParams.InverseCuriosityFactor[0] = pInitParams->tRateMngParams.InverseCuriosityFactor[0];
+    pRateMngParams->rateMngParams.InverseCuriosityFactor[1] = pInitParams->tRateMngParams.InverseCuriosityFactor[1];
+    pRateMngParams->rateMngParams.MaxPer = pInitParams->tRateMngParams.MaxPer;
+    pRateMngParams->rateMngParams.PerAdd = pInitParams->tRateMngParams.PerAdd;
+    pRateMngParams->rateMngParams.PerAddShift = pInitParams->tRateMngParams.PerAddShift;
+    pRateMngParams->rateMngParams.PerAlphaShift = pInitParams->tRateMngParams.PerAlphaShift;
+    pRateMngParams->rateMngParams.PerBeta1Shift = pInitParams->tRateMngParams.PerBeta1Shift;
+    pRateMngParams->rateMngParams.PerBeta2Shift = pInitParams->tRateMngParams.PerBeta2Shift;
+    pRateMngParams->rateMngParams.PerTh1 = pInitParams->tRateMngParams.PerTh1;
+    pRateMngParams->rateMngParams.PerTh2 = pInitParams->tRateMngParams.PerTh2;
+    pRateMngParams->rateMngParams.RateCheckDown = pInitParams->tRateMngParams.RateCheckDown;
+    pRateMngParams->rateMngParams.RateCheckUp = pInitParams->tRateMngParams.RateCheckUp;
+    /* RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN */
+    for (uIndex = 0; uIndex < 13; uIndex++)
+    {
+        pRateMngParams->rateMngParams.RateRetryPolicy[uIndex] = pInitParams->tRateMngParams.RateRetryPolicy[uIndex];
+    }
+    pRateMngParams->rateMngParams.RateRetryScore = pInitParams->tRateMngParams.RateRetryScore;
+    pRateMngParams->rateMngParams.TxFailHighTh = pInitParams->tRateMngParams.TxFailHighTh;
+    pRateMngParams->rateMngParams.TxFailLowTh = pInitParams->tRateMngParams.TxFailLowTh;
+    pRateMngParams->rateMngParams.PerWeightShift[0] = pInitParams->tRateMngParams.PerWeightShift[0];
+    pRateMngParams->rateMngParams.PerWeightShift[1] = pInitParams->tRateMngParams.PerWeightShift[1];
+    pRateMngParams->rateMngParams.TpWeightShift[0] = pInitParams->tRateMngParams.TpWeightShift[0];
+    pRateMngParams->rateMngParams.TpWeightShift[1] = pInitParams->tRateMngParams.TpWeightShift[1];    
+
+    /* DCO Itrim params */
+    pWlanParams->dcoItrimEnabled = pInitParams->tDcoItrimParams.enable;
+    pWlanParams->dcoItrimModerationTimeoutUsec = pInitParams->tDcoItrimParams.moderationTimeoutUsec;
+
+    /* 
+     * Updating uSwallowPeriod depending on Fref:
+     * if Fref 26, 52 then uSwallowPeriod = 5
+     * Else use default.
+     */
+    if (((pGenParams->RefClk & FREF_CLK_FREQ_MASK) == 1) || ((pGenParams->RefClk & FREF_CLK_FREQ_MASK) == 3))
+    {
+        pWlanParams->tFmCoexParams.uSwallowPeriod = 5;
+    }
+    
+    pSmartReflex->tSmartReflexState = pInitParams->tSmartReflexState;
+    os_memoryCopy(pTWD->hOs, (void*)&pSmartReflex->tSmartReflexParams, (void*)&pInitParams->tSmartReflexParams, sizeof(ACXSmartReflexConfigParams_t));
+    os_memoryCopy(pTWD->hOs, (void*)&pSmartReflex->tSmartReflexDebugParams, (void*)&pInitParams->tSmartReflexDebugParams, sizeof(ACXSmartReflexDebugParams_t));
+        
+    return TI_OK;
+}
+
+
+TI_STATUS TWD_ConfigFw (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_ConfigFw: called\n");
+
+    /*
+     * Configure the WLAN firmware after config all the hardware objects
+     */
+    if (cmdBld_ConfigFw (pTWD->hCmdBld, (void *)TWD_ConfigFwCb, hTWD) != TI_OK)
+    {
+        return TI_NOK;
+    }
+
+    return TI_OK;
+}
+
+void TWD_FinalizeDownload (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_FinalizeDownload: called\n");
+
+	if ( pTWD == NULL )
+	{
+		return;
+	}
+    /* Here at the end call the Initialize Complete callback that will release the user Init semaphore */
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT, "Before sending the Init Complet callback !!!!!\n");
+
+    /* Sign that init has succeeded */
+    pTWD->bInitSuccess = TI_TRUE;    
+
+    /* Call user application configuration callback */
+    if (pTWD->fInitFwCb)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_FinalizeDownload: call fInitFwCb CB. In std drvMain_InitFwCb()\n");
+
+        (*pTWD->fInitFwCb) (pTWD->hUser, TI_OK);
+    }
+}
+
+void TWD_FinalizeOnFailure (TI_HANDLE hTWD)
+{
+    TTwd  *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_FinalizeOnFailure: called\n");
+
+	/* Call the upper layer callback for init failure case */
+    if (pTWD->fInitFailCb) 
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_FinalizeOnFailure: call fInitFailCb CB. In std drvMain_InitFailCb()\n");
+
+        pTWD->fInitFailCb (pTWD->hUser, TI_OK);
+    }   
+}
+
+TI_STATUS TWD_CheckMailboxCb (TI_HANDLE hTWD, TI_UINT16 uMboxStatus, void *pItrParamBuf)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CheckMailboxCb: called\n");
+
+    if (uMboxStatus != TI_OK)
+    {
+        ++pTWD->uNumMboxFailures;
+        TRACE1(pTWD->hReport, REPORT_SEVERITY_WARNING, "TWD_CheckMailboxCb: Periodic intorregate check - Command mailbox failure was occur \n errors failure # %d", pTWD->uNumMboxFailures);
+
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CheckMailboxCb: call TWD_INT_EVENT_FAILURE CB. In std healthMonitor_sendFailureEvent()\n");
+
+        /* Indicating Upper Layer about Mbox Error */
+        pTWD->fFailureEventCb (pTWD->hFailureEventCb, MBOX_FAILURE);
+    }
+
+    return TI_OK;
+}
+#ifdef RS_OVER_TWD
+extern	void (*gBusTxn_ErrorCb)(TI_HANDLE , int);
+extern  void *gBusTxn_ErrorHndle;
+#endif
+
+/**
+ * \brief Registers TWD Module Callbacks
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  uCallBackID  - Registered Callback ID
+ * \param  fCb 	        - Pointer to Input Registered CB function
+ * \param  hCb 	        - Handle to Input Registered CB parameters
+ * \return void 
+ * 
+ * \par Description
+ * Static CB function
+ * This CB Registers TWD CB functions for future use:
+ * CB which handles failure to the CMD Queue, MAC Service and TwIf
+ * CB which handles Command Complete for the CMD Queue
+ * Called by TWD_RegisterCb
+ * 
+ * \sa TWD_RegisterCb
+ */ 
+static void TWD_RegisterOwnCb (TI_HANDLE hTWD, TI_UINT32 uCallBackID, void *fCb, TI_HANDLE hCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_RegisterOwnCB: callback ID=0x%x\n", uCallBackID);
+
+    switch (uCallBackID)
+    {
+    case TWD_INT_EVENT_FAILURE:
+        /* Save Health-Moitor callback */
+        pTWD->fFailureEventCb = (TFailureEventCb)fCb;
+        pTWD->hFailureEventCb = hCb;
+
+        /* Register For Error Of Mailbox in case of timeout */
+        cmdQueue_RegisterForErrorCb (pTWD->hCmdQueue, (void *)TWD_CheckMailboxCb, hTWD);
+
+        /* Forward the Health-Moitor callback to the MAC-Services modules */
+        MacServices_registerFailureEventCB(pTWD->hMacServices, fCb, hCb);
+
+        /* Forward the Health-Moitor callback to the TwIf for bus errors */
+        twIf_RegisterErrCb (pTWD->hTwIf, fCb, hCb);
+        break;
+
+    case TWD_INT_COMMAND_COMPLETE:
+        cmdQueue_RegisterCmdCompleteGenericCb (pTWD->hCmdQueue, fCb, hCb);
+        break;
+
+    default:
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_RegisterOwnCb - Illegal value\n");
+    }
+}
+
+TI_STATUS TWD_RegisterCb (TI_HANDLE hTWD, TI_UINT32 event, TTwdCB *fCb, void *pData)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+    TI_UINT32 uModuleId    = event & TWD_CB_MODULE_OWNER_MASK;
+    TI_UINT32 uCallbackId  = event & TWD_CB_TYPE_MASK;
+
+	if ((fCb == NULL) || (pData == NULL))
+	{
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_Register_CB: Invalid NULL Parameter\n");
+	}
+
+    TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_Register_CB: (Value = 0x%x)\n", event);
+
+   /* First detect which module is the owner */
+
+    switch (uModuleId)
+    {
+    case TWD_OWNER_TX_HW_QUEUE:
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_Register_CB: TWD_OWNER_TX_HW_QUEUE\n");
+        txHwQueue_RegisterCb (pTWD->hTxHwQueue, uCallbackId, fCb, pData);
+        break;
+
+    case TWD_OWNER_DRIVER_TX_XFER:
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_Register_CB: TWD_OWNER_DRIVER_TX_XFER\n");
+        txXfer_RegisterCb (pTWD->hTxXfer, uCallbackId, fCb, pData);
+        break;
+
+    case TWD_OWNER_TX_RESULT:
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_Register_CB: TWD_OWNER_TX_RESULT\n");
+        txResult_RegisterCb (pTWD->hTxResult, uCallbackId, fCb, pData);
+        break;
+
+    case TWD_OWNER_RX_XFER:
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_Register_CB: TWD_OWNER_RX_XFER\n");
+        rxXfer_Register_CB(pTWD->hRxXfer, uCallbackId, fCb, pData);
+        break;
+
+    case TWD_OWNER_RX_QUEUE:
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_Register_CB: TWD_OWNER_RX_QUEUE\n");
+        RxQueue_Register_CB(pTWD->hRxQueue, uCallbackId, fCb, pData);
+        break;
+
+    case TWD_OWNER_SELF:
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_Register_CB: TWD_OWNER_SELF\n");
+        TWD_RegisterOwnCb (hTWD, uCallbackId, fCb, pData);
+        break;
+ 
+    case TWD_OWNER_MAC_SERVICES:
+        switch (uCallbackId)
+        {
+        case TWD_OWN_EVENT_SCAN_CMPLT:
+            MacServices_scanSRV_registerScanCompleteCB (pTWD->hMacServices, (TScanSrvCompleteCb)fCb, pData);
+            break;
+        default:
+            TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_Register_CB: TWD_OWNER_MAC_SERVICES - Illegal value\n");
+        }
+        break;
+
+    case TWD_OWNER_SELF_CONFIG:    
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_Register_CB: TWD_OWNER_SELF_CONFIG\n");
+        pTWD->fConfigFwCb  = (TTwdCallback)fCb;
+        break;
+
+    default:
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_Register_CB - Illegal value\n");
+    }
+
+    return TI_OK;
+}
+
+TI_STATUS TWD_ExitFromInitMode (TI_HANDLE hTWD)
+{
+    TTwd    *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ExitFromInitMode: called\n");
+
+    /* Notify Event MailBox about init complete */
+    eventMbox_InitComplete (pTWD->hEventMbox);
+
+    /* Enable Mailbox */
+    cmdQueue_EnableMbox (pTWD->hCmdQueue);
+
+    return TI_OK; 
+}
+
+
+#ifdef TI_DBG
+TI_STATUS TWD_PrintTxInfo (TI_HANDLE hTWD, ETwdPrintInfoType ePrintInfo)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_PrintTxInfo: called\n");
+
+    switch (ePrintInfo) 
+    {
+        case TWD_PRINT_TX_CTRL_BLK_TBL:
+            txCtrlBlk_PrintTable (pTWD->hTxCtrlBlk);
+            break;
+
+        case TWD_PRINT_TX_HW_QUEUE_INFO:
+            txHwQueue_PrintInfo (pTWD->hTxHwQueue);
+            break;
+
+    case TWD_PRINT_TX_XFER_INFO:
+            TRACE0(pTWD->hReport, REPORT_SEVERITY_CONSOLE,"No TxXfer information to show\n");
+            WLAN_OS_REPORT(("No TxXfer information to show\n"));
+            break;
+
+        case TWD_PRINT_TX_RESULT_INFO:
+            txResult_PrintInfo (pTWD->hTxResult);
+            break;
+
+        case TWD_CLEAR_TX_RESULT_INFO:
+            txResult_ClearInfo (pTWD->hTxResult);
+            break;
+
+        default:
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_ERROR, ": invalid print info request code: %d\n", ePrintInfo);
+    }
+
+    return TI_OK;
+}
+
+#endif /* TI_DBG */
+
+TI_STATUS TWD_InterruptRequest (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_InterruptRequest: called\n");
+
+    fwEvent_InterruptRequest (pTWD->hFwEvent);
+
+    return TI_OK;
+}
+ 
+TI_STATUS TWD_RegisterEvent (TI_HANDLE hTWD, TI_UINT32 event, void *fCb, TI_HANDLE hCb)
+{
+    TTwd  *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_RegisterEvent: called\n");
+
+    return eventMbox_RegisterEvent (pTWD->hEventMbox, event, fCb, hCb);
+}
+
+TI_STATUS TWD_DisableEvent (TI_HANDLE hTWD, TI_UINT32 event)
+{
+    TTwd  *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_DisableEvent: called\n");
+
+    return eventMbox_MaskEvent (pTWD->hEventMbox, event, NULL, NULL);
+}
+
+TI_STATUS TWD_EnableEvent (TI_HANDLE hTWD, TI_UINT32 event)
+{
+    TTwd  *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_EnableEvent: called\n");
+
+    return eventMbox_UnMaskEvent (pTWD->hEventMbox, event, NULL, NULL);
+}
+
+void TWD_StopComplete (TI_HANDLE hTWD)
+{
+    TTwd  *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_StopComplete: called\n");
+
+
+    /* reinit last ELP mode flag in recovery */
+    cmdBld_Restart(pTWD->hCmdBld); 
+
+    /* Call upper layer callback */
+    if (pTWD->fStopCb) 
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_StopComplete: call fStopCb CB. In std drvMain_TwdStopCb()\n");
+
+        (*pTWD->fStopCb) (pTWD->hUser, TI_OK);
+    }
+}
+
+TI_STATUS TWD_Stop (TI_HANDLE hTWD)
+{
+    TTwd        *pTWD = (TTwd *)hTWD;
+    ETxnStatus   status;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_Stop: called\n");
+
+    fwEvent_Stop (pTWD->hFwEvent);
+
+   
+    /* close all BA sessions */
+    TWD_CloseAllBaSessions(hTWD);
+
+    cmdMbox_Restart (pTWD->hCmdMbox);
+    cmdQueue_Restart (pTWD->hCmdQueue);    
+    cmdQueue_DisableMbox (pTWD->hCmdQueue);
+    eventMbox_Stop (pTWD->hEventMbox);
+    MacServices_restart (pTWD->hMacServices); 
+
+    status = twIf_Restart(pTWD->hTwIf);
+    
+    /* Call user stop callback */
+    if (status != TXN_STATUS_PENDING) 
+    {
+        TWD_StopComplete (hTWD);
+    }
+  
+    return TI_OK;
+}
+
+void TWD_EnableExternalEvents (TI_HANDLE hTWD)
+{
+    TTwd        *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_EnableExternalEvents: called\n");
+
+    /* 
+     * Enable sleep after all firmware initializations completed 
+     * The awake was in the TWD_initHw phase
+     */
+    twIf_Sleep (pTWD->hTwIf);
+
+    fwEvent_EnableExternalEvents (pTWD->hFwEvent);
+}
+
+TI_BOOL TWD_RecoveryEnabled (TI_HANDLE hTWD)
+{
+    TTwd  *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_RecoveryEnabled: called\n");
+
+    return pTWD->bRecoveryEnabled;
+}
+
+TI_UINT32 TWD_GetMaxNumberOfCommandsInQueue (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetMaxNumberOfCommandsInQueue: called\n");
+
+    return cmdQueue_GetMaxNumberOfCommands (pTWD->hCmdQueue);
+}
+
+TI_STATUS TWD_SetPsMode (TI_HANDLE                   hTWD,
+						 E80211PsMode ePsMode, 
+						 TI_BOOL bSendNullDataOnExit, 
+                         TI_HANDLE                   hPowerSaveCompleteCb,
+                         TPowerSaveCompleteCb        fPowerSaveCompleteCb,
+                         TPowerSaveResponseCb        fPowerSaveResponseCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetPsMode: called\n");
+
+    return MacServices_powerSrv_SetPsMode (pTWD->hMacServices,
+                                           ePsMode,
+                                           bSendNullDataOnExit,
+                                           hPowerSaveCompleteCb,
+                                           fPowerSaveCompleteCb,
+                                           fPowerSaveResponseCb);
+}
+
+TI_BOOL TWD_GetPsStatus (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetPsStatus: called\n");
+
+    return MacServices_powerSrv_getPsStatus (pTWD->hMacServices);
+}
+
+TI_STATUS TWD_SetNullRateModulation (TI_HANDLE hTWD, TI_UINT16 rate)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetRateModulation: called\n");
+
+    MacServices_powerSrv_SetRateModulation (pTWD->hMacServices, rate); 
+
+    return TI_OK;
+}
+
+void TWD_UpdateDtimTbtt (TI_HANDLE hTWD, TI_UINT8 uDtimPeriod, TI_UINT16 uBeaconInterval)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_UpdateDtimTbtt: called\n");
+
+    MacServices_scanSrv_UpdateDtimTbtt (pTWD->hMacServices, uDtimPeriod, uBeaconInterval); 
+}
+
+TI_STATUS TWD_StartMeasurement (TI_HANDLE                   hTWD, 
+                                TMeasurementRequest        *pMsrRequest,
+                                TI_UINT32                   uTimeToRequestExpiryMs,
+                                TCmdResponseCb              fResponseCb,
+                                TI_HANDLE                   hResponseCb,
+                                TMeasurementSrvCompleteCb   fCompleteCb,
+                                TI_HANDLE                   hCompleteCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_StartMeasurement: called\n");
+
+    return MacServices_measurementSRV_startMeasurement (pTWD->hMacServices, 
+                                                        pMsrRequest,
+                                                        uTimeToRequestExpiryMs,
+                                                        fResponseCb,
+                                                        hResponseCb,
+                                                        fCompleteCb,
+                                                        hCompleteCb);
+}
+
+TI_STATUS TWD_StopMeasurement (TI_HANDLE       	hTWD,
+                               TI_BOOL        	bSendNullData,
+                               TCmdResponseCb  	fResponseCb,
+                               TI_HANDLE       	hResponseCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_StopMeasurement: called\n");
+
+    return MacServices_measurementSRV_stopMeasurement (pTWD->hMacServices,
+                                                       bSendNullData,
+                                                       fResponseCb,
+                                                       hResponseCb);
+}
+
+TI_STATUS TWD_RegisterScanCompleteCb (TI_HANDLE            hTWD, 
+                                      TScanSrvCompleteCb   fScanCompleteCb, 
+                                      TI_HANDLE            hScanCompleteCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_RegisterScanCompleteCb: called\n");
+
+    MacServices_scanSRV_registerScanCompleteCB (pTWD->hMacServices, 
+                                                fScanCompleteCb, 
+                                                hScanCompleteCb);
+
+    return TI_OK;
+}
+
+#ifdef TI_DBG
+TI_STATUS TWD_PrintMacServDebugStatus (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_PrintMacServDebugStatus: called\n");
+
+    MacServices_scanSrv_printDebugStatus (pTWD->hMacServices);
+
+    return TI_OK;
+}
+#endif
+
+TI_STATUS TWD_Scan (TI_HANDLE       hTWD, 
+                    TScanParams    	*pScanParams,
+                    EScanResultTag 	eScanTag, 
+                    TI_BOOL        	bHighPriority,
+                    TI_BOOL        	bDriverMode, 
+                    TI_BOOL        	bScanOnDriverModeError, 
+                    E80211PsMode   	ePsRequest, 
+                    TI_BOOL        	bSendNullData,
+                    TCmdResponseCb 	fResponseCb, 
+                    TI_HANDLE      	hResponseCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_Scan: called\n");
+
+    return MacServices_scanSRV_scan (pTWD->hMacServices,
+                                     pScanParams,
+                                     eScanTag,
+                                     bHighPriority,
+                                     bDriverMode, 
+                                     bScanOnDriverModeError, 
+                                     ePsRequest, 
+                                     bSendNullData,
+                                     fResponseCb, 
+                                     hResponseCb);
+}
+
+TI_STATUS TWD_StopScan (TI_HANDLE       hTWD, 
+                        EScanResultTag  eScanTag,
+                        TI_BOOL         bSendNullData, 
+                        TCmdResponseCb  fScanCommandResponseCb, 
+                        TI_HANDLE       hCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_StopScan: called\n");
+
+    return MacServices_scanSRV_stopScan (pTWD->hMacServices,
+                                         eScanTag,
+                                         bSendNullData, 
+                                         fScanCommandResponseCb, 
+                                         hCb);
+}
+
+TI_STATUS TWD_StopScanOnFWReset (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_StopScanOnFWReset: called\n");
+
+    return MacServices_scanSRV_stopOnFWReset (pTWD->hMacServices);
+}
+
+TI_STATUS TWD_StartConnectionScan (TI_HANDLE              hTWD,
+                                 TPeriodicScanParams    *pPeriodicScanParams,
+                                 EScanResultTag         eScanTag,
+                                 TI_UINT32              uPassiveScanDfsDwellTimeMs,
+                                 TCmdResponseCb         fResponseCb, 
+                                 TI_HANDLE              hResponseCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_StartConnectionScan: called\n");
+
+    return cmdBld_StartPeriodicScan (pTWD->hCmdBld, pPeriodicScanParams, eScanTag, uPassiveScanDfsDwellTimeMs, 
+                                     (void*)fResponseCb, hResponseCb);
+}
+
+TI_STATUS TWD_StopPeriodicScan  (TI_HANDLE              hTWD,
+                                 EScanResultTag         eScanTag,
+                                 TCmdResponseCb         fResponseCb, 
+                                 TI_HANDLE              hResponseCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_StopPeriodicScan: called\n");
+
+    return cmdBld_StopPeriodicScan (pTWD->hCmdBld, eScanTag, (void*)fResponseCb, hResponseCb);
+}
+
+TI_STATUS TWD_readMem (TI_HANDLE hTWD, TFwDebugParams* pMemDebug, void* fCb, TI_HANDLE hCb)
+{
+	TTwd * hReport = ((TTwd *)hTWD)->hReport;
+	TRACE0(hReport, REPORT_SEVERITY_INFORMATION , "TWD_readMem: called\n");
+
+    if ((hTWD == NULL) || 
+		(pMemDebug == NULL) )
+	{
+		return (TI_NOK);
+	}
+	if (fwDbg_ReadAddr(((TTwd *)hTWD)->hFwDbg,pMemDebug->addr,pMemDebug->length,pMemDebug->UBuf.buf8,(TFwDubCallback)fCb,hCb) == TI_NOK)
+	{
+        TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_CONSOLE ,"TWD_readMem Error: fwDbg_handleCommand failed\n");
+		WLAN_OS_REPORT(("TWD_readMem Error: fwDbg_handleCommand failed\n"));	
+		return TI_NOK;
+	}
+
+	return(TI_OK);
+}
+
+TI_STATUS TWD_writeMem (TI_HANDLE hTWD, TFwDebugParams* pMemDebug, void* fCb, TI_HANDLE hCb)
+{
+    TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_INFORMATION , "TWD_writeMem: called\n");
+
+    if ((hTWD == NULL) || 
+		(pMemDebug == NULL) )
+	{
+		return (TI_NOK);
+	}
+
+	if (fwDbg_WriteAddr(((TTwd *)hTWD)->hFwDbg,pMemDebug->addr,pMemDebug->length,pMemDebug->UBuf.buf8,(TFwDubCallback)fCb,hCb) == TI_NOK)
+	{
+        TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_CONSOLE ,"TWD_writeMem Error: fwDbg_handleCommand failed\n");
+		WLAN_OS_REPORT(("TWD_writeMem Error: fwDbg_handleCommand failed\n"));	
+		return TI_NOK;
+	}
+
+	return(TI_OK);
+}
+
+TI_BOOL TWD_isValidMemoryAddr (TI_HANDLE hTWD, TFwDebugParams* pMemDebug)
+{
+   TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_INFORMATION , "TWD_isValidMemoryAddr: called\n");
+
+    if ((hTWD == NULL) || 
+		(pMemDebug == NULL) )
+	{
+		return TI_FALSE;
+	}
+
+	return fwDbg_isValidMemoryAddr(((TTwd *)hTWD)->hFwDbg,pMemDebug->addr,pMemDebug->length);
+}
+
+TI_BOOL TWD_isValidRegAddr (TI_HANDLE hTWD, TFwDebugParams* pMemDebug)
+{
+   TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_INFORMATION , "TWD_isValidRegAddr: called\n");
+
+    if ((hTWD == NULL) || 
+		(pMemDebug == NULL) )
+	{
+		return TI_FALSE;
+	}
+
+	return fwDbg_isValidRegAddr(((TTwd *)hTWD)->hFwDbg,pMemDebug->addr,pMemDebug->length);
+}
+
+/**
+ * \brief Set Template Frame
+ * 
+ * \param hTWD 				- TWD module object handle
+ * \param pMib      		- Pointer to Input MIB Structure
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Static function
+ * Configure/Interrogate/Modulate the Frame Rate if needed (according to Templete Type) 
+ * and then write the MIB TemplateFrame to the FW
+ *
+ * \sa
+ */ 
+static TI_STATUS TWD_WriteMibTemplateFrame (TI_HANDLE hTWD, TMib* pMib)
+{
+    TTwd  *pTWD = (TTwd *)hTWD;
+    TSetTemplate  tSetTemplate;
+    EHwRateBitFiled uHWRate;
+    TI_UINT32  uDrvRateMask = RATE_TO_MASK(pMib->aData.TemplateFrame.Rate);
+    
+    cmdBld_ConvertAppRatesBitmap (uDrvRateMask, 0, &uHWRate);
+    
+    /* 
+     * Construct the template MIB element
+     */
+    switch(pMib->aData.TemplateFrame.FrameType)
+    {
+    case TEMPLATE_TYPE_BEACON:
+        tSetTemplate.type = BEACON_TEMPLATE;
+        break;
+        
+    case TEMPLATE_TYPE_PROBE_REQUEST:
+        tSetTemplate.type = PROBE_REQUEST_TEMPLATE;
+        tSetTemplate.eBand = RADIO_BAND_2_4_GHZ; /* needed for GWSI, if so band must also be passed to choose correct template (G or A) */
+        break;
+        
+    case TEMPLATE_TYPE_NULL_FRAME:
+        tSetTemplate.type = NULL_DATA_TEMPLATE;
+        MacServices_powerSrv_SetRateModulation (pTWD->hMacServices, (TI_UINT16)uDrvRateMask);
+        break;
+        
+    case TEMPLATE_TYPE_PROBE_RESPONSE:
+        tSetTemplate.type = PROBE_RESPONSE_TEMPLATE;
+        break;
+        
+    case TEMPLATE_TYPE_QOS_NULL_FRAME:
+		
+		if (IS_HT_FRAME(((dot11_header_t *)(pMib->aData.TemplateFrame.Data))->fc))
+		{
+			pMib->aData.TemplateFrame.Data[1] = pMib->aData.TemplateFrame.Data[1] & 0x7F;
+			pMib->aData.TemplateFrame.Length = pMib->aData.TemplateFrame.Length - HT_CONTROL_SIZE;
+		}
+        tSetTemplate.type = QOS_NULL_DATA_TEMPLATE;
+        break;
+        
+    case TEMPLATE_TYPE_PS_POLL:
+        tSetTemplate.type = PS_POLL_TEMPLATE;
+        break;
+        
+    default:
+        TRACE1(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_WriteMibTemplateFrame - ERROR - template is not supported, %d\n", pMib->aData.TemplateFrame.FrameType);
+        return PARAM_NOT_SUPPORTED;
+    }
+    
+    tSetTemplate.len = pMib->aData.TemplateFrame.Length;
+    tSetTemplate.ptr = (TI_UINT8 *) &(pMib->aData.TemplateFrame.Data);
+    tSetTemplate.uRateMask = uHWRate;
+   
+    return TWD_CmdTemplate (hTWD, &tSetTemplate, NULL, NULL);
+}
+
+/**
+ * \brief Set Beacon Filter IE Table
+ * 
+ * \param hTWD 				- TWD module object handle
+ * \param pMib      		- Pointer to Input MIB Structure
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Static function
+ * Configure the MIB Beacon Filter IE table
+ *
+ * \sa
+ */ 
+static TI_STATUS TWD_WriteMibBeaconFilterIETable (TI_HANDLE hTWD, TMib *pMib)
+{
+    TTwd  *pTWD = (TTwd *)hTWD;
+    TI_UINT8 numOf221IE = 0;
+    TI_UINT8 i = 0;
+    TI_UINT8 IETableLen = 0;
+    TI_UINT8 numOfIEs = 0;
+    TI_UINT8 *IETable = NULL;
+
+    numOfIEs = pMib->aData.BeaconFilter.iNumberOfIEs;
+    IETable = pMib->aData.BeaconFilter.iIETable;
+    /* Find the actual IETableLen */
+    for (i = 0; i < numOfIEs; i++)
+    {
+        if (IETable[IETableLen] == 0xdd)
+        {
+             IETableLen += 8;
+             numOf221IE++;
+        }
+        else
+        {
+            IETableLen += 2;
+        }
+    }
+    
+    TRACE4(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_WriteMibBeaconFilterIETable: IETable=0x%x Num Of IE=%d ( including %d 221 ) - Table Len=%d\n", IETable, numOfIEs, numOf221IE, IETableLen);
+    
+    return TWD_CfgBeaconFilterTable (hTWD, numOfIEs, IETable, IETableLen);
+}
+
+/**
+ * \brief Set Tx Rate Policy
+ * 
+ * \param hTWD 				- TWD module object handle
+ * \param pMib      		- Pointer to Input MIB Structure
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Static function
+ * Coordinates between legacy TxRatePolicy implementation and the MIB format:
+ * Converts the pGwsi_txRatePolicy back to command builder commands. 
+ * Activates the TWD_set function.
+ *
+ * \sa
+ */ 
+static TI_STATUS TWD_WriteMibTxRatePolicy (TI_HANDLE hTWD, TMib* pMib)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+#ifdef TI_DBG
+    if (NULL == pMib)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR, "ERROR: TWD_WriteMibTxRatePolicy pMib=NULL !!!");
+        return PARAM_VALUE_NOT_VALID;
+    }
+#endif /* TI_DBG */
+
+    return cmdBld_CfgTxRatePolicy (pTWD->hCmdBld, &pMib->aData.txRatePolicy, NULL, NULL);
+}
+
+TI_STATUS TWD_WriteMib (TI_HANDLE hTWD, TMib *pMib)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+   
+#ifdef TI_DBG
+    TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_WriteMib :pMib %p:\n",pMib);
+    
+    TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_WriteMib :aMib %x:\n",pMib->aMib);
+
+    TRACE_INFO_HEX(pTWD->hReport, (TI_UINT8*)pMib, TI_MIN (sizeof(TMib), pMib->Length));
+#endif /* TI_DBG */
+    
+    if (NULL == pMib)
+    {
+        TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_WriteMib :pMib = NULL !!\n");
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    switch (pMib->aMib)
+    {   
+    case MIB_dot11MaxReceiveLifetime:
+        return cmdBld_CfgRxMsduLifeTime (pTWD->hCmdBld, pMib->aData.MaxReceiveLifeTime * 1024, (void *)NULL, (void *)NULL);
+        
+    case MIB_ctsToSelf:
+        return cmdBld_CfgCtsProtection (pTWD->hCmdBld, (TI_UINT8)pMib->aData.CTSToSelfEnable, (void *)NULL, (TI_HANDLE)NULL);
+        
+    case MIB_dot11GroupAddressesTable: 
+        {
+            if (NULL == pMib->aData.GroupAddressTable.aGroupTable)
+            {
+                TRACE0(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_WriteMib(MIB_dot11GroupAddressesTable) :GroupTable = NULL !!\n");
+                return PARAM_VALUE_NOT_VALID;
+            }
+            
+            return TWD_CfgGroupAddressTable (hTWD, 
+                                             pMib->aData.GroupAddressTable.nNumberOfAddresses,
+                                             pMib->aData.GroupAddressTable.aGroupTable,
+                                             pMib->aData.GroupAddressTable.bFilteringEnable);
+        }
+        
+    case MIB_arpIpAddressesTable:
+        {
+            TIpAddr IpAddress;
+
+            IP_COPY (IpAddress, pMib->aData.ArpIpAddressesTable.addr);
+
+            TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_WriteMib(MIB_arpIpAddressesTable) IpAddress:\n");
+            TRACE_INFO_HEX(pTWD->hReport, (TI_UINT8*)&IpAddress, 4);
+
+            return cmdBld_CfgArpIpAddrTable (pTWD->hCmdBld, 
+                                             IpAddress,
+                                             (TI_BOOL)pMib->aData.ArpIpAddressesTable.FilteringEnable,
+                                             IP_VER_4, 
+                                             NULL, 
+                                             NULL);
+        }
+        
+    case MIB_templateFrame:
+        return TWD_WriteMibTemplateFrame (hTWD, pMib);
+        
+    case MIB_beaconFilterIETable:
+        return TWD_WriteMibBeaconFilterIETable (hTWD, pMib);
+        
+    case MIB_rxFilter:
+        {
+            TI_UINT32  uRxFilter = 0;
+            TI_UINT8   uMibRxFilter = pMib->aData.RxFilter;
+            
+            if (uMibRxFilter & MIB_RX_FILTER_PROMISCOUS_SET)
+            {
+                TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "\n TWD_WriteMib MIB_rxFilter - RX_CFG_ENABLE_ANY_DEST_MAC\n");
+                uRxFilter = RX_CFG_ENABLE_ANY_DEST_MAC;
+            }
+            else
+            {
+                uRxFilter = RX_CFG_ENABLE_ONLY_MY_DEST_MAC;
+                TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "\n halCtrl_WriteMib MIB_rxFilter - RX_CFG_ENABLE_ONLY_MY_DEST_MAC\n");
+            }
+            
+            if ((uMibRxFilter & MIB_RX_FILTER_BSSID_SET) != 0)
+            {
+                uRxFilter = uRxFilter | RX_CFG_ENABLE_ONLY_MY_BSSID;
+                TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "\n halCtrl_WriteMib MIB_rxFilter - RX_CFG_ENABLE_ONLY_MY_BSSID\n");
+            }
+            else
+            {
+                uRxFilter = uRxFilter | RX_CFG_ENABLE_ANY_BSSID;
+                TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "\n halCtrl_WriteMib MIB_rxFilter - RX_CFG_ENABLE_ANY_BSSID\n");
+            }
+            
+            /*
+             * Activates the TWD_setRxFilters function 
+             */
+            return TWD_CfgRx (hTWD, uRxFilter, RX_FILTER_OPTION_DEF);
+        }
+
+    case MIB_txRatePolicy:
+        return TWD_WriteMibTxRatePolicy (hTWD, pMib);
+
+    default:
+        TRACE1(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_WriteMib - ERROR - MIB element not supported, %d\n", pMib->aMib);
+        
+        return TI_NOK;
+        
+    } /* switch */   
+}
+
+TI_STATUS TWD_ReadMib (TI_HANDLE hTWD, TI_HANDLE hCb, void* fCb, void* pCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ReadMib: called\n");
+
+    return cmdBld_ReadMib (pTWD->hCmdBld, hCb, fCb, pCb);
+}
+
+void TWD_DisableInterrupts(TI_HANDLE hTWD)
+{
+    TTwd    *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_DisableInterrupts: called\n");
+
+    fwEvent_DisableInterrupts(pTWD->hFwEvent);
+}
+
+void TWD_EnableInterrupts(TI_HANDLE hTWD)
+{
+    TTwd    *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_EnableInterrupts: called\n");
+
+    fwEvent_EnableInterrupts(pTWD->hFwEvent);
+}
+
+TI_UINT32 TWD_TranslateToFwTime (TI_HANDLE hTWD, TI_UINT32 uHostTime)
+{
+    TTwd    *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_TranslateToFwTime: called\n");
+
+    return fwEvent_TranslateToFwTime (pTWD->hFwEvent, uHostTime);
+}
+
+void TWD_GetTwdHtCapabilities (TI_HANDLE hTWD, TTwdHtCapabilities **pTwdHtCapabilities)
+{
+    TTwd        *pTWD        = (TTwd *)hTWD;   
+    TWlanParams *pWlanParams = &DB_WLAN(pTWD->hCmdBld);
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetTwdHtCapabilities: called\n");
+
+    *pTwdHtCapabilities = &(pWlanParams->tTwdHtCapabilities);
+}
+/**
+ * \TWD_GetFEMType 
+ * \param hTWD 				- TWD module object handle
+ * \return FEM Type 
+ * 
+ * 
+ * */ 
+TI_UINT8 TWD_GetFEMType (TI_HANDLE hTWD)
+{
+  TTwd        *pTWD        = (TTwd *)hTWD;
+  IniFileGeneralParam *pGenParams = &DB_GEN(pTWD->hCmdBld);
+
+  return pGenParams->TXBiPFEMManufacturer;
+
+}
+
+/**
+ * \TWD_FinalizeFEMRead 
+ * \param hTWD 				- TWD module object handle
+ * \end of Read FEM SM calling InitHW 
+ * 
+ * 
+ * */ 
+void TWD_FinalizeFEMRead(TI_HANDLE hTWD)
+{
+  TTwd *pTWD = (TTwd *)hTWD;
+
+  (*pTWD->fInitHwCb) (pTWD->hUser, TI_OK);
+}
+
+
+
+
+void TWD_FinalizePolarityRead(TI_HANDLE hTWD)
+{
+  TTwd *pTWD = (TTwd *)hTWD;
+  /*  allways read FEM type from Radio Registers */ 
+   hwInit_ReadRadioParams(pTWD->hHwInit);   
+}
+
+/**
+ * \function TWD_rxXfer_Handle
+ * 
+ *  Handle Rx buffers read in case we delayed it from upper layer 
+ * 
+ * \param hTWD 				- TWD module object handle
+ *
+ * \sa
+ */ 
+void TWD_rxXfer_Handle (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+	rxXfer_Handle (pTWD->hRxXfer);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriver.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,4709 @@
+/*
+ * TWDriver.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TWDriver.h 
+ *  \brief TWDriver APIs
+ *
+ *  \see 
+ */
+
+/** @defgroup Control Control group
+ * \brief The Control group includes the list of functions which perform TWD Control
+ */
+/** @defgroup Measurement Measurement group
+ * \brief The Measurement group includes the list of functions which gets measurements from FW / TWD
+ */
+/** @defgroup Data_Path Data Path group
+ * \brief The Data Path group includes the list of functions which perform the TWD Data Path
+ */
+/**	@defgroup Power_Management Power Management group 	
+ * \brief The Power Management group includes the list of functions which set the power management mode
+ */
+/** @defgroup QoS Quality  Of Service group 
+ * \brief The Quality of Service group includes the list of functions which perform the TWD QoS
+ */
+/** @defgroup Radio Radio (PHY) group
+ * \brief The Radio group includes the list of functions which handle the Radio
+ */
+/** @defgroup BSS BSS group
+ * \brief The BSS group includes the list of functions which handle the Basic Service Set
+ */
+/** @defgroup Misc Miscellaneous group
+ * \brief The Miscellaneous group includes the list of functions which handle miscellaneous issues
+ */
+#ifdef TI_DBG
+/**	@defgroup Test Debug Test group
+ * \brief The Debug Test group includes the list of functions which Test the TWD and FW
+ */
+#endif
+
+#ifndef TWDRIVER_H
+#define TWDRIVER_H
+
+#define MAX_NUM_OF_802_1d_TAGS          8
+
+#include "802_11Defs.h"
+#include "TWDriverMsr.h"
+#include "TWDriverScan.h"
+#include "TWDriverRate.h"
+#include "fwDebug_api.h"
+#include "TwIf.h"
+/* 
+ * original firmware h-files 
+ */
+#include "public_commands.h"
+#include "public_event_mbox.h"
+#include "public_infoele.h"
+#include "public_host_int.h"
+#include "public_descriptors.h"   
+#include "public_radio.h"
+
+/*
+ * Firmware types defintions
+ */ 
+#ifndef uint8
+#define uint8   TI_UINT8
+#endif
+#ifndef uint16
+#define uint16  TI_UINT16
+#endif
+#ifndef uint32
+#define uint32  TI_UINT32
+#endif
+#ifndef int8
+#define int8    TI_INT8
+#endif
+#ifndef int16
+#define int16   TI_INT16
+#endif
+#ifndef int32
+#define int32   TI_INT32
+#endif
+
+
+
+/*
+ * --------------------------------------------------------------
+ *	Definitions
+ * --------------------------------------------------------------
+ */
+
+/* PALAU Group Address Default Values */
+#define NUM_GROUP_ADDRESS_VALUE_DEF     4   
+#define NUM_GROUP_ADDRESS_VALUE_MIN     0
+#define NUM_GROUP_ADDRESS_VALUE_MAX     8
+
+/* Early Wakeup Default Values */
+#define EARLY_WAKEUP_ENABLE_MIN         (TI_FALSE)
+#define EARLY_WAKEUP_ENABLE_MAX         (TI_TRUE)
+#define EARLY_WAKEUP_ENABLE_DEF         (TI_TRUE)
+
+/* ARP IP Filter Default Values */
+#define MIN_FILTER_ENABLE_VALUE         0
+#define MAX_FILTER_ENABLE_VALUE         3
+#define DEF_FILTER_ENABLE_VALUE         0
+#define FILTER_ENABLE_FLAG_LEN          1
+
+/* Beacon filter Deafult Values */
+#define DEF_BEACON_FILTER_ENABLE_VALUE  1
+#define DEF_BEACON_FILTER_IE_TABLE_NUM  16
+#define MIN_BEACON_FILTER_ENABLE_VALUE  0
+#define MAX_BEACON_FILTER_ENABLE_VALUE  1
+#define BEACON_FILTER_IE_TABLE_DEF_SIZE 37
+#define BEACON_FILTER_IE_TABLE_MAX_SIZE 100
+#define BEACON_FILTER_IE_TABLE_MIN_SIZE 0 
+#define BEACON_FILTER_IE_TABLE_MAX_NUM  (6+32)
+#define BEACON_FILTER_IE_TABLE_MIN_NUM  0 
+
+/* CoexActivity Table Deafult Values */
+#define COEX_ACTIVITY_TABLE_DEF_NUM     0
+#define COEX_ACTIVITY_TABLE_MIN_NUM     0
+#define COEX_ACTIVITY_TABLE_MAX_NUM     24*2
+#define COEX_ACTIVITY_TABLE_SIZE        ((2+1)+(2+1)+(2+1)+(2+1)+(4+1)+(4+1)) /* includes spaces between bytes */
+
+#define DEF_NUM_STORED_FILTERS          1
+#define MIN_NUM_STORED_FILTERS          1
+#define MAX_NUM_STORED_FILTERS          8
+
+#define TWD_HW_ACCESS_METHOD_MIN   0
+#define TWD_HW_ACCESS_METHOD_MAX   2
+#define TWD_HW_ACCESS_METHOD_DEF   1
+
+#define TWD_SITE_FRAG_COLLECT_MIN  2
+#define TWD_SITE_FRAG_COLLECT_MAX  10
+#define TWD_SITE_FRAG_COLLECT_DEF  3
+
+#define TWD_RX_MEM_BLKS_NUM        40   /* The number of Rx memory blocks configured to FW */
+#define TWD_TX_MIN_MEM_BLKS_NUM    107   /* The MINIMUM number of Tx memory blocks configured to FW */
+
+#define TWD_RX_BLOCKS_RATIO_MIN    0
+#define TWD_RX_BLOCKS_RATIO_MAX    100
+#define TWD_RX_BLOCKS_RATIO_DEF    50
+
+#define TWD_TX_FLASH_ENABLE_MIN         TI_FALSE
+#define TWD_TX_FLASH_ENABLE_MAX         TI_TRUE
+#define TWD_TX_FLASH_ENABLE_DEF         TI_TRUE
+
+#define TWD_USE_INTR_TRHESHOLD_MIN 0
+#define TWD_USE_INTR_TRHESHOLD_MAX 1
+#define TWD_USE_INTR_TRHESHOLD_DEF 0
+
+#define TWD_USE_TX_DATA_INTR_MIN   0
+#define TWD_USE_TX_DATA_INTR_MAX   1
+
+#define NUM_OF_CHANNELS_24              14
+#define NUM_OF_CHANNELS_5               180
+
+#define TWD_CALIBRATION_CHANNEL_2_4_MIN 1
+#define TWD_CALIBRATION_CHANNEL_2_4_MAX NUM_OF_CHANNELS_24
+#define TWD_CALIBRATION_CHANNEL_2_4_DEF 1
+
+#define A_5G_BAND_MIN_CHANNEL       36
+#define A_5G_BAND_MAX_CHANNEL       180
+#define A_5G_BAND_NUM_CHANNELS  	(A_5G_BAND_MAX_CHANNEL-A_5G_BAND_MIN_CHANNEL+1)
+
+#define TWD_CALIBRATION_CHANNEL_5_0_MIN 34
+#define TWD_CALIBRATION_CHANNEL_5_0_MAX  A_5G_BAND_MAX_CHANNEL
+#define TWD_CALIBRATION_CHANNEL_5_0_DEF 36
+
+#define TWD_CALIBRATION_CHANNEL_4_9_MIN 8
+#define TWD_CALIBRATION_CHANNEL_4_9_MAX 16
+#define TWD_CALIBRATION_CHANNEL_4_9_DEF 12
+
+#define TWD_RTS_THRESHOLD_MIN           0
+#define TWD_RTS_THRESHOLD_MAX           4096
+#define TWD_RTS_THRESHOLD_DEF           4096
+
+#define TWD_BCN_RX_TIME_OUT_MIN         10      /* ms */
+#define TWD_BCN_RX_TIME_OUT_MAX         1000    /* ms */
+#define TWD_BCN_RX_TIME_OUT_DEF         10      /* ms */
+
+#define TWD_RX_DISABLE_BROADCAST_MIN    TI_FALSE
+#define TWD_RX_DISABLE_BROADCAST_MAX    TI_TRUE
+#define TWD_RX_DISABLE_BROADCAST_DEF    TI_FALSE
+
+/* Indicate if the recovery process is active or not */
+#define TWD_RECOVERY_ENABLE_MIN         TI_FALSE
+#define TWD_RECOVERY_ENABLE_MAX         TI_TRUE
+#define TWD_RECOVERY_ENABLE_DEF         TI_TRUE
+
+/* Indicate if working with Burst Mode or not */
+#define BURST_MODE_ENABLE_MIN         TI_FALSE
+#define BURST_MODE_ENABLE_MAX         TI_TRUE
+#define BURST_MODE_ENABLE_DEF         TI_FALSE
+
+#define SMART_REFLEX_STATE_MIN        TI_FALSE
+#define SMART_REFLEX_STATE_MAX        TI_TRUE
+#define SMART_REFLEX_STATE_DEF        TI_TRUE
+
+#define SMART_REFLEX_DEBUG_MIN        0
+#define SMART_REFLEX_DEBUG_MAX        0xFFFF
+#define SMART_REFLEX_DEBUG_DEF        0
+
+#define SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE  "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0"
+
+#define TWD_FRAG_THRESHOLD_MIN          256
+#define TWD_FRAG_THRESHOLD_MAX          4096
+#define TWD_FRAG_THRESHOLD_DEF          4096
+
+#define TWD_MAX_TX_MSDU_LIFETIME_MIN    0
+#define TWD_MAX_TX_MSDU_LIFETIME_MAX    3000
+#define TWD_MAX_TX_MSDU_LIFETIME_DEF    512
+
+#define TWD_MAX_RX_MSDU_LIFETIME_MIN    0
+#define TWD_MAX_RX_MSDU_LIFETIME_MAX    0xFFFFFFFF
+#define TWD_MAX_RX_MSDU_LIFETIME_DEF    512000
+
+
+#define TWD_LISTEN_INTERVAL_MIN         1
+#define TWD_LISTEN_INTERVAL_MAX         10
+#define TWD_LISTEN_INTERVAL_DEF         3
+
+/* This field indicates the number of transmit retries to attempt at
+    the rate specified in the TNETW Tx descriptor before
+    falling back to the next lowest rate.
+    If this field is set to 0xff, then rate fallback is disabled.
+    If this field is 0, then there will be 0 retries before starting fallback.*/
+#define TWD_RATE_FB_RETRY_LIMIT_MIN     0   /* => No retries before starting RateFallBack */
+#define TWD_RATE_FB_RETRY_LIMIT_MAX     255 /* =>0xff for disabling Rate fallback */
+#define TWD_RATE_FB_RETRY_LIMIT_DEF     0
+
+#define TWD_TX_ANTENNA_MIN              TX_ANTENNA_2
+#define TWD_TX_ANTENNA_MAX              TX_ANTENNA_1
+#define TWD_TX_ANTENNA_DEF              TX_ANTENNA_1
+
+#define TWD_RX_ANTENNA_MIN              RX_ANTENNA_1
+#define TWD_RX_ANTENNA_MAX              RX_ANTENNA_PARTIAL
+#define TWD_RX_ANTENNA_DEF              RX_ANTENNA_FULL
+
+/*
+ * Tx and Rx interrupts pacing (threshold in packets, timeouts in milliseconds)
+ */
+#define TWD_TX_CMPLT_THRESHOLD_DEF      5   /* 0 means no pacing so send interrupt on every event */
+#define TWD_TX_CMPLT_THRESHOLD_MIN      0
+#define TWD_TX_CMPLT_THRESHOLD_MAX      30
+
+#define TWD_TX_CMPLT_TIMEOUT_DEF        3000
+#define TWD_TX_CMPLT_TIMEOUT_MIN        100
+#define TWD_TX_CMPLT_TIMEOUT_MAX        50000
+
+#define TWD_RX_INTR_THRESHOLD_DEF       0   /* 0 means no pacing so send interrupt on every event */
+#define TWD_RX_INTR_THRESHOLD_MIN       0
+#define TWD_RX_INTR_THRESHOLD_MAX       30
+
+#define TWD_RX_INTR_TIMEOUT_DEF         2000
+#define TWD_RX_INTR_TIMEOUT_MIN         1 
+#define TWD_RX_INTR_TIMEOUT_MAX         50000
+
+/*
+ * Tx power level 
+ */
+#define TWD_TX_POWER_LEVEL_MIN          MAX_POWER_LEVEL /* registry needs the lower number 	*/
+#define TWD_TX_POWER_LEVEL_MAX          MIN_POWER_LEVEL /* registry needs the hifger number */
+#define TWD_TX_POWER_LEVEL_DEF          MAX_POWER_LEVEL
+
+#define DBM_TO_TX_POWER_FACTOR			10
+
+/* TX_POWER is in Dbm/10 units */
+#define MAX_TX_POWER					205 
+#define MIN_TX_POWER					0   
+#define DEF_TX_POWER					70   
+
+
+#define MIN_DEFAULT_KEY_ID              0
+#define MAX_DEFAULT_KEY_ID              3
+
+#define KEY_RSC_LEN                     8
+#define MIN_KEY_LEN                     5
+#define MAX_KEY_LEN                     32
+
+#define TWD_RSSI_WEIGHT_MIN             0   
+#define TWD_RSSI_WEIGHT_MAX             100
+#define TWD_RSSI_WEIGHT_DEF             20
+
+#define TWD_DCO_ITRIM_ENABLE_MIN  TI_FALSE
+#define TWD_DCO_ITRIM_ENABLE_MAX  TI_TRUE
+#define TWD_DCO_ITRIM_ENABLE_DEF  TI_FALSE
+
+#define TWD_DCO_ITRIM_MODERATION_TIMEOUT_MIN    10000
+#define TWD_DCO_ITRIM_MODERATION_TIMEOUT_MAX  1000000
+#define TWD_DCO_ITRIM_MODERATION_TIMEOUT_DEF    50000
+
+
+#define MAX_NUM_OF_AC                   4
+
+/************************************/      
+/*      Rates values                */  
+/************************************/
+/* The next definitions are used to decide which encryption is used by the Rx flags */
+#define RX_FLAGS_NO_SECURITY                0  
+#define RX_FLAGS_WEP                        1
+#define RX_FLAGS_TKIP                       2
+#define RX_FLAGS_AES                        3
+
+
+#define RX_DESC_FLAGS_ENCRYPTION            8
+#define RX_PACKET_FLAGS_ENCRYPTION_SHIFT    16
+#define RX_PACKET_FLAGS_ENCRYPTION_SHIFT_FROM_DESC      (RX_PACKET_FLAGS_ENCRYPTION_SHIFT - RX_DESC_FLAGS_ENCRYPTION)
+
+/* Tx packet Control-Block flags bit-mask. */
+#define TX_CTRL_FLAG_XFER_DONE_ISSUED      0x0001  /* Xfer-Done already issued to upper driver   - for WHA. */
+#define TX_CTRL_FLAG_TX_COMPLETE_ISSUED    0x0002  /* Tx-Complete already issued to upper driver - for WHA. */
+#define TX_CTRL_FLAG_LINK_TEST             0x0004  /* XCC link test packet */
+#define TX_CTRL_FLAG_SENT_TO_FW            0x0008  /* Set after the packet is allowed to be sent to FW (by TxHwQueue) */
+#define TX_CTRL_FLAG_PKT_IN_RAW_BUF        0x0010  /* The input packet is in a raw buffer (as opposed to OS packet) */
+#define TX_CTRL_FLAG_MULTICAST             0x0020  /* A multicast ethernet packet */
+#define TX_CTRL_FLAG_BROADCAST             0x0040  /* A broadcast ethernet packet */
+
+#define TX_PKT_TYPE_MGMT                   1   /* Management Packet						  */
+#define TX_PKT_TYPE_EAPOL                  2   /* EAPOL packet (Ethernet)				  */
+#define TX_PKT_TYPE_ETHER                  3   /* Data packet from the Network interface  */
+#define TX_PKT_TYPE_WLAN_DATA	           4   /* Driver generated WLAN Data Packet (currently used for IAPP packet) */
+
+
+#define ALIGN_4BYTE_MASK                   0x3 /* Masked LS bits for 4-bytes aligned addresses or lengths. */
+#define SHIFT_BETWEEN_TU_AND_USEC          10  /* Shift factor to convert between TU (1024 uSec) and uSec. */
+
+/* Packet header + extensions structure ranges between 24 and 48 bytes as follows:
+ * ------------------------------------------------------------------------------
+ * Alignment Padding:   0/2 bytes,      added for 4 bytes alignment of this structure.
+ * Mac-Header:          24 bytes,       802.11 basic header.
+ * Qos header:          0/2 bytes,      for QoS-data or QoS-Null the two QoS bytes are added.
+ * Security Pad:        0/0/4/8/18 bytes,  for None/WEP/TKIP/AES/GEM.
+ * LLC/SNAP:            0/8 bytes,      added only for data packets.
+ * HT control:          0/4             added only for packte support QoS and HT
+ */
+#define MAX_HEADER_SIZE                 48  
+
+/* Data body max length */
+#define MAX_DATA_BODY_LENGTH            4096
+
+
+
+/* The weight in % of the new packet relative to the previous average value of RSSI */
+#define RSSI_DEFAULT_WEIGHT             20 
+
+#define RSSI_DEFAULT_THRESHOLD          -80 
+#define SNR_DEFAULT_THRESHOLD           0 
+
+/* 
+ * 'No beacon' roaming trigger configuration
+ * Number of consecutive beacons (or DTIM periods) missed before 
+ * 'Out of Sync' event is raised 
+ */
+#define OUT_OF_SYNC_DEFAULT_THRESHOLD   10
+/* 
+ * IBSS - Number of consecutive beacons (or DTIM periods) missed before 
+ * 'Out of Sync' event is raised 
+ */
+#define OUT_OF_SYNC_IBSS_THRESHOLD      200
+/* Period of time between 'Out of sync' and 'No beacon' events */
+#define NO_BEACON_DEFAULT_TIMEOUT       100 /* in tu-s*/
+
+/* Consecutive NACK roaming trigger configuration */
+#define NO_ACK_DEFAULT_THRESHOLD        20 
+
+/* Low Rx rate roaming trigger configuration */
+#define LOW_RATE_DEFAULT_THRESHOLD      2 
+
+#define MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES       8
+#define MAX_CHANNELS_IN_REG_DOMAIN      40
+
+#define CTS_TO_SELF_DISABLE             0
+#define CTS_TO_SELF_ENABLE              1
+
+#define MAX_TEMPLATE_SIZE               256
+
+/* Scan constants */
+#define MAX_NUMBER_OF_CHANNELS_PER_SCAN                     16
+#define SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND         MAX_NUMBER_OF_CHANNELS_PER_SCAN
+#define SCAN_MAX_NUM_OF_SPS_CHANNELS_PER_COMMAND            16
+#define SCAN_DEFAULT_MIN_CHANNEL_DWELL_TIME                 30000
+#define SCAN_DEFAULT_MAX_CHANNEL_DWELL_TIME                 60000
+#define SCAN_DEFAULT_EARLY_TERMINATION_EVENT                SCAN_ET_COND_DISABLE
+#define SCAN_DEFAULT_EARLY_TERMINATION_NUM_OF_FRAMES        0
+
+#define NUM_OF_NOISE_HISTOGRAM_COUNTERS 8
+
+#define TX_DESCRIPTOR_SIZE             sizeof(TxIfDescriptor_t)
+
+#define CTRL_BLK_ENTRIES_NUM            128
+
+#define HT_CAP_AMPDU_PARAMETERS_FIELD_OFFSET   2
+#define HT_CAP_HT_EXTENDED_FIELD_OFFSET        19
+#define HT_CAP_AMPDU_MAX_RX_FACTOR_BITMASK     0x3
+#define HT_CAP_AMPDU_MIN_START_SPACING_BITMASK 0x7
+#define HT_CAP_GREENFIELD_FRAME_FORMAT_BITMASK 0x0010
+#define HT_CAP_SHORT_GI_FOR_20MHZ_BITMASK      0x0020
+#define HT_CAP_LSIG_TXOP_PROTECTION_BITMASK    0x8000
+#define HT_EXT_HT_CONTROL_FIELDS_BITMASK       0x0400
+#define HT_EXT_RD_INITIATION_BITMASK           0x0800
+#define HT_INF_RIFS_MOD_BITMASK                0x08
+#define HT_INF_OPERATION_MOD_BITMASK           0x03
+#define HT_INF_NON_GF_PRES_BITMASK             0x04
+#define HT_INF_TX_BURST_LIMIT_BITMASK          0x08
+#define HT_INF_DUAL_BEACON_BITMASK             0x40
+
+/* 
+ * TWD HT capabilities, physical capabilities of the STA.
+ * The structure is defined like that in order to simplify the interface with WHA layer.
+ */
+#define RX_TX_MCS_BITMASK_SIZE      10
+
+#define  DSSS_CCK_MODE         					1
+
+#define MCS_HIGHEST_SUPPORTED_RECEPTION_DATA_RATE_IN_MBIT_S 0x48
+
+#define IMPLICIT_TXBF_REC_CAPABLE             	1
+#define TRANSMIT_STAGGERED_SOUNDING_CAPABLE   	1
+
+/* Firmware version name length */
+#define FW_VERSION_LEN                  		20
+
+/*the max table sized is : ( number of 221 * 8 bytes ) + ( non-221 * 2 bytes )
+  Must be synchronized with the size of ACX defined in public_infoele.h interface
+  with the FW
+*/
+#define MIB_MAX_SIZE_OF_IE_TABLE 				112 
+#define MIB_TEMPLATE_DATA_MAX_LEN   			256
+#define MIB_MAX_MULTICAST_GROUP_ADDRS			8
+
+#define MAX_MULTICAST_GROUP_ADDRS				8
+
+/* Max numver of policies */
+#define MAX_NUM_OF_TX_RATE_CLASS_POLICIES   	8 
+
+#define NUM_POWER_LEVELS                		4
+#define MAX_POWER_LEVEL                 		1
+#define MIN_POWER_LEVEL                 		NUM_POWER_LEVELS
+
+/*
+ * --------------------------------------------------------------
+ *	Enumerations
+ * --------------------------------------------------------------
+ */
+/** \enum EFileType
+ * \brief TWD input/output files
+ *
+ * \par Description
+ * Indicates which File (or part of file) to read or write
+ *
+ * \sa TFileInfo
+ */
+typedef enum
+{
+    FILE_TYPE_INI = 0, 	/**< */
+    FILE_TYPE_NVS, 		/**< */
+    FILE_TYPE_FW, 		/**< */
+    FILE_TYPE_FW_NEXT 	/**< */
+} EFileType;
+
+/** \enum EKeepAliveTriggerType
+ * \brief Keep Alive Trigger Types
+ * 
+ * \par Description
+ * Indicates when to trigger Keep Alive
+ * 
+ * \sa TKeepAliveParams
+ * 
+ */
+
+typedef enum
+{
+    KEEP_ALIVE_TRIG_TYPE_NO_TX = 0,		/**< */
+    KEEP_ALIVE_TRIG_TYPE_PERIOD_ONLY	/**< */
+
+} EKeepAliveTriggerType;
+
+/** \enum ESlotTime
+ * \brief Radio (PHY) Slot Time Type
+ * 
+ * \par Description
+ * Used for configuring PHY Slot Time for FW
+ * 
+ * \sa TWD_CfgPreamble
+ */
+typedef enum
+{
+	PHY_SLOT_TIME_LONG		= 0,	/**< 	Long PHY Slot Time  */ 
+    PHY_SLOT_TIME_SHORT     = 1		/**< 	Short PHY Slot Time  */ 
+
+} ESlotTime;
+
+/** \enum EMib
+ * \brief MIB Element Type
+ * 
+ * \par Description
+ * Used for R/W MIB to FW
+ * 
+ * \sa TMib
+ */
+typedef enum
+{
+/*	0x00	*/	MIB_dot11MaxReceiveLifetime = 0,	/**< */
+/*	0x01	*/  MIB_dot11SlotTime,					/**< */
+/*	0x02	*/  MIB_dot11GroupAddressesTable,		/**< */
+/*	0x03	*/  MIB_dot11WepDefaultKeyId,			/**< */
+/*	0x04	*/  MIB_dot11CurrentTxPowerLevel,		/**< */
+/*	0x05	*/  MIB_dot11RTSThreshold,				/**< */
+/*	0x06	*/  MIB_ctsToSelf,						/**< */
+/*	0x07	*/  MIB_arpIpAddressesTable,			/**< */
+/*	0x08	*/  MIB_templateFrame,					/**< */
+/*	0x09	*/  MIB_rxFilter,						/**< */
+/*	0x0A	*/  MIB_beaconFilterIETable,			/**< */
+/*	0x0B	*/  MIB_beaconFilterEnable,				/**< */
+/*	0x0C	*/  MIB_sleepMode,						/**< */
+/*	0x0D	*/  MIB_wlanWakeUpInterval,				/**< */
+/*	0x0E	*/  MIB_beaconLostCount,				/**< */
+/*	0x0F	*/  MIB_rcpiThreshold,					/**< */
+/*	0x10	*/  MIB_statisticsTable,				/**< */
+/*	0x11	*/  MIB_ibssPsConfig,					/**< */
+/*	0x12	*/  MIB_txRatePolicy,					/**< */
+/*	0x13	*/  MIB_countersTable,					/**< */
+/*	0x14	*/  MIB_btCoexsitenceMode,				/**< */
+/*	0x15	*/  MIB_btCoexistenceParameters,		/**< */
+
+				/* must be last!!! */
+				MIB_lastElem	= 0xFFFF			/**< */
+
+} EMib;
+
+/** \enum ETwdParam
+ * \brief TWD Control parameter ID
+ * 
+ * \par Description
+ * FW Parmaeter Information Identifier
+ * 
+ * \sa TWD_SetParam, TWD_GetParam
+ */
+typedef enum
+{
+/*	0x01	*/	TWD_RTS_THRESHOLD_PARAM_ID          = 0x01,		/**< */
+/*	0x02	*/  TWD_FRAG_THRESHOLD_PARAM_ID,					/**< */
+/*	0x03	*/  TWD_COUNTERS_PARAM_ID,							/**< */
+/*	0x04	*/  TWD_LISTEN_INTERVAL_PARAM_ID,					/**< */
+/*	0x05	*/  TWD_BEACON_INTERVAL_PARAM_ID,					/**< */
+/*	0x06	*/  TWD_TX_POWER_PARAM_ID,    						/**< */
+/*	0x07	*/  TWD_CLK_RUN_ENABLE_PARAM_ID,					/**< */
+/*	0x08	*/  TWD_QUEUES_PARAM_ID, 							/**< */
+/*	0x09	*/  TWD_TX_RATE_CLASS_PARAM_ID,						/**< */
+/*	0x0A	*/  TWD_MAX_TX_MSDU_LIFE_TIME_PARAM_ID,				/**< */
+/*	0x0B	*/  TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID,				/**< */
+/*	0x0C	*/  TWD_CTS_TO_SELF_PARAM_ID,						/**< */
+/*	0x0D	*/  TWD_RX_TIME_OUT_PARAM_ID,						/**< */
+/*	0x0E	*/  TWD_BCN_BRC_OPTIONS_PARAM_ID,					/**< */
+/*	0x0F	*/	TWD_AID_PARAM_ID,								/**< */
+/*	0x10	*/  TWD_RSN_HW_ENC_DEC_ENABLE_PARAM_ID,  			/**< */
+/*	0x11	*/  TWD_RSN_KEY_ADD_PARAM_ID,						/**< */
+/*	0x12	*/  TWD_RSN_KEY_REMOVE_PARAM_ID,					/**< */
+/*	0x13	*/  TWD_RSN_DEFAULT_KEY_ID_PARAM_ID,				/**< */
+/*	0x14	*/  TWD_RSN_SECURITY_MODE_PARAM_ID,					/**< */
+/*	0x15	*/  TWD_RSN_SECURITY_ALARM_CB_SET_PARAM_ID,			/**< */
+/*	0x16	*/  TWD_ACX_STATISTICS_PARAM_ID,					/**< */
+/*	0x17	*/  TWD_MEDIUM_OCCUPANCY_PARAM_ID,					/**< */
+/*	0x18	*/  TWD_DISABLE_POWER_MANAGEMENT_AUTO_CONFIG_PARAM_ID,	/**< */
+/*	0x19	*/  TWD_ENABLE_POWER_MANAGEMENT_AUTO_CONFIG_PARAM_ID,	/**< */
+/*	0x1A	*/  TWD_SG_ENABLE_PARAM_ID,							/**< */
+/*	0x1B	*/  TWD_SG_CONFIG_PARAM_ID,							/**< */
+#ifdef XCC_MODULE_INCLUDED
+/*	0x1C	*/  TWD_RSN_XCC_SW_ENC_ENABLE_PARAM_ID,				/**< */
+/*	0x1D	*/  TWD_RSN_XCC_MIC_FIELD_ENABLE_PARAM_ID,			/**< */
+#endif /* XCC_MODULE_INCLUDED*/
+/*	0x1E	*/  TWD_TX_OP_LIMIT_PARAM_ID,						/**< */
+/*	0x1F	*/  TWD_NOISE_HISTOGRAM_PARAM_ID,					/**< */
+/*	0x20	*/  TWD_TSF_DTIM_MIB_PARAM_ID,						/**< */
+/*	0x21	*/  TWD_REVISION_PARAM_ID,							/**< */
+/*	0x22	*/  TWD_CURRENT_CHANNEL_PARAM_ID,					/**< */
+/*	0x23	*/	TWD_RADIO_TEST_PARAM_ID,						/**< */
+/*	0x24	*/	TWD_RSSI_LEVEL_PARAM_ID,						/**< */
+/*	0x25	*/	TWD_SNR_RATIO_PARAM_ID,							/**< */
+/*	0x26	*/	TWD_COEX_ACTIVITY_PARAM_ID,	    				/**< */
+/*	0x27	*/	TWD_FM_COEX_PARAM_ID,	    				    /**< */
+/*	0x28	*/	TWD_DCO_ITRIM_PARAMS_ID,    				    /**< */
+
+				/* must be last!!! */
+/*	0x29    */	TWD_LAST_PARAM_ID								/**< */
+} ETwdParam;
+
+/** \enum ETwdCallbackOwner
+ * \brief TWD Callback Module owner ID
+ * 
+ * \par Description
+ * The Owner ID defines a specific TWD Module
+ * 
+ * \sa ETwdEventId, TWD_RegisterCb
+ */
+typedef enum
+{
+    TWD_OWNER_DRIVER_TX_XFER            = 0x0100,	/**< 	TX Xfer Owner ID  		*/    
+    TWD_OWNER_RX_XFER                   = 0x0200,	/**< 	RX Xfer Owner ID  		*/    
+    TWD_OWNER_SELF                      = 0x0300,	/**< 	Self Owner ID  			*/    
+    TWD_OWNER_MAC_SERVICES              = 0x0400,	/**< 	MAC Services Owner ID  	*/    
+    TWD_OWNER_TX_RESULT                 = 0x0500,	/**< 	TX Result Owner ID  	*/    
+    TWD_OWNER_SELF_CONFIG               = 0x0600,	/**< 	Self configuration of Owner ID  	*/    
+    TWD_OWNER_RX_QUEUE                  = 0x0700,	/**< 	RX Queue Owner ID  		*/    
+    TWD_OWNER_TX_HW_QUEUE               = 0x0800	/**< 	TX HW Queue Owner ID  	*/    
+
+} ETwdCallbackOwner;
+
+/** \enum ETwdIntCallbackId
+ * \brief TWD Internal Callbacks ID
+ * 
+ * \par Description
+ * The Owner ID defines a specific TWD Internal CB
+ * 
+ * \sa ETwdEventId
+ */
+typedef enum
+{
+    TWD_INT_SEND_PACKET_TRANSFER        =  0x00 ,	/**< 	Tx Data Path Send Callback  	*/    
+    TWD_INT_SEND_PACKET_COMPLETE                , 	/**< 	Tx Data Path Complete Callback 	*/   
+    TWD_INT_UPDATE_BUSY_MAP                     , 	/**< 	Tx Data Path Update-Busy-Map Callback 	*/   
+
+    /* Rx Data Path Callbacks */
+    TWD_INT_RECEIVE_PACKET              =  0x10 ,	/**< 	Rx Data Path Receive Packet Callback 	   	*/    
+    TWD_INT_REQUEST_FOR_BUFFER                  , 	/**< 	Rx Data Path Request for buffer Callback  	*/   
+    
+    /* TWD Callbacks */
+    TWD_INT_COMMAND_COMPLETE            =  0x20 , 	/**< 	TWD internal Command Complete Callback  	*/   
+    TWD_INT_EVENT_FAILURE  							/**< 	TWD internal Event Failure handle Callback 	*/        
+
+} ETwdIntCallbackId;
+
+/** \enum ETwdOwnEventId
+ * \brief Event Mail Box ID
+ * 
+ * \par Description
+ * Clients That expects an event should register for it, 
+ * and Mask/UnMask Events with this ID
+ * 
+ * \sa
+ */
+/* Note: changes here should be reflected also in eventTable in eventMbox.c !!! */
+typedef enum 
+{
+			/*Regular events*/
+/*	0	*/  TWD_OWN_EVENT_RSSI_SNR_TRIGGER_0 = 0,       /**< */
+/*	1	*/  TWD_OWN_EVENT_RSSI_SNR_TRIGGER_1,           /**< */
+/*	2	*/  TWD_OWN_EVENT_RSSI_SNR_TRIGGER_2,           /**< */
+/*	3	*/  TWD_OWN_EVENT_RSSI_SNR_TRIGGER_3,           /**< */
+/*	4	*/  TWD_OWN_EVENT_RSSI_SNR_TRIGGER_4,          	/**< */
+/*	5	*/  TWD_OWN_EVENT_RSSI_SNR_TRIGGER_5,           /**< */
+/*	6	*/  TWD_OWN_EVENT_RSSI_SNR_TRIGGER_6,           /**< */
+/*	7	*/  TWD_OWN_EVENT_RSSI_SNR_TRIGGER_7,           /**< */
+/*	8	*/	TWD_OWN_EVENT_MEASUREMENT_START,            /**< */
+/*	9	*/  TWD_OWN_EVENT_MEASUREMENT_COMPLETE,         /**< */
+/*	10	*/	TWD_OWN_EVENT_SCAN_CMPLT,                   /**< */
+/*	11	*/  TWD_OWN_EVENT_SPS_SCAN_CMPLT,               /**< */
+/*	12	*/  TWD_OWN_EVENT_AP_DISCOVERY_COMPLETE,        /**< */
+/*	13	*/  TWD_OWN_EVENT_PS_REPORT,                    /**< */
+/*	14	*/	TWD_OWN_EVENT_PSPOLL_DELIVERY_FAILURE, 		/**< */
+/*	15	*/  TWD_OWN_EVENT_DISCONNECT_COMPLETE,          /**< */
+/*	16	*/  TWD_OWN_EVENT_JOIN_CMPLT,                   /**< */
+/*	17	*/  TWD_OWN_EVENT_SWITCH_CHANNEL_CMPLT,         /**< */
+/*	18	*/  TWD_OWN_EVENT_BSS_LOSE,                     /**< */
+/*	19	*/  TWD_OWN_EVENT_BSS_REGAIN,                   /**< */
+/*	20	*/  TWD_OWN_EVENT_MAX_TX_RETRY,                 /**< */
+/*  21  */  RESERVED21,									/**< */
+/*	22	*/  TWD_OWN_EVENT_SOFT_GEMINI_SENSE,            /**< */
+/*	23	*/  TWD_OWN_EVENT_SOFT_GEMINI_PREDIC,           /**< */
+/*	24	*/  TWD_OWN_EVENT_SOFT_GEMINI_AVALANCHE,        /**< */
+/*	25	*/  TWD_OWN_EVENT_PLT_RX_CALIBRATION_COMPLETE,  /**< */
+/*  26  */  TWD_DBG_EVENT,								/**< */
+/*  27  */  TWD_HEALTH_CHECK_REPLY_EVENT,				/**< */
+/*	28	*/  TWD_OWN_EVENT_PERIODIC_SCAN_COMPLETE,       /**< */
+/*	29	*/  TWD_OWN_EVENT_PERIODIC_SCAN_REPORT,         /**< */
+/*  30  */  TWD_BA_SESSION_TEAR_DOWN_EVENT,				/**< */
+/*	31	*/  TWD_OWN_EVENT_ALL,                          /**< */
+/*	32	*/  TWD_OWN_EVENT_MAX                          	/**< */ 
+
+} ETwdOwnEventId;   
+
+/** \enum ETwdEventId
+ * \brief TNETW Driver Event ID
+ * 
+ * \par Description
+ * The TWD Event ID is used by user for registering a TWD Internal CB 
+ * which will handle a TWD Event.
+ * Each field in this enum is an ID of TWD Event, and is combined of two IDs: 
+ * TWD CB Owner (Module) ID and TWD Internal CB ID. Therefore, the CB is registered accordeing to
+ * Module (Owner) and Internal CB Id.
+ * 
+ * \sa TWD_RegisterCb, ETwdCallbackOwner, ETwdIntCallbackId
+ */
+typedef enum
+{
+    /* Internal Failure Event Callbacks */
+    TWD_EVENT_FAILURE                   	=  TWD_OWNER_SELF | TWD_INT_EVENT_FAILURE, 					/**< 	Failure Internal Event ID 			*/
+    TWD_EVENT_COMMAND_COMPLETE          	=  TWD_OWNER_SELF | TWD_INT_COMMAND_COMPLETE,  				/**< 	Command Complete Internal Event ID */
+    
+    /* Tx Data Path Callbacks */
+    TWD_EVENT_TX_XFER_SEND_PKT_TRANSFER 	=  TWD_OWNER_DRIVER_TX_XFER | TWD_INT_SEND_PACKET_TRANSFER,	/**< 	TX Data Path Send Packet Event ID 			*/
+    TWD_EVENT_TX_RESULT_SEND_PKT_COMPLETE	=  TWD_OWNER_TX_RESULT | TWD_INT_SEND_PACKET_COMPLETE,      /**< 	TX Data Path Send Packet Complete Event ID 	*/
+    TWD_EVENT_TX_HW_QUEUE_UPDATE_BUSY_MAP   =  TWD_OWNER_TX_HW_QUEUE | TWD_INT_UPDATE_BUSY_MAP,         /**< 	TX Data Path Update-Busy-Map Event ID 	*/
+
+    /* Rx Data Path Callbacks */
+    TWD_EVENT_RX_REQUEST_FOR_BUFFER     	=  TWD_OWNER_RX_XFER | TWD_INT_REQUEST_FOR_BUFFER,         	/**< 	RX Data Path Request for Buffer Internal Event ID 	*/
+    TWD_EVENT_RX_RECEIVE_PACKET         	=  TWD_OWNER_RX_QUEUE | TWD_INT_RECEIVE_PACKET             	/**< 	RX Data Path Receive Packet Internal Event ID  	*/
+
+} ETwdEventId;
+
+#ifdef TI_DBG
+/** \enum ETwdPrintInfoType
+ * \brief TWD print functions codes
+ * 
+ * \par Description
+ * Used for Debug - determines which Tx Info to print
+ * 
+ * \sa TWD_PrintTxInfo
+ */
+typedef enum
+{
+/*	0	*/	TWD_PRINT_TX_CTRL_BLK_TBL = 0,	/**< 	Print TX Control Block Information	*/
+/*	1	*/  TWD_PRINT_TX_HW_QUEUE_INFO,		/**< 	Print TX HW Queue Information 		*/
+/*	2	*/  TWD_PRINT_TX_XFER_INFO,			/**< 	Print TX XFER Information 			*/
+/*	3	*/  TWD_PRINT_TX_RESULT_INFO,		/**< 	Print TX Result Information 		*/
+/*	4	*/  TWD_CLEAR_TX_RESULT_INFO		/**< 	Clear TX Result Information			*/
+
+} ETwdPrintInfoType;
+#endif
+
+/** \enum EIpVer
+ * \brief IP Version
+ * 
+ * \par Description
+ * 
+ * \sa TWD_PrintTxInfo
+ */
+typedef enum
+{
+/*	0	*/	IP_VER_4 = 0, 	/**< */	
+/*	1	*/  IP_VER_6	 	/**< */
+
+} EIpVer;
+
+/** \enum EKeyType
+ * \brief Key Type
+ * 
+ * \par Description
+ * Security Key Type
+ * 
+ * \sa TSecurityKeys
+ */
+typedef enum
+{
+/*	0	*/  KEY_NULL = 0,	/**< */
+/*	1	*/  KEY_WEP,		/**< */
+/*	2	*/  KEY_TKIP,		/**< */
+/*	3	*/  KEY_AES,		/**< */
+/*	4	*/  KEY_XCC,    	/**< */
+#ifdef GEM_SUPPORT
+    /*  5   */  KEY_GEM
+#endif
+
+} EKeyType;
+
+/** \enum ERegistryTxRate
+ * \brief TX Rate Type
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+/* Make it same as "rate_e" */
+typedef enum
+{
+/* This value is reserved if this enum is used for MgmtCtrlTxRate - the auto mode is only valid for data packets */  
+/*	0	*/	REG_RATE_AUTO_BIT = 0, 		/**< */
+/*	1	*/	REG_RATE_1M_BIT,			/**< */
+/*	2	*/	REG_RATE_2M_BIT,			/**< */
+/*	3	*/	REG_RATE_5_5M_CCK_BIT,		/**< */
+/*	4	*/	REG_RATE_11M_CCK_BIT,		/**< */
+/*	5	*/	REG_RATE_22M_PBCC_BIT,		/**< */
+/*	6	*/	REG_RATE_6M_OFDM_BIT,		/**< */
+/*	7	*/	REG_RATE_9M_OFDM_BIT,		/**< */
+/*	8	*/	REG_RATE_12M_OFDM_BIT,		/**< */
+/*	9	*/	REG_RATE_18M_OFDM_BIT,		/**< */
+/*	10	*/	REG_RATE_24M_OFDM_BIT,		/**< */
+/*	11	*/	REG_RATE_36M_OFDM_BIT,		/**< */
+/*	12	*/	REG_RATE_48M_OFDM_BIT,		/**< */
+/*	13	*/	REG_RATE_54M_OFDM_BIT,		/**< */
+/*	14	*/	REG_RATE_MCS0_OFDM_BIT,		/**< */
+/*	15	*/	REG_RATE_MCS1_OFDM_BIT,		/**< */
+/*	16	*/	REG_RATE_MCS2_OFDM_BIT,		/**< */
+/*	17	*/	REG_RATE_MCS3_OFDM_BIT,		/**< */
+/*	18	*/	REG_RATE_MCS4_OFDM_BIT,		/**< */
+/*	19	*/	REG_RATE_MCS5_OFDM_BIT,		/**< */
+/*	20	*/	REG_RATE_MCS6_OFDM_BIT,		/**< */
+/*	21	*/	REG_RATE_MCS7_OFDM_BIT		/**< */
+
+} ERegistryTxRate;
+
+/** \enum EFailureEvent
+ * \brief Failure Event
+ * 
+ * \par Description
+ * Used as a parameter for Failure Event CB - 
+ * Inicates Failure Event ID, according which the Failure 
+ * Event's data is driven
+ * 
+ * \sa TWD_RegisterOwnCb, TFailureEventCb
+ */
+typedef enum
+{
+/*	-1	*/	NO_FAILURE = -1,				/**< 	No Failure Event					*/
+/*	0	*/	NO_SCAN_COMPLETE_FAILURE = 0,	/**< 	No Scan Complete Failure Event		*/
+/*	1	*/	MBOX_FAILURE,					/**< 	Mail Box Failure Event				*/
+/*	2	*/	HW_AWAKE_FAILURE,				/**< 	HW Awake Failure Event				*/
+/*	3	*/	TX_STUCK,						/**< 	TX STUCK Failure Event				*/
+/*	4	*/	DISCONNECT_TIMEOUT,				/**< 	Disconnect Timeout Failure Event	*/
+/*	5	*/	POWER_SAVE_FAILURE,				/**< 	Power Save Failure Event			*/
+/*	6	*/	MEASUREMENT_FAILURE,			/**< 	Measurement Failure Event			*/
+/*	7	*/	BUS_FAILURE,					/**< 	Bus Failure Event					*/
+/*	8	*/	HW_WD_EXPIRE,					/**< 	HW Watchdog Expire Event			*/
+
+/* must be last!!! */
+/*	9	*/	MAX_FAILURE_EVENTS				/**< 	Maximum number of Failure Events	*/
+
+} EFailureEvent;
+
+/** \enum ETemplateType
+ * \brief Template Type
+ * 
+ * \par Description
+ * Used for setting/Getting a Template to/from FW
+ * 
+ * \sa TWD_CmdTemplate, TWD_WriteMibTemplateFrame, TSetTemplate TWD_GetTemplate
+ */
+typedef enum
+{
+/*	0	*/	NULL_DATA_TEMPLATE = 0,		/**< NULL Data Template						*/
+/*	1	*/	BEACON_TEMPLATE,        	/**< Beacon Template						*/
+/*	2	*/	PROBE_REQUEST_TEMPLATE,     /**< PROBE Request Template					*/
+/*	3	*/	PROBE_RESPONSE_TEMPLATE,	/**< PROBE Response Template				*/
+/*	4	*/	QOS_NULL_DATA_TEMPLATE,		/**< Quality Of Service NULL Data Template	*/
+/*	5	*/	PS_POLL_TEMPLATE,			/**< Power Save Poll Template				*/
+/*	6	*/	KEEP_ALIVE_TEMPLATE,		/**< Keep Alive Template 					*/
+/*	7	*/	DISCONN_TEMPLATE			/**< Disconn (Deauth/Disassoc) Template		*/
+} ETemplateType;
+
+
+
+
+typedef enum
+{
+    KEY_WEP_DEFAULT       = 0,
+    KEY_WEP_ADDR          = 1,
+    KEY_AES_GROUP         = 4,
+    KEY_AES_PAIRWISE      = 5,
+    KEY_WEP_GROUP         = 6,
+    KEY_TKIP_MIC_GROUP    = 10,
+    KEY_TKIP_MIC_PAIRWISE = 11
+} KeyType_enum;
+
+
+/** \enum ECipherSuite
+ * \brief CHIPHER Suite
+ * 
+ * \par Description
+ * Available cipher suites for admission control
+ * 
+ * \sa 
+ */
+typedef enum
+{
+/*	0	*/	TWD_CIPHER_NONE = 0,			/**< no cipher suite 		*/
+/*	1	*/	TWD_CIPHER_WEP,        			/**< WEP-40 cipher suite 	*/
+/*	2	*/	TWD_CIPHER_TKIP,        		/**< TKIP cipher suite      */
+/*	3	*/	TWD_CIPHER_AES_WRAP,    		/**< AES WRAP cipher suite  */
+/*	4	*/	TWD_CIPHER_AES_CCMP,    		/**< AES CCMP cipher suite  */
+/*	5	*/	TWD_CIPHER_WEP104,      		/**< WEP-104 cipher suite 	*/
+/*	6	*/	TWD_CIPHER_CKIP,        		/**< CKIP cipher suite      */
+#ifdef GEM_SUPPORT
+    /*	7	*/	TWD_CIPHER_GEM,         		/**< GEM cipher suite       */
+#endif
+            TWD_CIPHER_MAX,         		
+
+			TWD_CIPHER_UNKNOWN	= 255       /**< UNKNOWN chpiher suite 	*/
+
+} ECipherSuite;
+
+/** \enum E80211PsMode
+ * \brief 802.11 Power Save Mode
+ * 
+ * \par Description
+ * 
+ * \sa TWD_Scan, TWD_SetPsMode
+ */
+typedef enum 
+{
+/*	0	*/	POWER_SAVE_OFF = 0,		/**< 	power save 802.11 OFF   		*/
+/*	1	*/	POWER_SAVE_ON,			/**< 	power save 802.11 ON  			*/    
+/*	2	*/	POWER_SAVE_KEEP_CURRENT	/**< 	power save 802.11 don't change 	*/
+
+} E80211PsMode;
+
+/** \enum E80211PsStatus
+ * \brief Set Power Save mode status
+ * 
+ * \par Description
+ * 
+ * \sa 
+ */
+typedef enum
+{
+/*	1	*/	POWER_SAVE_802_11_SUCCESS = 1,	/**< 	power save mode Success   	*/
+/*	2	*/	POWER_SAVE_802_11_FAIL,			/**< 	power save mode Fail    	*/
+/*	3	*/	POWER_SAVE_802_11_NOT_ALLOWED,	/**< 	power save mode Not Allowed	*/
+/*	4	*/	POWER_SAVE_802_11_PENDING,		/**< 	power save mode Pending    	*/
+/*	5	*/	POWER_SAVE_802_11_IS_CURRENT	/**< 	power save mode Is Current 	*/
+
+} E80211PsStatus;
+
+/** \enum EElpCtrlMode
+ * \brief ELP Control Mode
+ * 
+ * \par Description
+ * 
+ * \sa 
+ */
+typedef enum 
+{
+/*	0	*/	ELPCTRL_MODE_NORMAL = 0,	/**< ALP Control mode Normal   		*/
+/*	1	*/	ELPCTRL_MODE_KEEP_AWAKE		/**< ALP Control mode Keep Awake   	*/
+
+} EElpCtrlMode;
+
+/** \enum EPreamble
+ * \brief Preamble Type
+ * 
+ * \par Description
+ * 
+ * \sa TWD_CfgPreamble
+ */
+typedef enum
+{
+    PREAMBLE_LONG       	= 0,	/**< Preamble type Long   			*/
+    PREAMBLE_SHORT          = 1,	/**< Preamble type Short   			*/
+
+    PREAMBLE_UNSPECIFIED    = 0xFF	/**< Preamble type Not Specified   	*/
+
+} EPreamble;
+
+/** \enum ENoiseHistogramCmd
+ * \brief Noise Histogram Type
+ * 
+ * \par Description
+ * 
+ * \sa TNoiseHistogram, TWD_CmdNoiseHistogram
+ */
+typedef enum
+{
+     STOP_NOISE_HIST                    = 0,	/**< Stop Noise Histogram	*/
+     START_NOISE_HIST                   = 1		/**< Start Noise Histogram	*/
+
+} ENoiseHistogramCmd;
+
+/** \enum ETnetWakeOn
+ * \brief ACX Wake Up Condition
+ * 
+ * \par Description
+ * 
+ * \sa TPowerMgmtConfig, TWD_CfgWakeUpCondition
+ */
+typedef enum 
+{
+    
+/*	0	*/	TNET_WAKE_ON_BEACON = 0,       	/**< Indicate the wake on event of the HW - beacon.
+											* In this event the HW configure to be awake on every beacon.
+											*/
+
+/*	1	*/	TNET_WAKE_ON_DTIM,             /**< Indicate the wake on event of the HW - DTIM. In this event
+											* the HW configure to be awake on every DITM (configure by the AP).
+											*/
+
+/*	2	*/	TNET_WAKE_ON_N_BEACON,          /**< Indicate the wake on event of the HW - listen interval.
+											* In this event the HW configure to be awake on every
+											* configured number of beacons.
+											*/
+
+/*	3	*/	TNET_WAKE_ON_N_DTIM,            /**< Indicate the wake on event of the HW - listen interval.
+											* In this event the HW configure to be awake on every
+											* configured number of beacons.
+											*/
+
+/*	4	*/	TNET_WAKE_ON_HOST              /**< Indicate the wake on event of the HW - Host access only
+											*/
+                                
+} ETnetWakeOn;
+
+/** \enum ETxAntenna
+ * \brief TX Antenna Types
+ * 
+ * \par Description
+ * 
+ * \sa TGeneralInitParams, TTwdParamContents
+ */
+typedef enum
+{
+    TX_ANTENNA_2	= 0, 	/**< */   
+    TX_ANTENNA_1    = 1		/**< */
+
+} ETxAntenna;
+
+/** \enum ERxAntenna
+ * \brief RX Antenna Types
+ * 
+ * \par Description
+ * 
+ * \sa TGeneralInitParams, TTwdParamContents
+ */
+typedef enum
+{
+/*	0	*/	RX_ANTENNA_1 = 0,	/**< */
+/*	1	*/	RX_ANTENNA_2,		/**< */
+/*	2	*/	RX_ANTENNA_FULL,	/**< */
+/*	3	*/	RX_ANTENNA_PARTIAL	/**< */
+
+} ERxAntenna;
+
+/** \enum EPowerPolicy
+ * \brief Save Power Level Policy
+ * 
+ * \par Description
+ * 
+ * \sa TWD_CfgSleepAuth
+ */
+typedef enum 
+{
+/*	0	*/	POWERAUTHO_POLICY_ELP = 0,	/**< */
+/*	1	*/	POWERAUTHO_POLICY_PD,		/**< */
+/*	2	*/	POWERAUTHO_POLICY_AWAKE,	/**< */
+/*	3	*/	POWERAUTHO_POLICY_NUM		/**< */
+
+} EPowerPolicy;
+
+/** \enum ESoftGeminiEnableModes
+ * \brief Soft-Gemini Enable Modes
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{
+/*	0	*/	SG_DISABLE = 0,			/**< */
+/*	1	*/	SG_PROTECTIVE,			    /**< */
+/*	2	*/	SG_OPPORTUNISTIC,	/**< */
+
+
+} ESoftGeminiEnableModes;
+/** \enum ESoftGeminiEnableProfile
+ * \brief Soft-Gemini Profile Modes for Symbian configuration
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{
+    BtCoexProfData = 0,
+    BtCoexProfDataLowLatency,
+    BtCoexProfA2DP
+}ESoftGeminiEnableProfile;
+
+
+/** \enum EMibTemplateType
+ * \brief MIB Template type
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{                                       	
+/*	0	*/ 	TEMPLATE_TYPE_BEACON = 0,           /**< 	BEACON template 			*/
+/*	1	*/  TEMPLATE_TYPE_PROBE_REQUEST,        /**< 	PROB template 				*/
+/*	2	*/  TEMPLATE_TYPE_NULL_FRAME,           /**< 	NULL FRAM template 			*/
+/*	3	*/  TEMPLATE_TYPE_PROBE_RESPONSE,       /**< 	PROB Response template 		*/
+/*	4	*/  TEMPLATE_TYPE_QOS_NULL_FRAME,       /**< 	QOS Null Frame template 	*/
+/*	5	*/  TEMPLATE_TYPE_PS_POLL               /**< 	Power Save Poll template	*/
+
+} EMibTemplateType;
+
+
+/** \enum ERxFailure
+ * \brief RX Failure/Error
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{
+/*	0	*/	RX_FAILURE_NONE = 0,		/**< No Failure		*/
+/*	1	*/	RX_FAILURE_DECRYPT,         /**< DeCrypt Failure	*/
+/*	2	*/	RX_FAILURE_MIC_ERROR,		/**< MIC Error		*/
+} ERxFailure;
+
+/** \enum ETwdChannelWidth
+ * \brief TWD Channel Width
+ * 
+ * \par Description
+ * Used for Configure HT Capabilities Settings
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{   
+/*	0	*/	CHANNEL_WIDTH_20MHZ = 0,		/**< 20MHZ Channel Width	*/
+/*	1	*/  CHANNEL_WIDTH_40MHZ_20MHZ		/**< 40-20MHZ Channel Width	*/
+} ETwdChannelWidth;
+
+/** \enum ETwdRxSTBC
+ * \brief RX STBC Spatial Stream Supported
+ * 
+ * \par Description
+ * Indicates how many RX STBC Spatial Stream are Supported
+ * Used for Configure HT Capabilities Settings
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{   
+/*	0	*/	RXSTBC_NOT_SUPPORTED  =   0,							/**< No Spatial Stream Supported					*/
+/*	1	*/  RXSTBC_SUPPORTED_ONE_SPATIAL_STREAM, 					/**< One Spatial Stream Supported					*/
+/*	2	*/  RXSTBC_SUPPORTED_ONE_AND_TWO_SPATIAL_STREAMS,			/**< One and Two Spatial Stream Supported			*/
+/*	3	*/  RXSTBC_SUPPORTED_ONE_TWO_AND_THREE_SPATIAL_STREAMS	/**< One, Two and Three Spatial Stream Supported	*/
+
+} ETwdRxSTBC;
+
+/** \enum ETwdMaxAMSDU
+ * \brief Maximum MSDU Octets
+ * 
+ * \par Description
+ * Used for Configure HT Capabilities Settings
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{   
+/*	0	*/	MAX_MSDU_3839_OCTETS = 0,	/**< Maximum MSDU Octets Number: 3839	*/
+/*	1	*/  MAX_MSDU_7935_OCTETS		/**< Maximum MSDU Octets Number: 7935	*/
+
+} ETwdMaxAMSDU;
+
+/** \enum ETwdMaxAMPDU
+ * \brief Maximum MPDU Octets
+ * 
+ * \par Description
+ * Indicates What is the Maximum MPDU Octets Number
+ * Used for Configure HT Capabilities Settings
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{   
+/*	0	*/	MAX_MPDU_8191_OCTETS = 0,	/**< Maximum MPDU Octets Number: 8191	*/
+/*	1	*/  MAX_MPDU_16383_OCTETS,		/**< Maximum MPDU Octets Number: 16383	*/
+/*	2	*/  MAX_MPDU_32767_OCTETS,		/**< Maximum MPDU Octets Number: 32767	*/
+/*	3	*/  MAX_MPDU_65535_OCTETS		/**< Maximum MPDU Octets Number: 65535	*/
+
+} ETwdMaxAMPDU;
+
+/** \enum ETwdAMPDUSpacing
+ * \brief TWD AMPDU Spacing
+ * 
+ * \par Description
+ * Indicates What is the Time Spacing of AMPDU
+ * Used for Configure HT Capabilities Settings
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{   
+/*	0	*/	AMPDU_SPC_NO_RESTRCITION =  0,	/**< No Restriction on AMPDU Time Spacing	*/ 	    
+/*	1	*/	AMPDU_SPC_1_4_MICROSECONDS, 	/**< 1/4 Microsecond AMPDU Time Spacing   	*/
+/*	2	*/	AMPDU_SPC_1_2_MICROSECONDS, 	/**< 1/2 Microsecond AMPDU Time Spacing   	*/
+/*	3	*/	AMPDU_SPC_1_MICROSECOND,  		/**< 1 Microsecond AMPDU Time Spacing   	*/
+/*	4	*/	AMPDU_SPC_2_MICROSECONDS,		/**< 2 Microsecond AMPDU Time Spacing   	*/
+/*	5	*/	AMPDU_SPC_4_MICROSECONDS,		/**< 4 Microsecond AMPDU Time Spacing   	*/
+/*	6	*/	AMPDU_SPC_8_MICROSECONDS,		/**< 8 Microsecond AMPDU Time Spacing   	*/
+/*	7	*/	AMPDU_SPC_16_MICROSECONDS 		/**< 16 Microsecond AMPDU Time Spacing   	*/
+
+} ETwdAMPDUSpacing;
+
+/** \enum ETwdMcsSupport
+ * \brief TWD MCS Support
+ * 
+ * \par Description
+ * BIT Mapp which Indicates What is the Tx/rx MCS Support Enabled
+ * Used for Configure HT Capabilities Settings
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{   
+/*	1	*/	MCS_SUPPORT_MCS_0   =  BIT_0,	/**< BIT 0	*/
+/*	2	*/	MCS_SUPPORT_MCS_1   =  BIT_1,	/**< BIT 1	*/
+/*	3	*/	MCS_SUPPORT_MCS_2   =  BIT_2,	/**< BIT 2	*/
+/*	4	*/	MCS_SUPPORT_MCS_3   =  BIT_3,	/**< BIT 3	*/
+/*	5	*/	MCS_SUPPORT_MCS_4   =  BIT_4,	/**< BIT 4	*/
+/*	6	*/	MCS_SUPPORT_MCS_5   =  BIT_5,	/**< BIT 5	*/
+/*	7	*/	MCS_SUPPORT_MCS_6   =  BIT_6,	/**< BIT 6	*/
+/*	8	*/	MCS_SUPPORT_MCS_7   =  BIT_7	/**< BIT 7	*/
+
+} ETwdMcsSupport;
+
+/** \enum ETwdPCOTransTime
+ * \brief TWD PCO Transition Time
+ * 
+ * \par Description
+ * Indicates What is the PCO Transition Time
+ * Used for Configure HT Capabilities Settings
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{   
+/*	0	*/	PCO_TRANS_TIME_NO_TRANSITION = 0, 	/**< No PCO Transition Time					*/    
+/*	1	*/	PCO_TRANS_TIME_400_MICROSECONDS, 	/**< PCO Transition Time: 400 Microsecond	*/
+/*	2	*/	PCO_TRANS_TIME_1_5_MILLISECONDS, 	/**< PCO Transition Time: 1.5 Millisecond	*/
+/*	3	*/	PCO_TRANS_TIME_5_MILLISECONDS		/**< PCO Transition Time: 5 Millisecond		*/
+
+} ETwdPCOTransTime;
+
+/** \enum ETwdHTCapabilitiesBitMask
+ * \brief TWD HT Capabilities Bit Mask Mapping
+ * 
+ * \par Description
+ * Mapps the Bit Mask which are used for Making (Enabling/Disabling) 
+ * HT Capabilities 
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{
+/*	1	*/	CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT           =  BIT_0,	/**< BIT 0	*/
+/*	2	*/	CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS        =  BIT_1,	/**< BIT 1	*/
+/*	3	*/	CAP_BIT_MASK_SHORT_GI_FOR_40MHZ_PACKETS        =  BIT_2,	/**< BIT 2	*/
+/*	4	*/	CAP_BIT_MASK_SUPPORT_FOR_STBC_IN_TRANSMISSION  =  BIT_3,	/**< BIT 3	*/
+/*	5	*/	CAP_BIT_MASK_DELAYED_BLOCK_ACK                 =  BIT_4,	/**< BIT 4	*/
+/*	6	*/	CAP_BIT_MASK_DSSS_CCK_IN_40_MHZ                =  BIT_5,	/**< BIT 5	*/
+/*	7	*/	CAP_BIT_MASK_LSIG_TXOP_PROTECTION              =  BIT_6,	/**< BIT 6	*/
+/*	8	*/	CAP_BIT_MASK_PCO                               =  BIT_7,	/**< BIT 7	*/
+/*	9	*/	CAP_BIT_MASK_LDPC_CODING                       =  BIT_8		/**< BIT 8	*/
+
+} ETwdHTCapabilitiesBitMask;
+
+/** \enum ETwdMCSFeedback
+ * \brief TWD MCS FeedBack
+ * 
+ * \par Description
+ * Indicates what is the MCS FeedBack Policy 
+ * Used for Configure HT Capabilities Settings
+ * 
+ * \sa TWD_SetDefaults, TTwdHtCapabilities
+ */
+typedef enum
+{   
+/*	0	*/	MCS_FEEDBACK_NO = 0,						/**< */
+/*	1	*/	MCS_FEEDBACK_RESERVED,						/**< */
+/*	2	*/	MCS_FEEDBACK_UNSOLICTED_ONLY,				/**< */
+/*	3	*/	MCS_FEEDBACK_BOTH_SOLICTED_AND_UNSOLICTED	/**< */
+} ETwdMCSFeedback;
+
+/** \enum ETwdTxMcsSet
+ * \brief TWD TX MCS Set
+ * 
+ * \par Description
+ * Indicates Whether to set Tx MCS
+ * 
+ * \sa
+ */
+typedef enum
+{   
+    TX_MCS_SET_NO   =   0, 	/**< Don't Set Tx MCS	*/ 
+    TX_MCS_SET_YES  =   1	/**< Set Tx MCS			*/
+} ETwdTxMcsSet;
+
+/** \enum ETwdTxRxNotEqual
+ * \brief TWD TX RX Not Equal
+ * 
+ * \par Description
+ * Indicates Whether the TX and RX channels are equal
+ * 
+ * \sa
+ */
+typedef enum
+{   
+    TX_RX_NOT_EQUAL_NO   =   0,	/**< TX and RX Channels are not equal	*/ 
+    TX_RX_NOT_EQUAL_YES  =   1	/**< TX and RX Channels are equal		*/ 
+} ETwdTxRxNotEqual;
+
+/** \enum ETwdHtcSupport
+ * \brief TWD HTc Support
+ * 
+ * \par Description
+ * Indicates Whether the HT Capability is Supported
+ * 
+ * \sa
+ */
+typedef enum
+{   
+    HTC_SUPPORT_NO   =   0,	/**< HT Capability is not Supported		*/ 
+    HTC_SUPPORT_YES  =   1	/**< HT Capability is Supported			*/ 
+} ETwdHtcSupport;
+
+/** \enum ESendCompleteStatus
+ * \brief Send complete status
+ * 
+ * \par Description
+ * Indicates the current Success/Failure Status of Completion of Send Operation
+ * 
+ * \sa
+ */
+typedef enum
+{
+/*	0	*/	SEND_COMPLETE_SUCCESS = 0,			/**< Send Complete Success: Completion of Send Operation is OK					
+												*/
+/*	1	*/	SEND_COMPLETE_RETRY_EXCEEDED,		/**< Send Complete Retry Exceeded: 
+												* Completion of Send Operation filed because it Exceeded Allowed retries Number	
+												*/
+/*	2	*/	SEND_COMPLETE_LIFETIME_EXCEEDED,	/**< Send Complete Lifetiem Exceeded: 
+												* Completion of Send Operation failed because it Exceeded Allowed Lifetime	
+												*/
+/*	3	*/	SEND_COMPLETE_NO_LINK,				/**< Send Complete No Link: 
+												* Completion of Send Operation failed because No Link was found  					
+												*/
+/*	4	*/	SEND_COMPLETE_MAC_CRASHED			/**< Send Complete MAC Crashed: 
+												* Completion of Send Operation failed because MAC Crashed							
+												*/
+} ESendCompleteStatus;
+
+/** \enum EPacketType
+ * \brief Packet type
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum 
+{ 
+/*	0	*/	PACKET_DATA = 0, 	/**< */
+/*	1	*/	PACKET_CTRL, 		/**< */
+/*	2	*/	PACKET_MGMT 		/**< */
+
+} EPacketType;
+
+/** \enum ETxHwQueStatus
+ * \brief Status returned by txHwQueue_AllocResources 
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{   
+    TX_HW_QUE_STATUS_SUCCESS,       /* Resources available on current queue */
+    TX_HW_QUE_STATUS_STOP_CURRENT,  /* No resources, stop current queue and requeue the packet */
+    TX_HW_QUE_STATUS_STOP_NEXT      /* Resources available for this packet but not for another one, 
+                                          so just stop the current queue */
+} ETxHwQueStatus;
+
+/** \enum ERxBufferStatus
+ * \brief Status returned by TRequestForBufferCb 
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{   
+    RX_BUF_ALLOC_PENDING,
+    RX_BUF_ALLOC_COMPLETE,
+    RX_BUF_ALLOC_OUT_OF_MEM
+
+}ERxBufferStatus;
+
+
+/*
+ * --------------------------------------------------------------
+ *	Structures
+ * --------------------------------------------------------------
+ */
+/**
+ * \brief Get File Callback
+ * 
+ * \param  hCbHndl	- Handle to CB Object
+ * \return void 
+ * 
+ * \par Description
+ * The callback function type for GetFile users
+ * 
+ * \sa 	TFileInfo
+ */ 
+typedef void (*TGetFileCbFunc)(TI_HANDLE hCbHndl);
+
+/** \struct TFileInfo
+ * \brief File Information
+ * 
+ * \par Description
+ * Contains all needed information and structures for Getting file
+ * 
+ * \sa	TWD_InitFw
+ */ 
+typedef struct
+{
+    EFileType   	eFileType;  		/**< Requested file type */
+    TI_UINT8   		*pBuffer;    		/**< Pointer to Buffer into the file (or file portion) is copied from user space */
+    TI_UINT32   	uLength;    		/**< Length of data currently held in pBuffer */
+    TI_UINT32   	uOffset;    		/**< Offset in File of data currently held in pBuffer */
+    TI_UINT32   	uAddress;    		/**< Offset in File of data currently held in pBuffer */
+    TI_BOOL     	bLast;      		/**< TRUE indicates that we reached end of file */
+    void       		*hOsFileDesc;		/**< OAL file-descriptor handle for repeated access to same file (FW) */
+    TGetFileCbFunc  fCbFunc;			/**< CB function to call if file read is finished in a later context (future option) */
+    TI_HANDLE       hCbHndl;			/**< Handle to provide when calling fCbFunc */
+    TI_UINT32		uChunksLeft;		/**< Chunks Left to read from File (used if file is read in chunks) */
+    TI_UINT32		uChunkBytesLeft;	/**< Number of bytes of Last read chunk, which were not yet handled  */
+    TI_UINT32		uCrcCalc;			/**< Current Calculated CRC  */
+} TFileInfo;
+
+/** \struct T80211Header
+ * \brief 802.11 MAC header
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT16                           fc;			/**< */
+    TI_UINT16                           dur;		/**< */
+    TMacAddr                            address1;	/**< */
+    TMacAddr                            address2;	/**< */
+    TMacAddr                            address3;	/**< */
+    TI_UINT16                           seq;		/**< */
+    TI_UINT16                           qos;		/**< */
+
+}  T80211Header;
+
+/** \struct TKeepAliveParams
+ * \brief Keep Alive Parameters
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_CfgKeepAlive
+ */ 
+typedef struct
+{
+    TI_UINT8                index;		/**< */
+    TI_UINT8                enaDisFlag;	/**< */
+    TI_UINT32               interval;	/**< */
+    EKeepAliveTriggerType   trigType;	/**< */
+
+} TKeepAliveParams;
+
+/** \struct TPsRxStreaming
+ * \brief Power Save RX Streaming
+ * 
+ * \par Description
+ * The configuration of Rx streaming delivery in PS mode per TID
+ * 
+ * \sa	TWD_CfgKeepAlive
+ */ 
+typedef struct
+{
+    TI_UINT32               uTid;           /**< The configured TID (0-7) */
+    TI_UINT32               uStreamPeriod;  /**< The expected period between two packets of the delivered stream */
+    TI_UINT32               uTxTimeout;     /**< Start sending triggers if no Tx traffic triggers arrive for this priod */
+    TI_BOOL                 bEnabled;       /**< If TRUE enable this TID streaming, if FALSE disable it. */
+
+} TPsRxStreaming;
+
+/** \struct TDmaParams
+ * \brief DMA Parameters
+ * 
+ * \par Description
+ * Struct which holds DMA Rx/Tx Queues and Bufffers params
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT32                           NumRxBlocks;				/**< Allocated RX memory blocks number 	    */
+    TI_UINT32                           NumTxBlocks;				/**< Allocated TX memory blocks number      */
+    TI_UINT8                            NumStations;				/**< Number of Stations						*/
+    void                                *fwTxResultInterface;		/**< RX minimum Memory block number 		*/
+    TI_UINT8                            *fwRxCBufPtr;				/**< Pointer to FW RX Control Buffer		*/
+    TI_UINT8                            *fwTxCBufPtr;				/**< Pointer to FW TX Control Buffer		*/
+	void                                *fwRxControlPtr;			/**< Pointer to FW TX Control 				*/
+	void                                *fwTxControlPtr;			/**< Pointer to FW RX Control 				*/
+    TI_UINT32                           PacketMemoryPoolStart;      /**< RX Memory block offset 				*/  
+} TDmaParams;
+
+/** \struct TSecurityKeys
+ * \brief Security Key
+ * 
+ * \par Description
+ * Struct which holds Security Key Parameters
+ * Used for handling DMA
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    EKeyType                            keyType; 				/**< Security Key Type (WEP, TKIP etc.)			*/               
+    TI_UINT32                           encLen;					/**< Security Key length in bytes				*/
+    TI_UINT8                            encKey[MAX_KEY_LEN];	/**< Security Key Encoding						*/
+    TI_UINT8                            micRxKey[MAX_KEY_LEN];	/**< MIC RX Security Key 						*/
+    TI_UINT8                            micTxKey[MAX_KEY_LEN];	/**< MIC TX Security Key						*/
+    TI_UINT32                           keyIndex;     			/**< Security Key Index (id=0 is broadcast key)	*/                  
+    TMacAddr                            macAddress;				/**< Security Key MAC Address					*/
+    TI_UINT8                            keyRsc[KEY_RSC_LEN];	/**< Security Key RSC							*/
+
+} TSecurityKeys;
+
+/** \struct TxPktParams_t
+ * \brief TX Packet Parameters
+ * 
+ * \par Description
+ * Tx Control-Block Packet parameters that are not included in the Tx-descriptor
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    void *         pInputPkt;       /**< The input packet to the Tx path, either OS packet or raw buffer (see RAW_BUF_PKT flag) */         
+    TI_UINT32      uInputPktLen;    /**< The input packet length in bytes (for freeing it in case of raw buffer)  */         
+    TI_UINT32      uDriverDelay;    /**< The time in uSec the pkt was delayed in the driver until Xfer 			  */
+    TI_UINT8       uPktType;        /**< See TX_PKT_TYPE_xxxx above                                               */          
+    TI_UINT8       uHeadroomSize;   /**< Only for WHA - headroom in bytes before the payload in the packet buffer */          
+    TI_UINT16      uFlags;          /**< See TX_CTRL_FLAG__xxxx above 										      */          
+
+} TTxPktParams;
+
+
+/** \struct TTxCtrlBlk
+ * \brief TX Control Block Entry
+ * 
+ * \par Description
+ * Contains the Tx packet parameters required for the Tx process, including
+ * the Tx descriptor and the attributes required for HW-queue calculations.
+ * TX Control Block Entry is allocated for each packet sent from the upper 
+ * driver and freed upon Tx-complete.
+ * The entry index is the descriptor-ID. It is written in the descriptor and 
+ * copied back into the tx-complete results
+ * 
+ * \sa	SendPacketTranferCB_t, SendPacketDebugCB_t, TWD_txCtrlBlk_alloc, TWD_txCtrlBlk_free, TWD_txCtrlBlk_GetPointer, TWD_txXfer_sendPacket
+ */ 
+typedef struct _TTxCtrlBlk
+{
+    TTxnStruct          tTxnStruct;               /**< The transaction structure for packet queueing and transaction via the bus driver */ 
+    TxIfDescriptor_t    tTxDescriptor;            /**< The packet descriptor copied to the FW  */    
+    TI_UINT8            aPktHdr[MAX_HEADER_SIZE]; /**< The packet header + extensions (see description of MAX_HEADER_SIZE above) */    
+    TTxPktParams        tTxPktParams;             /**< Per packet parameters not included in the descriptor */
+    struct _TTxCtrlBlk  *pNextFreeEntry;          /**< Pointer to the next free entry */ 
+
+} TTxCtrlBlk;
+
+
+/** \struct TTemplateParams
+ * \brief Template Parameters
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_GetTemplate
+ */ 
+typedef struct
+{
+    TI_UINT32            Size;		   				/**< Template size					*/  			
+    TI_UINT32            uRateMask;                 /**< The rates bitmap for the frame */ 			
+    TI_UINT8             Buffer[MAX_TEMPLATE_SIZE];	/**< Buffer which holds Template	*/  			
+
+} TTemplateParams;
+
+/** \struct TFwInfo
+ * \brief FW Information
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_GetFWInfo
+ */ 
+typedef struct
+{
+    TI_UINT8                            fwVer[FW_VERSION_LEN];  /**< Firmware version - null terminated string 	*/
+    TMacAddr                            macAddress;				/**< MAC Address								*/
+    TI_UINT8                            txPowerTable[NUMBER_OF_SUB_BANDS_E][NUM_OF_POWER_LEVEL]; /**< Maximun Dbm in Dbm/10 units */
+    TI_UINT32                           uHardWareVersion;		/**< HW Version									*/
+
+} TFwInfo;  
+
+/** \struct TJoinBss
+ * \brief Join BSS Parameters
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_CmdJoinBss
+ */ 
+typedef struct
+{
+    ScanBssType_e                       bssType;			/**< */
+    TI_UINT16                           beaconInterval;		/**< */
+    TI_UINT16                           dtimInterval;		/**< */
+    TI_UINT8                            channel;			/**< */
+    TI_UINT8*                           pBSSID;				/**< */
+    TI_UINT8*                           pSSID;				/**< */
+    TI_UINT8                            ssidLength;			/**< */
+    TI_UINT32                           basicRateSet;      	/**< */ 
+    ERadioBand                          radioBand;			/**< */
+    /* Current Tx-Session index as configured to FW in last Join command */
+    TI_UINT16                           txSessionCount;    	/**< */     
+
+} TJoinBss;
+
+/** \struct TSetTemplate
+ * \brief Set Template Parameters
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_CmdTemplate, TWD_WriteMibTemplateFrame
+ */ 
+typedef struct
+{
+    ETemplateType                       type;	/**< Template Type							*/
+    TI_UINT8                            index;  /**< only valid for keep-alive templates	*/
+    TI_UINT8*                           ptr;	/**< Pointer to Template Data		  		*/
+    TI_UINT32                           len;	/**< Pointer to Template Length		  		*/
+    ERadioBand                          eBand; 	/**< only valid for probe request templates	*/
+    TI_UINT32                           uRateMask;/**< The rate mask to use for this frame  */
+    
+} TSetTemplate;
+
+/** \struct TNoiseHistogram
+ * \brief Noise Histogram Parameters
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_CmdNoiseHistogram
+ */ 
+typedef struct
+{
+    ENoiseHistogramCmd                  cmd;												/**< Noise Histogram Command (Start/Atop)	*/
+    TI_UINT16                           sampleInterval;										/**< Sample Interval (in microsec)			*/
+    TI_UINT8                            ranges [MEASUREMENT_NOISE_HISTOGRAM_NUM_OF_RANGES];	/**< Noise Histogram Ranges					*/
+
+} TNoiseHistogram;
+
+/** \struct TInterogateCmdHdr
+ * \brief Interrogate Command Header
+ * 
+ * \par Description
+ * 
+ * \sa	TNoiseHistogramResults, TMediumOccupancy, TTsfDtim
+ */ 
+typedef struct
+{
+    TI_UINT16                           id;		/**< */
+    TI_UINT16                           len;	/**< */
+
+} TInterogateCmdHdr;
+
+/** \struct TNoiseHistogramResults
+ * \brief Noise Histogram Results
+ * 
+ * \par Description
+ * Used for Getting Noise Histogram Parameters from FW
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TInterogateCmdHdr                   noiseHistResCmdHdr;							/**< Results Header						*/
+    TI_UINT32                           counters[NUM_OF_NOISE_HISTOGRAM_COUNTERS];	/**< Counters							*/
+    TI_UINT32                           numOfLostCycles;							/**< Number of Lost Cycles				*/
+    TI_UINT32                           numOfTxHwGenLostCycles;						/**< Number of Tx Hw Gen Lost Cycles	*/
+    TI_UINT32                           numOfRxLostCycles;							/**< Number of RX Hw Gen Lost Cycles	*/
+
+} TNoiseHistogramResults;
+
+/** \struct TMediumOccupancy
+ * \brief Medium Occupancy Parameters
+ * 
+ * \par Description
+ * Used for Getting Medium Occupancy (Channal Load) from FW
+ * or print Medium Occupancy (Channal Load) Debug Information
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TInterogateCmdHdr                   mediumOccupCmdHdr;	/**< Command Header						*/
+    TI_UINT32                           MediumUsage;		/**< Medium Occupancy Usage Time		*/
+    TI_UINT32                           Period;				/**< Medium Occupancy Period Time		*/
+
+} TMediumOccupancy;
+
+/** \struct TTsfDtim
+ * \brief Beacon TSF and DTIM count
+ * 
+ * \par Description
+ * Used for Getting updated current TSF and last Beacon TSF and DTIM Count from FW
+ * for Scan Purposes
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TInterogateCmdHdr                   tsf_dtim_mibCmdHdr;	/**< Command Header						*/
+    TI_UINT32                           CurrentTSFHigh;		/**< Current TSF High (of INT64) Value	*/
+    TI_UINT32                           CurrentTSFLow;		/**< Current TSF Low (of INT64) Value	*/
+    TI_UINT32                           lastTBTTHigh;		/**< Last TBTT High (of INT64) Value	*/
+    TI_UINT32                           lastTBTTLow;		/**< Last TBTT Low (of INT64) Value		*/
+    TI_UINT8                            LastDTIMCount;		/**< Last DTIM Count			      	*/
+    TI_UINT8                            Reserved[3];		/**< Reserved							*/
+
+} TTsfDtim;
+
+/** \struct TBcnBrcOptions
+ * \brief Beacon broadcast options
+ * 
+ * \par Description
+ * Used for Getting/Configuring updated Beacon broadcast options from/to FW
+ * 
+ * \sa	TWD_SetDefaults
+ */ 
+typedef struct 
+{
+    TI_UINT16                           BeaconRxTimeout;		/**< Beacon RX Timeout			*/
+    TI_UINT16                           BroadcastRxTimeout;		/**< Broadcast RX Timeout		*/
+    TI_UINT8                            RxBroadcastInPs;		/**< RX Broadcast In Power Save	*/
+
+} TBcnBrcOptions;
+
+/** \struct TBeaconFilterIeTable
+ * \brief Beacon Filter Information Elements Table
+ * 
+ * \par Description
+ * Used for Getting/Configuring Beacon Filter IE Table From/To FW
+ * 
+ * \sa	TWD_SetDefaults
+ */ 
+typedef struct
+{
+    TI_UINT8                            numberOfIEs;							/**< Number of IE Tables 			*/
+    TI_UINT8                            IETable[BEACON_FILTER_TABLE_MAX_SIZE];	/**< The IE table					*/
+    TI_UINT8                            IETableSize;							/**< number of elements in IE table	*/
+
+} TBeaconFilterIeTable;
+
+/** \struct TBeaconFilterInitParams
+ * \brief Beacon Filter Init Parameters
+ * 
+ * \par Description
+ * Used for Init Beacon Filter IE Table in FW
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT8                            desiredState;								/**< Desigred state (required/not required)			*/
+    TI_UINT8                            numOfStored;								/**< Number of desigred Beacon Filters stored in FW	*/
+    TI_UINT8                            numOfElements;								/**< Number of Beacon Filter Elements stored in FW	*/
+    TI_UINT8                            IETableSize;								/**< The IE Table size								*/
+    TI_UINT8                            reserve[3];									/**< Reserved										*/
+    TI_UINT8                            IETable[BEACON_FILTER_IE_TABLE_MAX_SIZE]; 	/**< The IE table							   		*/
+
+} TBeaconFilterInitParams;
+
+/** \struct TPowerMgmtConfig
+ * \brief Power Management Configuration Parameters
+ * 
+ * \par Description
+ * Used for Configuring Wake-Up Conditions or Beacon Broadcast Options to FW
+ * 
+ * \sa	TWD_CfgWakeUpCondition, TWD_CfgBcnBrcOptions
+ */ 
+typedef struct
+{
+	/* power management options */
+    TI_UINT8                            beaconListenInterval;		/**< Beacon Listen Interavl:
+																	* specify how often the TNET wakes up to listen to beacon frames. 
+																	* the value is expressed in units of "beacon interval"	
+																	*/
+    TI_UINT8                            beaconFiltering;			/**< Beacon Filtering Desigred state (required/not required)			*/
+    TI_UINT8                            DTIMListenInterval;			/**< DTIM Listen Interavl:
+																	* specify how often the TNET wakes up to listen to DTIM frames. the value 
+																	* is expressed in units of "dtim interval"
+																	*/
+    TI_UINT8                            NConsecutiveBeaconMiss;		/**< Consecutive Beacon Miss											*/
+    TI_UINT8                            hangoverPeriod;				/**< Hang Over Period													*/
+    TI_UINT8                            HwPsPollResponseTimeout;	/**< Power-Save Polling Response Time Out								*/
+    TI_UINT32                           BaseBandWakeUpTime;			/**< Base Band Wakeup Time												*/
+    TI_UINT32                           beaconReceiveTime;			/**< Beacon Receive Time												*/
+    TI_BOOL                             beaconMissInterruptEnable;	/**< Enable/Disable Beacon Miss Interrupt   							*/
+    TI_BOOL                             rxBroadcast;				/**< Enable/Disable receive of broadcast packets in Power-Save mode   	*/
+    TI_BOOL                             hwPsPoll;					/**< Enable/Disable Power-Save Polling								   	*/    
+    /* Power Management Configuration IE */
+    TI_BOOL                             ps802_11Enable;				/**< Enable/Disable 802.11 Power-Save 									*/
+    TI_UINT8                            needToSendNullData;  		/**< Indicates if need to send NULL data								*/
+    TI_UINT8                            numNullPktRetries; 			/**< Number of NULL Packets allowed retries 							*/
+    TI_UINT8                            hangOverPeriod;				/**< HangOver period:
+																	* Indicates what is the time in TUs during which the WiLink remains awake 
+																	* after sending an MPDU with the Power Save bit set (indicating that the 
+																	* station is to go into Power Save mode). Setting bit 0 does not affect 
+																	* the hangover period 
+																	*/
+    TI_UINT16                           NullPktRateModulation; 		/**< Null Packet Rate Modulation										*/
+    /* PMConfigStruct */
+    TI_BOOL                             ELPEnable;					/**< Enable/Disable ELP				 									*/
+    TI_UINT32                           BBWakeUpTime;				/**< Base Band Wakeup Time				 								*/
+    TI_UINT32                           PLLlockTime;				/**< PLL Lock Time						 								*/
+    /* AcxBcnBrcOptions */						
+    TBcnBrcOptions                      BcnBrcOptions;				/**< Beacon broadcast options	 		 								*/
+    /* ACXWakeUpCondition */
+    ETnetWakeOn                         tnetWakeupOn;  				/**< ACX Wake Up Condition		 		 								*/
+    TI_UINT8                            listenInterval;				/**< ACX Listen Interval		 		 								*/
+	/* No answer after Ps-Poll work-around */
+    TI_UINT8  							ConsecutivePsPollDeliveryFailureThreshold;	/**< Power-Save Polling Delivery Failure Threshold		*/
+
+} TPowerMgmtConfig;
+
+/** \struct TPowerSaveParams
+ * \brief Power Save Parameters 
+ * 
+ * \par Description 
+ * 
+ * \sa	TWD_CmdPSMode
+ */ 
+typedef struct
+{
+    /* powerMgmtConfig IE */
+    TI_BOOL                             ps802_11Enable;			/**< Enable/Disable 802.11 Power-Save 									*/
+    TI_UINT8                            needToSendNullData;  	/**< Indicates if need to send NULL data								*/
+    TI_UINT8                            numNullPktRetries; 		/**< Number of NULL Packets allowed retries 							*/
+    TI_UINT8                            hangOverPeriod;			/**< HangOver period:
+																* Indicates what is the time in TUs during which the WiLink remains awake 
+																* after sending an MPDU with the Power Save bit set (indicating that the 
+																* station is to go into Power Save mode). Setting bit 0 does not affect 
+																* the hangover period 
+																*/
+    EHwRateBitFiled                     NullPktRateModulation;	/**< Null Packet Rate Modulation										*/
+
+} TPowerSaveParams;
+
+/** \struct TAcQosParams
+ * \brief AC QoS Parameters 
+ * 
+ * \par Description 
+ * Used for Configuring AC Parameters (For Quality Of Service) to FW
+ * 
+ * \sa	TWD_CfgAcParams
+ */ 
+typedef struct  
+{
+    TI_UINT8                            ac;			/**< Access Category - The TX queue's access category	*/
+    TI_UINT8                            cwMin;		/**< The contention window minimum size (in slots) 		*/
+    TI_UINT16                           cwMax;		/**< The contention window maximum size (in slots)		*/
+    TI_UINT8                            aifsn;		/**< The AIF value (in slots)							*/
+    TI_UINT16                           txopLimit;	/**< The TX Op Limit (in microseconds)					*/
+
+} TAcQosParams;
+
+/** \struct TMeasurementParams
+ * \brief AC Queues Parameters 
+ * 
+ * \par Description 
+ * Used When Send Start Measurment Command to FW
+ * 
+ * \sa	TWD_CmdMeasurement
+ */ 
+typedef struct 
+{
+    TI_UINT32                           ConfigOptions;	/**< RX Filter Configuration Options													*/
+    TI_UINT32                           FilterOptions;	/**< RX Filter Options																	*/
+    TI_UINT32                           duration;		/**< Specifies the measurement process duration in microseconds. The value of 0 means 
+														* infinite duration in which only a STOP_MEASUREMENT command can stop the measurement 
+														* process
+														*/
+    Channel_e                           channel;		/**< Channel number on which the measurement is performed								*/
+    RadioBand_e                         band;			/**< Specifies the band to which the channel belongs									*/
+    EScanResultTag                      eTag;			/**< Scan Result Tag																	*/
+
+} TMeasurementParams;
+
+/** \struct TApDiscoveryParams
+ * \brief AP Discovery Parameters
+ * 
+ * \par Description 
+ * Used When Performing AP Discovery
+ * 
+ * \sa	TWD_CmdApDiscovery
+ */ 
+typedef struct 
+{
+    TI_UINT32                           ConfigOptions;	/**< RX Configuration Options for measurement														*/
+    TI_UINT32                           FilterOptions;	/**< RX Filter Configuration Options for measurement												*/
+    TI_UINT32                           scanDuration;	/**< This field specifies the amount of time, in time units (TUs), to perform the AP discovery		*/
+    TI_UINT16                           scanOptions;	/**< This field specifies whether the AP discovery is performed by an active scan or a passive scan 
+														* 0 - ACTIVE, 1 - PASSIVE
+														*/
+    TI_UINT8                            numOfProbRqst;	/**< This field indicates the number of probe requests to send per channel, when active scan is specified 
+														* Note: for XCC measurement this value should be set to 1
+														*/
+    TI_UINT8                            txPowerDbm;    	/**< TX power level to be used for sending probe requests when active scan is specified.
+														* If 0, leave normal TX power level for this channel
+														*/
+    EHwRateBitFiled                     txdRateSet;		/**< This EHwBitRate format field specifies the rate and modulation to transmit the probe request when 
+														* an active scan is specifie
+														*/
+    ERadioBand                          eBand;			/**< Specifies the band to which the channel belongs												*/
+} TApDiscoveryParams;
+
+/** \struct TRroamingTriggerParams
+ * \brief Roaming Trigger Parameters
+ * 
+ * \par Description 
+ * 
+ * \sa	TWD_CfgMaxTxRetry, TWD_CfgConnMonitParams
+ */ 
+typedef struct
+{
+    /* ACXConsNackTriggerParameters */
+    TI_UINT8                            maxTxRetry;			/**< The number of frames transmission failures before issuing the "Max Tx Retry" event			*/
+
+    /* ACXBssLossTsfSynchronize */
+    TI_UINT16                           TsfMissThreshold;	/**< The number of consecutive beacons that can be lost before the WiLink raises the 
+															* SYNCHRONIZATION_TIMEOUT event	
+															*/
+    TI_UINT16                           BssLossTimeout;		/**< The delay (in time units) between the time at which the device issues the SYNCHRONIZATION_TIMEOUT 
+															* event until, if no probe response or beacon is received a BSS_LOSS event is issued
+															*/
+} TRroamingTriggerParams;
+
+/** \struct TSwitchChannelParams
+ * \brief Switch Channel Parameters
+ * 
+ * \par Description
+ * Used for Switch channel Command
+ * 
+ * \sa	TWD_CmdSwitchChannel
+ */ 
+typedef struct
+{
+    TI_UINT8                            channelNumber;		/**< The new serving channel										*/         	
+    TI_UINT8                            switchTime;			/**< Relative time of the serving channel switch in TBTT units   	*/
+    TI_UINT8                            txFlag;				/**< 1: Suspend TX till switch time; 0: Do not suspend TX			*/
+    TI_UINT8                            flush;				/**< 1: Flush TX at switch time; 0: Do not flush  					*/
+
+} TSwitchChannelParams;
+
+/** \struct TRxCounters
+ * \brief RX Counters
+ * 
+ * \par Description
+ * Used for Getting RX Counters from FW
+ * 
+ * \sa
+ */ 
+typedef struct
+{    
+    TI_UINT32                           RecvError; 			/**< Number of frames that a NIC receives but does not indicate to the protocols due to errors 	*/
+    TI_UINT32                           RecvNoBuffer;   	/**< Number of frames that the NIC cannot receive due to lack of NIC receive buffer space 		*/      
+    TI_UINT32                           FragmentsRecv;    	/**< Number of Fragments Received 																*/      
+    TI_UINT32                           FrameDuplicates;	/**< Number of Farme Duplicates																	*/
+    TI_UINT32                           FcsErrors;			/**< Number of frames that a NIC receives but does not indicate to the protocols due to errors	*/
+
+} TRxCounters;
+
+/** \struct TApPowerConstraint
+ * \brief AP Power Constraint
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct  
+{
+    INFO_ELE_HDR												/**< Information Element Header		*/
+    int8                      			powerConstraintOnBss;	/**< The attenuation from the regulatory power constraint as declared by the AP 
+																* Units: dBm	;	Range: -20 - 30
+																*/
+} TApPowerConstraint;
+
+/*
+ * TConfigCmdCbParams, TInterrogateCmdCbParams:
+ * Note that this structure is used by the GWSI 
+ * both for setting (writing to the device) and
+ * for retreiving (Reading from the device),
+ * while being called with a completion CB
+ */
+/** \struct TConfigCmdCbParams
+ * \brief Config Command CB Parameters
+ * 
+ * \par Description
+ * The CB Parameters (Completino CB, Handle to CB Parameters and buffer of Input/Output Parameters) 
+ * are used for Setting Parameters
+ * 
+ * \sa	TWD_SetParam
+ */ 
+typedef struct
+{
+    void*                               fCb;	/**< Completion CB function													*/
+    TI_HANDLE                           hCb;	/**< CB handle																*/
+    void*                               pCb;	/**< CBuffer contains the content to be written or the retrieved content	*/
+
+} TConfigCmdCbParams;
+
+/** \struct TInterrogateCmdCbParams
+ * \brief Interrogate Command Parameters
+ * 
+ * \par Description
+ * Interrogate Command Parameters are the same as configuration Command CB Parameters
+ *
+ * \sa	TWD_SetParam 
+ */ 
+typedef TConfigCmdCbParams TInterrogateCmdCbParams;
+
+/** \struct TRxTimeOut
+ * \brief RX Time Out
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT16                           psPoll;		/**< The maximum time that the device will wait to receive traffic from the AP after transmission of PS-poll	*/
+    TI_UINT16                           UPSD;		/**< The maximum time that the device will wait to receive traffic from the AP after transmission from UPSD 
+													* enabled queue
+													*/
+} TRxTimeOut;
+
+/** \struct TQueueTrafficParams
+ * \brief RX Time Out
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT8                            queueID;					/**< The TX queue ID number (0-7)											*/
+    TI_UINT8                            channelType;				/**< Channel access type for the queue Refer to ChannelType_enum			*/
+    TI_UINT8                            tsid;						/**< for EDCA - the AC Index (0-3, refer to AccessCategory_enum). 
+																	* For HCCA - HCCA Traffic Stream ID (TSID) of the queue (8-15)	
+																	*/
+    TI_UINT32                           dot11EDCATableMSDULifeTime;	/**< 802.11 EDCA Table MSDU Life Time 										*/
+    TI_UINT8                            psScheme;					/**< The power save scheme of the specified queue. Refer to PSScheme_enum	*/
+    TI_UINT8                            ackPolicy;					/**< ACK policy per AC 														*/
+    TI_UINT32                           APSDConf[2];				/**< APSD Configuration 													*/
+
+} TQueueTrafficParams;
+
+
+/** \struct TFmCoexParams
+ * \brief FM Coexistence Parameters
+ * 
+ * \par Description
+ * Used for Setting/Printing FM Coexistence Parameters
+ * 
+ * \sa
+ */ 
+typedef struct
+{	
+    TI_UINT8   uEnable;                 /* enable(1) / disable(0) the FM Coex feature */
+
+    TI_UINT8   uSwallowPeriod;          /* Swallow period used in COEX PLL swallowing mechanism,
+                                           Range: 0-0xFF,  0xFF = use FW default
+                                        */
+
+    TI_UINT8   uNDividerFrefSet1;       /* The N divider used in COEX PLL swallowing mechanism for Fref of 38.4/19.2 Mhz.  
+                                           Range: 0-0xFF,  0xFF = use FW default
+                                        */
+
+    TI_UINT8   uNDividerFrefSet2;       /* The N divider used in COEX PLL swallowing mechanism for Fref of 26/52 Mhz.
+                                           Range: 0-0xFF,  0xFF = use FW default
+                                        */
+
+    TI_UINT16  uMDividerFrefSet1;       /* The M divider used in COEX PLL swallowing mechanism for Fref of 38.4/19.2 Mhz.
+                                           Range: 0-0x1FF,  0xFFFF = use FW default
+                                        */
+
+    TI_UINT16  uMDividerFrefSet2;       /* The M divider used in COEX PLL swallowing mechanism for Fref of 26/52 Mhz.
+                                           Range: 0-0x1FF,  0xFFFF = use FW default
+                                        */
+
+    TI_UINT32  uCoexPllStabilizationTime;/* The time duration in uSec required for COEX PLL to stabilize.
+                                           0xFFFFFFFF = use FW default
+                                        */
+
+    TI_UINT16  uLdoStabilizationTime;   /* The time duration in uSec required for LDO to stabilize.
+                                           0xFFFFFFFF = use FW default
+                                        */
+
+    TI_UINT8   uFmDisturbedBandMargin;  /* The disturbed frequency band margin around the disturbed 
+                                             frequency center (single sided). 
+                                           For example, if 2 is configured, the following channels 
+                                             will be considered disturbed channel: 
+                                             80 +- 0.1 MHz, 91 +- 0.1 MHz, 98 +- 0.1 MHz, 102 +- 0.1 MHz
+                                           0xFF = use FW default
+                                        */
+
+	TI_UINT8   uSwallowClkDif;          /* The swallow clock difference of the swallowing mechanism.
+                                           0xFF = use FW default
+                                        */
+
+} TFmCoexParams;
+
+
+/** \struct TMibBeaconFilterIeTable
+ * \brief MIB Beacon Filter IE table
+ * 
+ * \par Description
+ * Used for Read/Write the MIB/IE Beacon Filter
+ * NOTE: This struct is only meant to be used as a pointer reference to an actual buffer. 
+ * Table size is not a constant and is derived from the buffer size given with the 
+ * user command
+ * 
+ * \sa	TWD_WriteMibBeaconFilterIETable
+ */ 
+typedef struct 
+{
+    /* Number of information elements in table  */
+    TI_UINT8                            iNumberOfIEs;   					/**< Input Number of IE Tables	*/    
+    TI_UINT8                            iIETable[MIB_MAX_SIZE_OF_IE_TABLE]; /**< Input IE Table				*/          
+
+} TMibBeaconFilterIeTable;
+
+/** \struct TMibCounterTable
+ * \brief MIB Counter Table
+ * 
+ * \par Description
+ * Used for Getting Counters of MIB Table
+ * 
+ * \sa
+ */ 
+typedef struct 
+{
+    TI_UINT32                           PLCPErrorCount;	  	/**< The number of PLCP errors since the last time this information element was interrogated. 
+															* This field is automatically cleared when it is interrogated  
+															*/
+    TI_UINT32                           FCSErrorCount;		/**< The number of FCS errors since the last time this information element was interrogated. 
+															* This field is automatically cleared when it is interrogated
+															*/
+    TI_UINT32                           SeqNumMissCount;	/**< The number of missed sequence numbers in the squentially values of frames seq numbers	*/
+} TMibCounterTable;
+
+/** \struct TMibWlanWakeUpInterval
+ * \brief MIB WLAN Wake-Up Interval
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct 
+{
+    TI_UINT32                           WakeUpInterval;		/**< Wake Up Interval 								*/ 
+    TI_UINT8                            ListenInterval; 	/**< Listen interval in unit of the beacon/DTIM 	*/   
+
+} TMibWlanWakeUpInterval;
+
+/** \struct TMibTemplateFrame
+ * \brief MIB Template Frame
+ * 
+ * \par Description
+ * Used for Writing MIB Frame Template to FW
+ * 
+ * \sa	TWD_WriteMibTemplateFrame
+ */ 
+typedef struct 
+{
+    EMibTemplateType                 	FrameType;							/**< MIB Farme Template type	*/
+    TI_UINT32                           Rate;								/**< Frame Rate					*/
+    TI_UINT16                           Length;								/**< Frame Length				*/
+    TI_UINT8                            Data [MIB_TEMPLATE_DATA_MAX_LEN];	/**< Frame Template Data		*/
+
+} TMibTemplateFrame;
+
+/** \struct TMibArpIpAddressesTable
+ * \brief MIB ARP Address Table
+ * 
+ * \par Description
+ * Used for Writing MIB ARP Table Template to FW
+ * 
+ * \sa	TWD_WriteMib
+ */ 
+typedef struct 
+{
+    TI_UINT32                           FilteringEnable;	/**< Enable/Disable Filtering	*/
+    TIpAddr                             addr;				/**< IP Address Table			*/
+
+} TMibArpIpAddressesTable;
+
+/** \struct TMibGroupAdressTable
+ * \brief MIB Group Address Table
+ * 
+ * \par Description
+ * Used for Writing MIB Group Table Template to FW
+ * 
+ * \sa	TWD_WriteMib
+ */ 
+typedef struct 
+{
+    TMacAddr                            aGroupTable[MIB_MAX_MULTICAST_GROUP_ADDRS]; 	/**< Table of Multicast Group Addresses */       
+    TI_UINT8                            bFilteringEnable;								/**< Enable/Disable Filtering			*/  
+    TI_UINT8                            nNumberOfAddresses;								/**< Number of Multicast Addresses		*/
+
+} TMibGroupAdressTable;
+
+/** \struct TTxRateClass
+ * \brief TX Rate Class
+ * 
+ * \par Description
+ * Used for Set/Get TX Rate Policy Class to/from FW
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT32                           txEnabledRates;			/**< A Bit Mask which indicates which Rates are enabled */
+    TI_UINT8                            shortRetryLimit;		/**< */
+    TI_UINT8                            longRetryLimit;			/**< */
+    TI_UINT8                            flags;					/**< */
+    TI_UINT8                            reserved;				/**< for alignment with the FW API */
+
+} TTxRateClass;
+
+/** \struct TTxRatePolicy
+ * \brief TX Rate Policy
+ * 
+ * \par Description
+ * Used for Set/Get TX Rate Policy to/from FW
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT32                           numOfRateClasses;								/**< */
+    TTxRateClass                        rateClass[MAX_NUM_OF_TX_RATE_CLASS_POLICIES];	/**< */
+
+} TTxRatePolicy;
+
+/** \struct TCoexActivity
+ * \brief CoexActivity Parameters
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct {
+    uint8  coexIp;           /* 0-BT, 1-WLAN (according to CoexIp_e in FW) */
+    uint8  activityId;       /* According to BT/WLAN activity numbering in FW */ 
+    uint8  defaultPriority;  /* 0-255, activity default priority */
+    uint8  raisedPriority;   /* 0-255, activity raised priority */
+    uint16 minService;       /* 0-65535, The minimum service requested either in
+                                requests or in milliseconds depending on activity ID */
+    uint16 maxService;       /* 0-65535, The maximum service allowed either in
+                            requests or in milliseconds depending on activity ID */
+} TCoexActivity;
+
+/** \struct THalCoexActivityTable
+ * \brief CoexActivity Table Initialization Parameters
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    uint32 numOfElements;
+    TCoexActivity entry[COEX_ACTIVITY_TABLE_MAX_NUM];
+    
+} THalCoexActivityTable;
+
+/** \struct DcoItrimParams_t
+ * \brief DCO Itrim params structure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    Bool_e enable;
+    uint32 moderationTimeoutUsec;
+}DcoItrimParams_t;
+
+/** \union TMibData
+ * \brief MIB Data
+ * 
+ * \par Description
+ * Union which defines all MIB Data types
+ * Used for write MIB Configuration to FW
+ * 
+ * \sa	TWD_WriteMib
+ */ 
+typedef union 
+{
+    TMacAddr                            StationId;				/**< Station ID MAC Address								*/
+    TI_UINT32                           MaxReceiveLifeTime;		/**< HAl Control Max Rx MSDU Life Time, in TUs Units	*/
+    TI_UINT32                           SlotTime;				/**< Radio (PHY) Slot Time Type							*/
+    TMibGroupAdressTable             	GroupAddressTable;		/**< MIB Group Address Table							*/
+    TI_UINT8                            WepDefaultKeyId;		/**< WEP Defualt Security Key ID						*/
+    TI_UINT8                            PowerLevel;				/**< */
+    TI_UINT16                           RTSThreshold;			/**< */
+    TI_UINT32                           CTSToSelfEnable;		/**< Enable/Disable CTS to Self							*/
+    TMibArpIpAddressesTable          	ArpIpAddressesTable;	/**< MIB ARP Address Table								*/
+    TMibTemplateFrame                	TemplateFrame;			/**< MIB Template Frame		 							*/
+    TI_UINT8                            RxFilter;				/**< */
+    TMibWlanWakeUpInterval           	WlanWakeUpInterval;		/**< MIB WLAN Wake-Up Interval							*/
+    TMibCounterTable                 	CounterTable;			/**< MIB Counter Table									*/
+    TMibBeaconFilterIeTable          	BeaconFilter;			/**< MIB Beacon Filter IE table				   			*/
+    TTxRatePolicy                       txRatePolicy;			/**< TX Rate Policy			   		 					*/
+
+} TMibData;
+
+/** \struct TMib
+ * \brief MIB Structure
+ * 
+ * \par Description
+ * Used for writing MIB Configuration to FW
+ * 
+ * \sa	TWD_WriteMib, TWD_WriteMibTemplateFrame, TWD_WriteMibBeaconFilterIETable, TWD_WriteMibTxRatePolicy
+ */ 
+typedef struct
+{
+    EMib			aMib;  		/**< MIB Element Type	*/
+    TI_UINT16       Length;		/**< MIB Data Length	*/
+    TMibData     	aData; 		/**< MIB Data			*/
+
+} TMib;
+
+/** \union TTwdParamContents
+ * \brief TWD Parameters Content
+ * 
+ * \par Description
+ * All FW Parameters contents
+ * 
+ * \sa	TWD_SetParam
+ */ 
+typedef union
+{
+    TI_UINT16                           halCtrlRtsThreshold;			/**< */
+    TI_UINT8                            halCtrlCtsToSelf;				/**< */
+    TRxTimeOut                          halCtrlRxTimeOut;				/**< */
+    TI_UINT16                           halCtrlFragThreshold;			/**< */
+    TI_UINT16                           halCtrlListenInterval;			/**< */
+    TI_UINT16                           halCtrlCurrentBeaconInterval;	/**< */
+    TI_UINT8                            halCtrlTxPowerDbm;				/**< */
+    ETxAntenna                          halCtrlTxAntenna;				/**< */
+    ERxAntenna                          halCtrlRxAntenna;				/**< */
+    TI_UINT8                            halCtrlAifs;					/**< */
+    TI_BOOL                             halCtrlTxMemPoolQosAlgo;		/**< */
+    TI_BOOL                             halCtrlClkRunEnable;			/**< */
+    TRxCounters                         halCtrlCounters;				/**< */
+
+    TMib*          		                pMib;							/**< */
+    TI_UINT8                            halCtrlCurrentChannel;			/**< */
+  
+    /* AC Qos parameters */
+    TQueueTrafficParams                 *pQueueTrafficParams;			/**< */
+    
+    /* Security related parameters */
+#ifdef XCC_MODULE_INCLUDED
+    TI_BOOL                             rsnXCCSwEncFlag;				/**< */
+    TI_BOOL                             rsnXCCMicFieldFlag;				/**< */
+#endif
+    ECipherSuite                        rsnEncryptionStatus;			/**< */
+    TI_UINT8                            rsnHwEncDecrEnable; 			/**< 0- disable, 1- enable */
+    TSecurityKeys                       *pRsnKey;						/**< */
+    TI_UINT8                            rsnDefaultKeyID;				/**< */
+
+    /* Measurements section */
+    TMediumOccupancy                    mediumOccupancy;				/**< */
+    TI_BOOL                             halTxOpContinuation;			/**< */
+
+    TTsfDtim                            fwTsfDtimInfo;					/**< */
+
+    TInterrogateCmdCbParams             interogateCmdCBParams;			/**< */
+    TConfigCmdCbParams                  configureCmdCBParams;			/**< */
+
+    TTxRatePolicy                       *pTxRatePlicy;					/**< */
+
+    /* WARNING!!! This section is used to set/get internal params only. */
+    TI_UINT16                           halCtrlAid;						/**< */
+    
+    ESoftGeminiEnableModes              SoftGeminiEnable;				/**< */
+    TSoftGeminiParams                   SoftGeminiParam;				/**< */
+
+    TFmCoexParams                       tFmCoexParams;                  /**< */
+
+    TI_UINT32                           halCtrlMaxRxMsduLifetime;		/**< */
+
+    /* Beacon Broadcast options */
+    TBcnBrcOptions                      BcnBrcOptions;					/**< */
+
+    /* PLT tests */
+    TI_STATUS             				PltRxCalibrationStatus;			/**< */
+
+    /* CoexActivity */
+    THalCoexActivityTable             	tTwdParamsCoexActivityTable;			    /**< */
+
+    /* DCO Itrim */
+    DcoItrimParams_t                    tDcoItrimParams;                /**< */
+
+} TTwdParamContents;
+
+/** \struct TTwdParamInfo
+ * \brief TWD Parameters Information
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_SetParam
+ */ 
+typedef struct
+{
+    TI_UINT32                           paramType;					/**< FW Parameter Information Identifier	*/
+    TI_UINT32                           paramLength;				/**< FW Parameter Length					*/
+    TTwdParamContents                   content;					/**< FW Parameter content					*/
+
+} TTwdParamInfo;
+
+/** \struct TRxXferReserved
+ * \brief RX Xfer Reserved
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    ProcessIDTag_e                      packetType;		/**< */
+    TI_UINT8                            rxLevel;		/**< */
+    TI_INT8                             rssi;			/**< */
+    TI_UINT8                            SNR;			/**< */
+    TI_UINT8                            band;			/**< */
+    TI_UINT32                           TimeStamp;		/**< */
+    EScanResultTag                      eScanTag;		/**< */
+
+} TRxXferReserved;
+
+/** \struct TRxAttr
+ * \brief RX Attributes
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    PacketClassTag_enum                 ePacketType;    /**< */
+    TI_STATUS                           status;			/**< */
+    ERate                               Rate;   		/**< */
+    TI_UINT8                            SNR;			/**< */
+    TI_INT8                             Rssi;   		/**< */
+    TI_UINT8                            channel;		/**< */
+    TI_UINT32                           packetInfo;		/**< */
+    ERadioBand                          band;			/**< */
+    TI_UINT32                           TimeStamp;		/**< */
+    EScanResultTag                      eScanTag;		/**< */
+
+} TRxAttr;
+
+
+/** \struct TGeneralInitParams
+ * \brief General Initialization Parameters
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT16                           halCtrlListenInterval;				/**< */
+    TI_UINT8                            halCtrlCalibrationChannel2_4;		/**< */
+    TI_UINT8                            halCtrlCalibrationChannel5_0;	  	/**< */  	
+    TI_UINT16                           halCtrlRtsThreshold;				/**< */
+    TI_UINT16                           halCtrlFragThreshold;				/**< */
+    TI_UINT32                           halCtrlMaxTxMsduLifetime;			/**< */
+    TI_UINT32                           halCtrlMaxRxMsduLifetime;			/**< */
+    ETxAntenna                          halCtrlTxAntenna;					/**< */
+    ERxAntenna                          halCtrlRxAntenna;					/**< */
+    TI_UINT8                            halCtrlMacClock;					/**< */
+    TI_UINT8                            halCtrlArmClock;					/**< */
+    TI_UINT16                           halCtrlBcnRxTime;					/**< */
+    TI_BOOL                             halCtrlRxEnergyDetection;    		/**< */
+    TI_BOOL                             halCtrlTxEnergyDetection;			/**< */
+    TI_BOOL                             halCtrlEepromLessEnable;			/**< */
+    TI_BOOL                             halCtrlRxDisableBroadcast;			/**< */
+    TI_BOOL                             halCtrlRecoveryEnable;				/**< */
+    TI_BOOL                             halCtrlFirmwareDebug;				/**< */
+    TI_BOOL                             WiFiWmmPS;							/**< */
+    TRxTimeOut                          rxTimeOut;							/**< */
+    TI_UINT8                            halCtrlRateFallbackRetry;			/**< */
+    TI_BOOL                             b11nEnable;							/**< */
+
+    TI_UINT16                           TxCompletePacingThreshold;			/**< */
+    TI_UINT16                           TxCompletePacingTimeout;			/**< */
+    TI_UINT16                           RxIntrPacingThreshold;			    /**< */
+    TI_UINT16                           RxIntrPacingTimeout;			    /**< */
+
+    TI_UINT8                            hwAccessMethod;						/**< */
+    TI_UINT8                            maxSitesFragCollect;				/**< */
+    TI_UINT8                            packetDetectionThreshold;			/**< */
+    TI_UINT32                           nullTemplateSize;					/**< */
+    TI_UINT32                           disconnTemplateSize;				/**< */
+    TI_UINT32                           beaconTemplateSize;					/**< */
+    TI_UINT32                           probeRequestTemplateSize;			/**< */
+    TI_UINT32                           probeResponseTemplateSize;			/**< */
+    TI_UINT32                           PsPollTemplateSize;				   	/**< */ 	
+    TI_UINT32                           qosNullDataTemplateSize;			/**< */
+    TI_UINT32                           tddRadioCalTimout;					/**< */
+    TI_UINT32                           CrtRadioCalTimout;					/**< */
+    TI_UINT32                           UseMboxInterrupt;					/**< */
+    TI_UINT32                           TraceBufferSize;					/**< */
+    TI_BOOL                             bDoPrint;							/**< */
+    TI_UINT8                            StaMacAddress[MAC_ADDR_LEN];		/**< */
+    TI_BOOL                             TxFlashEnable;						/**< */
+    TI_UINT8                            RxBroadcastInPs;					/**< */
+	TI_UINT8       						ConsecutivePsPollDeliveryFailureThreshold;	/**< */
+    TI_UINT8                            TxBlocksThresholdPerAc[MAX_NUM_OF_AC];/**< */
+    TI_UINT16                           BeaconRxTimeout;					/**< */
+    TI_UINT16                           BroadcastRxTimeout;					/**< */
+
+    TI_UINT8                            uRssiBeaconAverageWeight;			/**< */
+    TI_UINT8                            uRssiPacketAverageWeight;			/**< */
+    TI_UINT8                            uSnrBeaconAverageWeight;			/**< */
+    TI_UINT8                            uSnrPacketAverageWeight;			/**< */
+
+    TI_UINT32                           uHostClkSettlingTime;				/**< */
+    TI_UINT8                            uHostFastWakeupSupport;             /**< */
+    THalCoexActivityTable               halCoexActivityTable;               /**< */
+    TFmCoexParams                       tFmCoexParams;                      /**< */
+
+} TGeneralInitParams;
+
+/** \struct TPowerSrvInitParams
+ * \brief Power Service Init Parameters
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct 
+{
+    TI_UINT8                            numNullPktRetries; 			/**< */
+    TI_UINT8                            hangOverPeriod;				/**< */
+    TI_UINT16                           reserve;					/**< */
+
+} TPowerSrvInitParams;
+
+/** \struct TScanSrvInitParams
+ * \brief Scan Service Init Parameters
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT32                           numberOfNoScanCompleteToRecovery;	/**< The number of consecutive no scan complete that will trigger a recovery notification 	*/
+    TI_UINT32                      		uTriggeredScanTimeOut; 				/**< i.e. split scan. Time out for starting triggered scan between 2 channels 				*/
+
+} TScanSrvInitParams;
+
+
+
+
+/** \struct TArpIpFilterInitParams
+ * \brief ARP IP Filter Init Parameters
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT32                           isFilterEnabled;	/**< */
+    TIpAddr                             addr;    			/**< */
+
+} TArpIpFilterInitParams;
+
+/** \struct TMacAddrFilterInitParams
+ * \brief AMC Address Filter Init Parameters
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT8                            isFilterEnabled;							/**< */
+    TI_UINT8                            numOfMacAddresses;							/**< */
+    TI_UINT16                           reserve;									/**< */
+    TMacAddr                            macAddrTable[MAX_MULTICAST_GROUP_ADDRS];	/**< */
+
+} TMacAddrFilterInitParams;
+
+/** \struct RateMangeParams_t
+ * \brief Rate Maangement params structure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{ 
+	rateAdaptParam_e paramIndex;
+	uint16 RateRetryScore;
+	uint16 PerAdd;
+	uint16 PerTh1;
+	uint16 PerTh2;
+	uint16 MaxPer;
+	uint8 InverseCuriosityFactor[RATE_MGMT_NUM_OF_UC];
+	uint8 TxFailLowTh;
+	uint8 TxFailHighTh;
+	uint8 PerAlphaShift;
+	uint8 PerAddShift;
+	uint8 PerBeta1Shift;
+	uint8 PerBeta2Shift;
+	uint8 RateCheckUp;
+	uint8 RateCheckDown;
+	uint8 RateRetryPolicy[RATE_MGMT_NUM_OF_RATES]; 
+	uint8 PerWeightShift[RATE_MGMT_NUM_OF_UC];			// 2 weights, 1 per UC
+	uint8 TpWeightShift[RATE_MGMT_NUM_OF_UC];				// 2 weights, 1 per UC
+}RateMangeParams_t;
+
+/*
+ * IMPORTANT NOTE:
+ * ===============
+ * This structure encapsulates the initialization data required by the TnetwDrv layer.
+ * All structures in it are arranged so no padding will be added by the compiler!!
+ * This is required to avoid missalignment when compiled by customers using GWSI API!!
+ */
+/** \struct TTwdInitParams
+ * \brief TWD Init Parameters
+ * 
+ * \par Description
+ * All TWD Initialization Parameters
+ * 
+ * \sa	TWD_SetDefaults
+ */ 
+typedef struct
+{
+    TGeneralInitParams                  tGeneral;			      /**< General Initialization Parameters		*/
+    TPowerSrvInitParams                 tPowerSrv;			      /**< Power Service Initialization Parameters	*/
+    TScanSrvInitParams                  tScanSrv;			      /**< Scan Service Initialization Parameters   */
+    TArpIpFilterInitParams              tArpIpFilter;		      /**< ARP IP filter Initialization Parameters	*/
+    TMacAddrFilterInitParams            tMacAddrFilter;	          /**< MAC Address Initialization Parameters	*/
+    IniFileRadioParam                   tIniFileRadioParams;      /**< Radio Initialization Parameters   		*/
+    IniFileGeneralParam                 tPlatformGenParams;       /**< Radio Initialization Parameters   	    */
+    ACXSmartReflexConfigParams_t        tSmartReflexParams;       /**< Smart Refelx Parameters   	            */
+    ACXSmartReflexDebugParams_t         tSmartReflexDebugParams;  /**< Smart Refelx Debug Parameters   	        */
+    ACXSmartReflexState_t               tSmartReflexState;        /**< Smart Refelx state   	                */
+    RateMangeParams_t		            tRateMngParams;           /**< Rate Managment Parameters   	            */
+    DcoItrimParams_t                    tDcoItrimParams;          /**< Dco Itrim Parameters   	            */
+
+} TTwdInitParams;
+
+/** \struct TTwdHtCapabilities
+ * \brief TWD HT Capabilities
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_SetDefaults, TWD_GetTwdHtCapabilities
+ */ 
+typedef struct
+{
+    TI_BOOL     b11nEnable;       					/**< Enable/Disable 802.11n flag	*/
+    TI_UINT8    uChannelWidth;						/**< */
+    TI_UINT8    uRxSTBC;							/**< */
+    TI_UINT8    uMaxAMSDU;						  	/**< */  	
+    TI_UINT8    uMaxAMPDU;							/**< */
+	TI_UINT8    uAMPDUSpacing;					   	/**< */ 	
+	TI_UINT8    aRxMCS[RX_TX_MCS_BITMASK_SIZE];		/**< */    
+	TI_UINT8    aTxMCS[RX_TX_MCS_BITMASK_SIZE];		/**< */    
+	TI_UINT16   uRxMaxDataRate;						/**< */    
+	TI_UINT8    uPCOTransTime;						/**< */    
+	TI_UINT32   uHTCapabilitiesBitMask;				/**< */    
+	TI_UINT8    uMCSFeedback;						/**< */    
+} TTwdHtCapabilities;
+
+typedef struct
+{
+    int32  SNRCorrectionHighLimit;
+    int32  SNRCorrectionLowLimit;
+    int32  PERErrorTH;
+    int32  attemptEvaluateTH;
+    int32  goodAttemptTH;
+    int32  curveCorrectionStep;
+
+ }RateMangeReadParams_t;
+
+
+/*
+ * --------------------------------------------------------------
+ *	APIs
+ * --------------------------------------------------------------
+ */
+/** @ingroup Control
+ * \brief Send Packet Transfer CB
+ * 
+ * \param  CBObj        - object handle
+ * \param  pPktCtrlBlk  - Pointer to Input Packet Control Block
+ * \return void
+ * 
+ * \par Description
+ * The Transfer-Done callback
+ * User registers the CB for Send Packet Transfer done
+ *
+ * \sa	TWD_RegisterCb
+ */ 
+typedef void (* TSendPacketTranferCb)(TI_HANDLE CBObj, TTxCtrlBlk *pPktCtrlBlk);
+/** @ingroup Control
+ * \brief Send Packet Debug CB
+ * 
+ * \param  CBObj        - object handle
+ * \param  pPktCtrlBlk  - Pointer to Input Packet Control Block
+ * uDebugInfo			- Debug Information
+ * \return void
+ * 
+ * \par Description
+ * The Transfer-Done Debug callback
+ *
+ * \sa
+ */ 
+typedef void (* TSendPacketDebugCb)  (TI_HANDLE CBObj, TTxCtrlBlk *pPktCtrlBlk, TI_UINT32 uDebugInfo);
+/** @ingroup Control
+ * \brief Send Packet Debug CB
+ * 
+ * \param  CBObj        - object handle
+ * \param  pPktCtrlBlk  - Pointer to Input Packet Control Block
+ * uDebugInfo			- Debug Information
+ * \return void
+ * 
+ * \par Description
+ *
+ * \sa	TWD_RegisterCb
+ */ 
+typedef ERxBufferStatus (*TRequestForBufferCb) (TI_HANDLE hObj, void **pRxBuffer, TI_UINT16 aLength, TI_UINT32 uEncryptionFlag);
+/** @ingroup Control
+ * \brief Send Packet Debug CB
+ * 
+ * \param  hObj        	- object handle
+ * \param  pBuffer	    - Pointer to Received buffer frame
+ * \return void
+ * 
+ * \par Description
+ * This function CB will be called when Received packet from RX Queue
+ * User registers the CB for RX Buffer Request
+ *
+ * \sa	TWD_RegisterCb
+ */ 
+typedef void (*TPacketReceiveCb) (TI_HANDLE 	hObj,
+                                  const void 	*pBuffer);
+/** @ingroup Control
+ * \brief Failure Event CB
+ * 
+ * \param  handle        	- object handle
+ * \param  eFailureEvent  	- Failure Event Type
+ * \return void
+ * 
+ * \par Description
+ * Callback clled for Failure event
+ * User registers the CB for Health-Moitoring
+ *
+ * \sa	TWD_RegisterCb
+ */ 
+typedef void (*TFailureEventCb)  (TI_HANDLE handle, EFailureEvent eFailureEvent);
+
+/** \union TTwdCB
+ * \brief TWD Callback
+ * 
+ * \par Description
+ * Union which holds all TWD Internal Callbacks which are registered by user
+ * per Module and Event IDs
+ * 
+ * \sa	TWD_RegisterCb
+ */ 
+typedef union
+{
+	TSendPacketTranferCb	sendPacketCB;		/**< Transfer-Done callback			*/
+	TSendPacketDebugCb		sendPacketDbgCB;	/**< Transfer-Done Debug callback	*/
+	TRequestForBufferCb		requestBufferCB;	/**< Transfer-Done Debug callback	*/
+	TPacketReceiveCb		recvPacketCB;		/**< RX Buffer Request callback		*/
+	TFailureEventCb			failureEventCB;		/**< Failure Event callback			*/
+}TTwdCB;
+
+
+/** @ingroup Control
+ * \brief Scan Service complete CB
+ * 
+ * \param  hCb        	- handle to the scan object
+ * \param  eTag  		- the scan results type tag
+ * \param  uResultCount - number of results received during this scan
+ * \param  SPSStatus  	- bitmap indicating which channels were attempted (if this is an SPS scan)
+ * \param  TSFError  	- whether a TSF error occurred (if this is an SPS scan)
+ * \param  ScanStatus  	- scan SRV status (OK / NOK)
+ * \param  PSMode		- Power Save Mode
+ * \return void
+ * 
+ * \par Description
+ * This function CB will be called when Scan Service is complete
+ * User registers the Scan Service Complete CB
+ * 
+ * \sa	TWD_RegisterScanCompleteCb
+ */ 
+typedef void (*TScanSrvCompleteCb) (TI_HANDLE 		hCb, 
+									EScanResultTag 	eTag, 
+									TI_UINT32 		uResultCount,
+                                    TI_UINT16 		SPSStatus, 
+									TI_BOOL 		TSFError, 
+									TI_STATUS 		ScanStatus,
+                                    TI_STATUS 		PSMode);
+/** @ingroup Control
+ * \brief TWD Callback
+ * 
+ * \param  hCb        	- handle to object
+ * \param  status  		- completion status
+ * \return void
+ * 
+ * \par Description
+ * Initialising Complete Callaback (exapmle: Init HW/FW CB etc.)
+ * User can use its own Complete CB which will be called when
+ * the suitable module id & event number will arrive
+ * 
+ * \sa	TWD_Init
+ */ 
+typedef void (*TTwdCallback) (TI_HANDLE hCb, TI_STATUS status); 
+/** @ingroup Control
+ * \brief TWD Callback
+ * 
+ * \param  hCb        	- handle to object
+ * \param  msrReply  	- Pointer to input measurement (which ended) Reply
+ * \return void
+ * 
+ * \par Description
+ * The function prototype for the measurement complete callback
+ * User can use its own measurement complete CB
+ * which will be called when measurement end
+ * 
+ * \sa	TWD_StartMeasurement
+ */ 
+typedef void (*TMeasurementSrvCompleteCb) (TI_HANDLE hCb, TMeasurementReply* msrReply);
+/** @ingroup Control
+ * \brief Command Response Callback
+ * 
+ * \param  hCb        	- handle to object
+ * \param  status  		- status of Command ended
+ * \return void
+ * 
+ * \par Description
+ * The function prototype for the Command Response CB
+ * Enables user to implement and use its own Response CB
+ * which will be called when TWD Command end
+ * 
+ * \sa	TWD_StartMeasurement, TWD_StopMeasurement, TWD_Scan, TWD_StopScan, TWD_StartPeriodicScan, TWD_StopPeriodicScan
+ */ 
+typedef void (*TCmdResponseCb) (TI_HANDLE hCb, TI_UINT16 status);
+/** @ingroup Control
+ * \brief Command Response Callback
+ * 
+ * \param  hCb        	- handle to object
+ * \param  status  		- status of Command ended
+ * \return void
+ * 
+ * \par Description
+ * The function prototype for the Power Save Set Response CB
+ * Enables user to implement and use its own Response CB which 
+ * will be called when Power Save Set Command end
+ * 
+ * \sa	TWD_SetPsMode
+ */ 
+typedef void (*TPowerSaveResponseCb)(TI_HANDLE hCb, TI_UINT8 status);
+/** @ingroup Control
+ * \brief Command Complete Callback
+ * 
+ * \param  hCb        	- handle to object
+ * \param  PsMode		- Power Save Mode
+ * \param  status  		- status of Command ended
+ * \return void
+ * 
+ * \par Description
+ * The function prototype for the Power Save Set Complete CB
+ * Enables user to implement and use its own Complete CB which 
+ * will be called when Power Save Set Command end (for success/faild notification)
+ * 
+ * \sa	TWD_SetPsMode
+ */ 
+typedef void (*TPowerSaveCompleteCb )(TI_HANDLE hCb, TI_UINT8 PsMode, TI_UINT8 status);
+/** @ingroup Control
+ * \brief  Create TWD Module
+ * 
+ * \param  hOs   	- OS module object handle
+ * \return TWD Module object handle on success or NULL on failure
+ * 
+ * \par Description
+ * Calling this function Creates a TWD object and all its sub-modules. 
+ * 
+ * \sa     TWD_Destroy, TWD_Init
+ */
+TI_HANDLE TWD_Create (TI_HANDLE hOs);
+/** @ingroup Control
+ * \brief  Destroy TWD Module
+ * 
+ * \param  hTWD   	- hTWD module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Calling this function Destroys TWD object and all its sub-modules. 
+ * 
+ * \sa     TWD_Create
+ */ 
+TI_STATUS TWD_Destroy (TI_HANDLE hTWD);
+/** Control
+ * \brief  Init TWD module
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  hReport      - Report module object handle
+ * \param  hUser        - Master (User) module object handle
+ * \param  hTimer       - Timer module object handle
+ * \param  hContext     - context-engine module object handle
+ * \param  hTxnQ        - TxnQueue module object handle
+ * \param  fInitHwCb    - Init HW callback called when init HW phase is done
+ * \param  fInitFwCb    - Init FW callback called when init FW phase is done
+ * \param  fConfigFwCb  - Configuration FW callback called when configuring FW phase is done
+ * \param  fStopCb      - Stop callback called when TWD is stopped
+ * \param  fInitFailCb  - Fail callback called when TWD is Failed
+ * \return void 
+ * 
+ * \par Description
+ * Start hardware Init and Config process. 
+ * This is the first function that must be called after TWD_Create.
+ * 
+ * \sa     TWD_Create, TWD_Stop
+ */ 
+void TWD_Init (TI_HANDLE    hTWD, 
+			   TI_HANDLE 	hReport, 
+               TI_HANDLE 	hUser, 
+			   TI_HANDLE 	hTimer, 
+			   TI_HANDLE 	hContext, 
+			   TI_HANDLE 	hTxnQ, 
+               TTwdCallback fInitHwCb, 
+               TTwdCallback fInitFwCb, 
+               TTwdCallback fConfigFwCb,
+			   TTwdCallback	fStopCb,
+			   TTwdCallback fInitFailCb);
+/** @ingroup Control
+ * \brief  Init HW module
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  pbuf         - Pointer to Input NVS Buffer
+ * \param  length       - Length of NVS Buffer
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Performs the HW init process. 
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_InitHw (TI_HANDLE hTWD, TI_UINT8 *pbuf, TI_UINT32 length);
+/** @ingroup Control
+ * \brief Set Defults to TWD Init Params
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  pInitParams  - Pointer to Input init default parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS TWD_SetDefaults (TI_HANDLE hTWD, TTwdInitParams *pInitParams);
+/** @ingroup Control
+ * \brief  Init FW
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  pFileInfo    - Pointer to Input Buffer contains part of FW Image to Download 
+ * 							The Following Field should be filled:
+ * 							pFileInfo->pBuffer
+ * 							pFileInfo->uLength
+ * 							pFileInfo->uAddress
+ * 							pFileInfo->bLast
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Performs FW Download, and Run FW
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_InitFw (TI_HANDLE hTWD, TFileInfo *pFileInfo);
+/** @ingroup Control
+ * \brief  Open UART Bus Txn
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  pParams      - Pointer to Input parameters 
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_BusOpen (TI_HANDLE hTWD, void* pParams);
+/** @ingroup Control
+ * \brief  Close UART Bus Txn
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_BusClose (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Halt firmware
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS TWD_Stop (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Enable external events from FW
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return void
+ * 
+ * \par Description
+ * Enable external events from FW upon driver start or recovery completion
+ *
+ * \sa
+ */ 
+void TWD_EnableExternalEvents (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Registers TWD internal callback function
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  event        - event on which the registrated CB will be called
+ * \param  fCb 	        - Pointer to Registered CB function
+ * \param  pData 	    - Pointer to Registered CB data
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * This CB enables user to register TWD Internal CB functions of different Modules,
+ * with their data.
+ * The function identifies which TWD Module owns the Registered CB, and what the specific Registered CB
+ * according to event input parameter.
+ * Once the Module and specific CB function are identified, the CB is registerd in the TWD Module 
+ * by calling suitable registration CB function
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_RegisterCb (TI_HANDLE hTWD, TI_UINT32 event, TTwdCB *fCb, void *pData);
+/** @ingroup Control
+ * \brief Exit from init mode
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Exit From Init Mode enable sending command to the MboxQueue (which store a command),
+ * while the interrupts are masked. 
+ * The interrupt would be enable at the end of the init process
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_ExitFromInitMode (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Finalize FW init and download
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return void 
+ * 
+ * \par Description
+ * Init all the remaining initialization after the FW download has finished
+ * 
+ * \sa
+ */ 
+void TWD_FinalizeDownload (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Finalize of faulty FW init and download
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return void 
+ * 
+ * \par Description
+ * Call the upper layer failure callback after Init or FW download has finished with failure.
+ * 
+ * \sa
+ */ 
+void TWD_FinalizeOnFailure (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Perform FW Configuration
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure the FW from the TWD DB - after configuring all HW objects
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_ConfigFw (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Handle FW interrupt from ISR context
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * This is the FW-interrupt ISR context. The driver task is scheduled to hadnle FW-Events
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_InterruptRequest (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Enable Recovery
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return TRUE if recovery Enables, FALSE otherwise
+ * 
+ * \par Description
+ * Return Recovery E/D status
+ *
+ * \sa
+ */ 
+TI_BOOL TWD_RecoveryEnabled (TI_HANDLE hTWD);
+/** @ingroup Measurement
+ * \brief Starts a measurement 
+ * 
+ * \param  hTWD         			- TWD module object handle
+ * \param  pMsrRequest         		- Pointer to Input structure which contains the measurement parameters
+ * \param  uTimeToRequestExpiryMs   - The time (in milliseconds) the measurement SRV has to start the request
+ * \param  fResponseCb         		- The Command response CB Function
+ * \param  hResponseCb         		- Handle to Command response CB Function Obj
+ * \param  fCompleteCb         		- The Command Complete CB Function
+ * \param  hCompleteCb         		- Handle to Command Complete CB Function Obj
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Starts a measurement operation 
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_StartMeasurement (TI_HANDLE hTWD, 
+								TMeasurementRequest *pMsrRequest, 
+								TI_UINT32 uTimeToRequestExpiryMs, 
+								TCmdResponseCb fResponseCb, 
+								TI_HANDLE hResponseCb, 
+								TMeasurementSrvCompleteCb fCompleteCb, 
+								TI_HANDLE hCompleteCb);
+/** @ingroup Measurement
+ * \brief Stops a measurement
+ * 
+ * \param  hTWD         			- TWD module object handle
+ * \param  bSendNullData         	- Indicates whether to send NULL data when exiting driver mode
+ * \param  fResponseCb         		- Pointer to Command response CB function
+ * \param  hResponseCb         		- Handle to Command response CB parameters
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Stops a measurement operation in progress
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_StopMeasurement (TI_HANDLE hTWD, 
+							   TI_BOOL bSendNullData, 
+							   TCmdResponseCb fResponseCb, 
+							   TI_HANDLE hResponseCb);
+/** @ingroup Measurement
+ * \brief Start scan
+ * 
+ * \param hTWD                		- TWD module object handle
+ * \param pScanParams            	- Pointer to Input Scan specific parameters
+ * \param eScanTag               	- Scan tag, used for result and scan complete tracking
+ * \param bHighPriority          	- Indicates whether to perform a high priority (overlaps DTIM) scan
+ * \param bDriverMode            	- Indicates whether to try to enter driver mode (with PS on) before issuing the scan command
+ * \param bScanOnDriverModeError 	- Indicates whether to proceed with the scan if requested to enter driver mode and failed 
+ * \param ePsRequest             	- Parameter sent to PowerSaveServer. 
+ * 										Should indicates PS ON or "keep current" only when driver mode is requested, 
+ * 										Otherwise should indicate OFF
+ * \param bSendNullData          	- Indicates whether to send Null data when exiting driver mode on scan complete
+ * \param fResponseCb            	- The Response CB Function which called after downloading the command
+ * \param hResponseCb            	- Handle to the Response CB Function Obj (Notice : last 2 params are NULL in Legacy run)
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Start scan. enter driver mode (PS) only if station is connected
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_Scan (TI_HANDLE hTWD, 
+					TScanParams *pScanParams, 
+					EScanResultTag eScanTag, 
+					TI_BOOL bHighPriority, 
+					TI_BOOL bDriverMode, 
+					TI_BOOL bScanOnDriverModeError, 
+					E80211PsMode ePsRequest, 
+					TI_BOOL bSendNullData, 
+					TCmdResponseCb fResponseCb, 
+					TI_HANDLE hResponseCb);
+/** @ingroup Measurement
+ * \brief Stop scan
+ * 
+ * \param hTWD                		- TWD module object handle
+ * \param eScanTag               	- Scan tag, used to track scan complete and result
+ * \param bSendNullData          	- Indicates whether to send Null data when exiting driver mode
+ * \param fScanCommandResponseCb 	- The Response CB Function which called after downloading the command
+ * \param hCb                    	- Handle to the Response CB Function Obj (Notice : last 2 params are NULL in Legacy run)
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Sends a Stop Scan command to FW, no matter if we are in scan progress or not
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_StopScan (TI_HANDLE hTWD, 
+						EScanResultTag eScanTag, 
+						TI_BOOL bSendNullData, 
+						TCmdResponseCb fScanCommandResponseCb, 
+						TI_HANDLE hCb);
+/** @ingroup Measurement
+ * \brief Stop Scan on FW Reset
+ * 
+ * \param hTWD		- TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Stop scan operation when a FW reset (recovery) situation is detected (by all processes 
+ * other than scan)
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_StopScanOnFWReset (TI_HANDLE hTWD);
+/** @ingroup Measurement
+ * \brief Start Connection Periodic Scan operation
+ * 
+ * \param hTWD                			- TWD module object handle
+ * \param  pPeriodicScanParams    		- Pointer to Input Parameters Structures for the Periodic Scan operation
+ * \param  eScanTag               		- Scan tag, used for scan complete and result tracking
+ * \param  uPassiveScanDfsDwellTimeMs 	- Passive dwell time for DFS channels (in milli-secs)
+ * \param  fResponseCb            		- Response CB Function which is called after downloading the command
+ * \param  hResponseCb            		- Handle to Response CB Function Obj (Notice : last 2 params are NULL in Legacy run)
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Perform Connection Scan periodically
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_StartConnectionScan (TI_HANDLE hTWD, 
+								 TPeriodicScanParams *pPeriodicScanParams, 
+								 EScanResultTag eScanTag, 
+								 TI_UINT32 uPassiveScanDfsDwellTimeMs, 
+								 TCmdResponseCb fResponseCb, 
+								 TI_HANDLE hResponseCb);
+/** @ingroup Measurement
+ * \brief Stop Periodic Scan operation
+ * 
+ * \param hTWD 					- TWD module object handle
+ * \param eScanTag              - scan tag, used for scan complete and result tracking
+ * \param  fResponseCb          - Response CB Function which is called after downloading the command
+ * \param  hResponseCb          - Handle to Response CB Function Obj (Notice : last 2 params are NULL in Legacy run)
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Stop Periodic Connection Scan
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_StopPeriodicScan (TI_HANDLE hTWD, 
+								EScanResultTag eScanTag, 
+								TCmdResponseCb fResponseCb, 
+								TI_HANDLE hResponseCb);
+/** @ingroup Measurement
+ * \brief Register CB for Scan Complete
+ * 
+ * \param  hTWD         		- TWD module object handle
+ * \param  fScanCompleteCb     	- The Complete CB Function
+ * \param  hScanCompleteCb   	- Handle to the Complete CB Function Obj
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Registers a Complete CB Function for Scan Complete notifications
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_RegisterScanCompleteCb (TI_HANDLE hTWD, 
+									  TScanSrvCompleteCb fScanCompleteCb, 
+									  TI_HANDLE hScanCompleteCb); 
+/** @ingroup Misc
+ * \brief  Set Parameters in FW
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  pParamInfo   - Pointer to Input TWD Parameters Information Structure
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *  Set/Configure Parameters Information in FW via Mail BOX
+ * 
+ * \sa	TTwdParamInfo
+ */ 
+TI_STATUS TWD_SetParam (TI_HANDLE hTWD, TTwdParamInfo *pParamInfo);
+/** @ingroup Misc
+ * \brief  Get Parameters from FW
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  pParamInfo   - Pointer to Input TWD Parameters Information Structure
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *  Get Parameters Information from FW  via Mail BOX
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_GetParam (TI_HANDLE hTWD, TTwdParamInfo *pParamInfo);
+/** @ingroup Control
+ * \brief Callback which Checks MBOX
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  uMboxStatus  - Mailbox status
+ * \param  pItrParamBuf - Pointer to Interrogate parameters buffer
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Perform FW validation by calling CB function which is used for handling MBOX error.
+ * If command MBOX queue identify MBOX error or timeout, it will call 
+ * a failure-callback with MBOX_FAILURE type (FW failed)
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CheckMailboxCb (TI_HANDLE hTWD, TI_UINT16 uMboxStatus, void *pItrParamBuf);
+/** @ingroup Control
+ * \brief Write MIB
+ * 
+ * \param hTWD 		- TWD module object handle
+ * \param pMib      - Pointer to Input MIB Structure
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Write configuration information to FW
+ *
+ * \sa TWD_ReadMib
+ */ 
+TI_STATUS   TWD_WriteMib (TI_HANDLE hTWD, TMib* pMib);
+/** @ingroup Control
+ * \brief Read MIB
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  hCb          - Handle to Request MIB CB Function Obj
+ * \param  fCb          - Pinter to Request MIB CB Function
+ * \param  pCb          - Pointer to read parameters
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Read configuration information from FW
+ *
+ * \sa TWD_WriteMib
+ */ 
+TI_STATUS   TWD_ReadMib                 (TI_HANDLE hTWD, TI_HANDLE hCb, void* fCb, void* pCb);
+/** @ingroup Control
+ * \brief TWD Debug
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  funcType    	- TWD Function Debuged
+ * \param  pParam     	- Pointer to Input parameters of Debug function
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Use for Debug TWD
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_Debug (TI_HANDLE hTWD, TI_UINT32 funcType, void *pParam);
+/** @ingroup Control
+ * \brief Register event
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  event        - Event ID
+ * \param  fCb          - Event Callback function pointer
+ * \param  hCb          - Event Callback object handle
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Register FW event callback function
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_RegisterEvent (TI_HANDLE hTWD, TI_UINT32 event, void *fCb, TI_HANDLE hCb);
+/** @ingroup Control
+ * \brief Disable event
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  event        - Event ID
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Disable specific FW event
+ * Note: Currently not in use
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_DisableEvent (TI_HANDLE hTWD, TI_UINT32 event);
+/** @ingroup Control
+ * \brief Enable event
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  event        - Event ID
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Enable specific FW event
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_EnableEvent (TI_HANDLE hTWD, TI_UINT32 event);
+TI_STATUS TWD_dbgRoamingCommands (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Convert RSSI to RX Level
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  iRssiVal     - RSSI Input Value
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Note: Currently not in use!
+ *
+ * \sa
+ */ 
+TI_INT8 TWD_ConvertRSSIToRxLevel (TI_HANDLE hTWD, TI_INT32 iRssiVal);
+/** @ingroup Control
+ * \brief Complete TWD Stop
+ * 
+ * \param  hTWD	- TWD module object handle
+ * \return void
+ * 
+ * \par Description
+ * 
+ * \sa TWD_Stop, TWD_Init
+ */ 
+void TWD_StopComplete (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Disable Interrupts
+ * 
+ * \param hTWD	- TWD module object handle
+ * \return void 
+ * 
+ * \par Description
+ * Disable the FW Event client of the context thread handler
+ *
+ * \sa
+ */ 
+void TWD_DisableInterrupts (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief Enable Interrupts
+ * 
+ * \param hTWD 		- TWD module object handle
+ * \return void 
+ * 
+ * \par Description
+ * Enable the FW Event client of the context thread handler
+ *
+ * \sa
+ */ 
+void TWD_EnableInterrupts (TI_HANDLE hTWD);
+/** @ingroup Control
+ * \brief	Translate host to FW time (Usec)
+ * 
+ * \param  hTWD 	 - TWD module object handle
+ * \param  uHostTime - The host time in MS to translate
+ *
+ * \return FW Time in Usec
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_UINT32 TWD_TranslateToFwTime (TI_HANDLE hTWD, TI_UINT32 uHostTime);
+/** @ingroup BSS
+ * \brief Get TWD HT Capabilities
+ * 
+ * \param hTWD 					- TWD module object handle
+ * \param  pTwdHtCapabilities  	- Pointer read structure Output
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ *
+ * \sa
+ */ 
+void TWD_GetTwdHtCapabilities (TI_HANDLE hTWD, TTwdHtCapabilities **pTwdHtCapabilities);
+#ifdef TI_DBG
+/** @ingroup Measurement
+ * \brief Prints Scan Server Debug status
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_PrintMacServDebugStatus (TI_HANDLE hTWD);
+
+/** @ingroup Test
+ * \brief Prints Tx Info
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  ePrintInfo   - Information type
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Call the requested print function - used for Debug Test
+ * 
+ * \sa 
+ */ 
+TI_STATUS TWD_PrintTxInfo (TI_HANDLE hTWD, ETwdPrintInfoType ePrintInfo);
+#endif
+
+/*-----*/
+/* Get */
+/*-----*/
+
+/** @ingroup Control
+ * \brief Get number of Commands in CMD Queue 
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \return Maximum Number of Commands currently in CMD Queue 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_UINT32 TWD_GetMaxNumberOfCommandsInQueue (TI_HANDLE hTWD);
+/** @ingroup Power_Management
+ * \brief Get Power Save Status 
+ * 
+ * \param  hTWD         		- TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_BOOL TWD_GetPsStatus (TI_HANDLE hTWD);
+
+TI_STATUS TWD_GetRxFilters (TI_HANDLE hTWD, TI_UINT32 *pRxConfigOption, TI_UINT32* pRxFilterOption);
+TI_STATUS TWD_GetRadioStandByState (TI_HANDLE hTWD);
+
+/** @ingroup Control
+ * \brief  Get FW Information
+ * 
+ * \param  hTWD    	- TWD module object handle
+ * \return TFwInfo 	- Pointer to Output FW Information Structure
+ * 
+ * \par Description
+ * Gets the TFwInfo pointer
+ * 
+ * \sa TFwInfo
+ */ 
+TFwInfo* TWD_GetFWInfo (TI_HANDLE hTWD);
+/** @ingroup BSS
+ * \brief	Get Group Address Table
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \param  pEnabled  		- Pointer to Output Indicatore if MAC Address Filter is Enabled
+ * \param  pNumGroupAddrs   - Pointer to Output Number of Group Address
+ * \param  pGroupAddr   	- Pointer to Output Group Address Table
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa TWD_WriteMib, TMacAddr
+ */
+TI_STATUS TWD_GetGroupAddressTable (TI_HANDLE hTWD, TI_UINT8* pEnabled, TI_UINT8* pNumGroupAddrs, TMacAddr *pGroupAddr);
+/** @ingroup Control
+ * \brief Read Memory
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param pMemDebug     - Pointer to read Output
+ * \param fCb			- Pointer to function Callback
+ * \param hCb			- Handle to function Callback Parameters
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_readMem (TI_HANDLE hTWD, TFwDebugParams* pMemDebug, void* fCb, TI_HANDLE hCb);
+/** @ingroup Control
+ * \brief Write Memory
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param pMemDebug     - Pointer to write Input
+ * \param fCb			- Pointer to function Callback
+ * \param hCb			- Handle to function Callback Parameters
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_writeMem (TI_HANDLE hTWD, TFwDebugParams* pMemDebug, void* fCb, TI_HANDLE hCb);
+
+/** @ingroup Control
+ * \brief Check if addr is a valid memory address
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param pMemDebug     - Pointer to addr & length
+ * \return TI_TRUE on success or TI_FALSE on failure 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_BOOL TWD_isValidMemoryAddr (TI_HANDLE hTWD, TFwDebugParams* pMemDebug);
+
+/** @ingroup Control
+ * \brief Check if addr is a valid register address
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param pMemDebug     - Pointer to addr & length
+ * \return TI_TRUE on success or TI_FALSE on failure 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_BOOL TWD_isValidRegAddr (TI_HANDLE hTWD, TFwDebugParams* pMemDebug);
+
+/*-----*/
+/* Set */
+/*-----*/
+
+/** @ingroup Power_Management
+ * \brief Set Power Save Mode 
+ * 
+ * \param  hTWD         		- TWD module object handle
+ * \param  ePsMode       		- Power Save Mode
+ * \param  bSendNullDataOnExit  - Indicates whether to send NULL data when exiting driver mode
+ * \param  hPowerSaveCompleteCb - Handle to PS Complete CB Parameters Obj 
+ * \param  fPowerSaveCompleteCb - The PS Complete CB function
+ * \param  fPowerSaveResponseCb - The PS Response CB function
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_SetPsMode (TI_HANDLE hTWD, 
+						 E80211PsMode ePsMode, 
+						 TI_BOOL bSendNullDataOnExit, 
+						 TI_HANDLE hPowerSaveCompleteCb, 
+						 TPowerSaveCompleteCb fPowerSaveCompleteCb, 
+						 TPowerSaveResponseCb fPowerSaveResponseCb);
+/** @ingroup Radio
+ * \brief Set Rate Modulation 
+ * 
+ * \param  hTWD         - TWD module object handle
+ * \param  rate         - Rate Modulation Value
+ * \return TRUE if Power Service State is Pwer Save, FALSE otherwise 
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+TI_STATUS TWD_SetNullRateModulation (TI_HANDLE hTWD, TI_UINT16 rate);
+/** @ingroup Radio
+ * \brief	Set Radio Band
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \param  eRadioBand  		- Radio Band Type
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS TWD_SetRadioBand (TI_HANDLE hTWD, ERadioBand eRadioBand);
+/** @ingroup Data_Path
+ * \brief	Set Security Sequance Number
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  securitySeqNumLsByte - LS Byte of Security Sequance Number
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Update the TKIP/AES sequence-number according to the Tx data packet security-sequance-number
+ * Note: The FW always provides the last used sequance-number so no need to check if the current 
+ * packet is data and WEP is on
+ *
+ * \sa
+ */
+TI_STATUS TWD_SetSecuritySeqNum (TI_HANDLE hTWD, TI_UINT8 securitySeqNumLsByte);
+/** @ingroup BSS
+ * \brief Update DTIM & TBTT 
+ * 
+ * \param  hTWD         	- TWD module object handle
+ * \param  uDtimPeriod     	- DTIM period in number of beacons
+ * \param  uBeaconInterval 	- Beacon perios in TUs (1024 msec)
+ * \return void 
+ * 
+ * \par Description
+ * Update DTIM and Beacon periods for scan timeout calculations
+ *
+ * \sa
+ */ 
+void TWD_UpdateDtimTbtt (TI_HANDLE hTWD, TI_UINT8 uDtimPeriod, TI_UINT16 uBeaconInterval);
+
+/*---------*/
+/* Command */
+/*---------*/
+
+
+TI_STATUS TWD_CmdStartScan (TI_HANDLE hTWD, 
+							TScanParams *pScanVals, 
+							TI_BOOL bHighPriority, 
+							void* fScanCommandResponseCb, 
+							TI_HANDLE hCb);
+TI_STATUS TWD_CmdStartSPSScan (TI_HANDLE hTWD, 
+							   TScanParams *pScanVals, 
+							   void *fScanCommandResponseCb, 
+							   TI_HANDLE hCb);
+TI_STATUS TWD_CmdStopScan (TI_HANDLE hTWD, void *fScanCommandResponseCb, TI_HANDLE hCb);
+
+TI_STATUS TWD_CmdStopSPSScan (TI_HANDLE hTWD, void *fScanCommandResponseCb, TI_HANDLE hCb);
+
+/** @ingroup Measurement
+ * \brief  Set Split scan time out
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  uTimeOut   	- Scan Time Out
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Set Triggered scan time out per channel
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdSetSplitScanTimeOut (TI_HANDLE hTWD, TI_UINT32 uTimeOut);
+/** @ingroup BSS
+ * \brief  Join BSS
+ * 
+ * \param hTWD 				- TWD module object handle
+ * \param  pJoinBssParams   - Pointer to Join BSS Input parameters structure
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdJoinBss (TI_HANDLE hTWD, TJoinBss *pJoinBssParams);
+/** @ingroup Control
+ * \brief  Command Template
+ * 
+ * \param hTWD 				- TWD module object handle
+ * \param  pTemplateParams  - Pointer to Input Template Parameters Structure
+ * \param  fCb  			- Pointer to Command Callback Function
+ * \param  hCb  			- Handle to Command Callback Function Obj. Parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Sets a template to the FW
+ * 
+ * \sa
+ */ 
+/* 6.1.08 - for future WHA measurement command */
+TI_STATUS TWD_CmdTemplate (TI_HANDLE hTWD, TSetTemplate *pTemplateParams, void *fCb, TI_HANDLE hCb);
+/** @ingroup Data_Path
+ * \brief  Enable Tx path
+ * 
+ * \param  hTWD     	- TWD module object handle
+ * \param  channel     	- Channel Number
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Enable tx path on the hardware
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdEnableTx (TI_HANDLE hTWD, TI_UINT8 channel);
+/** @ingroup Data_Path
+ * \brief  Disable Tx path
+ * 
+ * \param  hTWD     	- TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdDisableTx (TI_HANDLE hTWD);
+/** @ingroup Measurement
+ * \brief  Command Noise Histogram
+ * 
+ * \param  hTWD     		- TWD module object handle
+ * \param  pNoiseHistParams - Pointer Input Noise Histogram Parameters: 
+ * 							  holds Start/Stop Noise Histogram Measure Indication, 
+ * 							  Sample Interval & Sample Ranges 
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Send a Start/Stop Noise Histogram Measure Command to the FW with measure parameters
+ * 
+ * \sa	TNoiseHistogram
+ */ 
+TI_STATUS TWD_CmdNoiseHistogram (TI_HANDLE hTWD, TNoiseHistogram *pNoiseHistParams);
+
+TI_STATUS TWD_CmdPSMode (TI_HANDLE hTWD, TPowerSaveParams *pPowerSaveParams);
+/** @ingroup Radio
+ * \brief  Command Switch Channel
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  pSwitchChannelCmd    - Pointer to Switch Channel Parameters Structure
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa TSwitchChannelParams
+ */ 
+TI_STATUS TWD_CmdSwitchChannel (TI_HANDLE hTWD, TSwitchChannelParams *pSwitchChannelCmd);
+/** @ingroup Radio
+ * \brief  Command Switch Channel Cancel
+ * 
+ * \param  hTWD    		- TWD module object handle
+ * \param  channel    	- Channek Number
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdSwitchChannelCancel (TI_HANDLE hTWD, TI_UINT8 channel);
+/** @ingroup Control
+ * \brief  FW Disconnect
+ * 
+ * \param  hTWD    	- TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa 
+ */ 
+TI_STATUS TWD_CmdFwDisconnect (TI_HANDLE hTWD, DisconnectType_e uDisconType, TI_UINT16 uDisconReason);
+/** @ingroup Measurement
+ * \brief  Start Measurement Command
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  uDisconReason		- 2 bytes of disconnect reason to be use in deauth/disassoc frmaes
+ * \param  uDisconType    		- Immediate (dont send frames) or send Deauth or send Disassoc frmae
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * send Command for start measurement to FW
+ * 
+ * \sa TMeasurementParams
+ */ 
+TI_STATUS TWD_CmdMeasurement (TI_HANDLE hTWD, 
+							  TMeasurementParams *pMeasurementParams, 
+							  void *fCommandResponseCb, 
+							  TI_HANDLE hCb);
+/** @ingroup Measurement
+ * \brief  Stop Measurement Command
+ * 
+ * \param  hTWD    	- TWD module object handle
+ * \param  fCb  	- Pointer to Callback Function
+ * \param  hCb    	- Handle to Callback Function Object Parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * send Command for stop measurement to FW
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdMeasurementStop (TI_HANDLE hTWD, void* fCb, TI_HANDLE hCb);
+/** @ingroup UnKnown
+ * \brief  AP Discovery
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  pApDiscoveryParams  	- Pointer to Input AP Discovery Parameters Structure
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdApDiscovery (TI_HANDLE hTWD, TApDiscoveryParams *pApDiscoveryParams);
+/** @ingroup UnKnown
+ * \brief	AP Discovery Stop
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdApDiscoveryStop (TI_HANDLE hTWD);
+
+TI_STATUS TWD_CmdTest (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, TTestCmd* pTestCmd);
+/** @ingroup Control
+ * \brief	Helth Check
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Trigger the FW health test command and wait for results
+ *
+ * \sa
+ */
+TI_STATUS TWD_CmdHealthCheck (TI_HANDLE hTWD);
+/** @ingroup UnKnown
+ * \brief  AP Discovery
+ * 
+ * \param  hTWD    		- TWD module object handle
+ * \param  staState  	- stat of the station (CONNECTED)
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CmdSetStaState (TI_HANDLE hTWD, TI_UINT8 staState, void *fCb, TI_HANDLE hCb);
+
+/*-----------*/
+/* Configure */
+/*-----------*/
+
+/** @ingroup UnKnown
+ * \brief  Configure ARP table
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  tIpAddr   	- IP Address Input Buffer
+ * \param  bEnabled   	- Indicates if ARP filtering is Enabled (1) or Disabled (0)
+ * \param  eIpVer   	- IP Version
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure ARP IP Address table
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgArpIpAddrTable (TI_HANDLE hTWD, 
+								 TIpAddr tIpAddr, 
+								 TI_BOOL bEnabled, 
+								 EIpVer eIpVer);
+/** @ingroup BSS
+ * \brief	Configure Group Address Table
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \param  uNumGroupAddrs  	- Number of Group Address
+ * \param  pGroupAddr   	- Pointer to Input Group Address Table
+ * \param  bEnabled    		- Indicates if MAC Address Filter is Enabled
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa TWD_WriteMib
+ */
+TI_STATUS TWD_CfgGroupAddressTable (TI_HANDLE hTWD, 
+									TI_UINT8 uNumGroupAddrs, 
+									TMacAddr *pGroupAddr, 
+									TI_BOOL bEnabled);
+/** @ingroup Data_Path
+ * \brief  Configure RX Filters
+ * 
+ * \param hTWD 				- TWD module object handle
+ * \param  uRxConfigOption  - RX Configuration Option
+ * \param  uRxFilterOption 	- RX Filter Option
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa	TWD_WriteMib
+ */ 
+TI_STATUS TWD_CfgRx (TI_HANDLE hTWD, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption);
+/** @ingroup UnKnown
+ * \brief  Configure Packet Detection Threshold
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  threshold 	- Threshold Value
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa ERate
+ */ 
+TI_STATUS TWD_CfgPacketDetectionThreshold (TI_HANDLE hTWD, TI_UINT32 threshold);
+/** @ingroup Radio
+ * \brief  Configure Slot Time
+ * 
+ * \param hTWD 				- TWD module object handle
+ * \param  eSlotTimeVal 	- Slot Time Value
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgSlotTime (TI_HANDLE hTWD, ESlotTime eSlotTimeVal);
+/** @ingroup Radio
+ * \brief  Configure Preamble
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  ePreamble 	- Preamble Value
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgPreamble (TI_HANDLE hTWD, EPreamble ePreamble);
+/** @ingroup Power_Management
+ * \brief  Configure Beacon Filter State
+ * 
+ * \param  hTWD     				- TWD module object handle
+ * \param  uBeaconFilteringStatus   - Beacon Filtering Status. Indicates whether the filter is enabled:
+ * 									  1 - enabled, 0 - disabled
+ * \param  uNumOfBeaconsToBuffer 	- Determines the number of beacons without the unicast TIM bit set,
+ * 									  that the firmware buffers before signaling the host about ready frames.
+ *									  When thi snumber is set to 0 and the filter is enabled, beacons without 
+ *									  the unicast TIM bit set are dropped. 
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure Beacon Filter State to the FW
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgBeaconFilterOpt (TI_HANDLE hTWD, TI_UINT8 uBeaconFilteringStatus, TI_UINT8 uNumOfBeaconsToBuffer);
+/** @ingroup Power_Management
+ * \brief  Configure Beacon Filter Table
+ * 
+ * \param  hTWD     	- TWD module object handle
+ * \param  uNumOfIe   	- The number of IE's in the table
+ * \param  pIeTable 	- Pointer to Input IE Table
+ * \param  uIeTableSize - Size of Input IE Table
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure Beacon Filter Table to the FW
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgBeaconFilterTable (TI_HANDLE hTWD, TI_UINT8 uNumOfIe, TI_UINT8 *pIeTable, TI_UINT8 uIeTableSize);
+/** @ingroup Power_Management
+ * \brief  Configure Wake Up Condition
+ * 
+ * \param  hTWD     		- TWD module object handle
+ * \param  pPowerMgmtConfig	- Pointer to Input Power Management Configuration Parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure Power Manager's Wake Up Condition
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgWakeUpCondition (TI_HANDLE hTWD, TPowerMgmtConfig *pPowerMgmtConfig);
+/** @ingroup UnKnown
+ * \brief  Configure Beacon Broadcast Options
+ * 
+ * \param  hTWD     		- TWD module object handle
+ * \param  pPowerMgmtConfig	- Pointer to Input Power Management Configuration Parameters Structure
+ * 							  The Following Field should be filled: 
+ * 							  pPowerMgmtConfig->BcnBrcOptions.BeaconRxTimeout
+ * 							  pPowerMgmtConfig->BcnBrcOptions.BroadcastRxTimeout
+ * 							  pPowerMgmtConfig->BcnBrcOptions.RxBroadcastInPs - if set, enables receive of broadcast packets in Power-Save mode
+ * 							  pPowerMgmtConfig->ConsecutivePsPollDeliveryFailureThreshold - No answer after Ps-Poll work-around 					   	  
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure Power Manager's Beacon Broadcast Options:
+ * Beacon RX time Out, Broadcast RX Timeout, RX Broadcast In Power Save, 
+ * Consecutive Power Save Poll Delivery Failure Threshold
+ * 
+ * 
+ * \sa TPowerMgmtConfig, TBcnBrcOptions
+ */ 
+TI_STATUS TWD_CfgBcnBrcOptions (TI_HANDLE hTWD, TPowerMgmtConfig *pPowerMgmtConfig);
+
+/** @ingroup BSS
+ * \brief  Configure Max TX Retry
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  pRoamingTriggerCmd   - Pointer to Input Configuration Parameters Structure
+ * 							  	  The Following Field should be filled: 
+ * 								  pRoamingTriggerCmd->maxTxRetry
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure the Max Tx Retry parameters
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgMaxTxRetry (TI_HANDLE hTWD, TRroamingTriggerParams *pRoamingTriggerCmd);
+/** @ingroup BSS
+ * \brief  Configure Connection Monitoring
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  pRoamingTriggerCmd   - Pointer to Input Configuration Parameters Structure
+ * 							  	  The Following Field should be filled: 
+ * 								  pRoamingTriggerCmd->BssLossTimeout
+ * 								  pRoamingTriggerCmd->TsfMissThreshold
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure the Bss Lost Timeout & TSF miss threshold Parameters
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgConnMonitParams (TI_HANDLE hTWD, TRroamingTriggerParams *pRoamingTriggerCmd);
+/** @ingroup Power_Management
+ * \brief	Configure Sleep Auth
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \param  eMinPowerPolicy  - Minimum Power Policy Type
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure the minimum power policy to the FW
+ * 
+ * \sa EPowerPolicy
+ */
+TI_STATUS TWD_CfgSleepAuth (TI_HANDLE hTWD, EPowerPolicy eMinPowerPolicy);
+/** @ingroup Control
+ * \brief	Configure MAC Clock
+ * 
+ * \param  hTWD    		- TWD module object handle
+ * \param  uMacClock    - MAC Clock value
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS TWD_CfgMacClock (TI_HANDLE hTWD, TI_UINT32 uMacClock);
+/** @ingroup Control
+ * \brief	Configure ARM Clock
+ * 
+ * \param  hTWD    		- TWD module object handle
+ * \param  uArmClock    - ARM Clock value
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS TWD_CfgArmClock (TI_HANDLE hTWD, TI_UINT32 uArmClock);
+/** @ingroup Data_Path
+ * \brief	Configure RX Data Filter
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  index    			- Index of the Rx Data filter
+ * \param  command    			- Command: Add/remove the filter
+ * \param  eAction    			- Action to take when packets match the pattern
+ * \param  uNumFieldPatterns   	- Number of field patterns in the filter
+ * \param  uLenFieldPatterns    - Length of the field pattern series
+ * \param  pFieldPatterns    	- Series of field patterns
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Add/remove Rx Data filter information element
+ *
+ * \sa
+ */
+TI_STATUS TWD_CfgRxDataFilter (TI_HANDLE hTWD, 
+							   TI_UINT8 index, 
+							   TI_UINT8 command, 
+							   filter_e eAction, 
+							   TI_UINT8 uNumFieldPatterns, 
+							   TI_UINT8 uLenFieldPatterns, 
+							   TI_UINT8 *pFieldPatterns);
+/** @ingroup Data_Path
+ * \brief	Configure Enable RX Data Filter
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \param  bEnabled      	- Indicates if Rx data filtering is enabled or Disabled
+ * 							  (0: data filtering disabled, Otherwise: enabled)
+ * \param  eDefaultAction   - The default action taken on non-matching packets
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure Enable/Disable RX Data Filter, and which default action to perform if it is enabled
+ *
+ * \sa
+ */
+TI_STATUS TWD_CfgEnableRxDataFilter (TI_HANDLE hTWD, TI_BOOL bEnabled, filter_e eDefaultAction);
+/** @ingroup BSS
+ * \brief	Configure RRSSI/SNR Trigger parameters
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \param  pRssiSnrTrigger  - Pointer to RRSSI/SNR Input parameter Structure
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS TWD_CfgRssiSnrTrigger (TI_HANDLE hTWD, RssiSnrTriggerCfg_t* pRssiSnrTrigger);
+/** @ingroup QoS
+ * \brief	Configure AC parameters
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \param  pAcQosParams  	- Pointer to Input AC Quality Of Service Parameters Structure
+ * 								Fields that should be filled:
+ * 								pAcQosParams->ac
+ * 								pAcQosParams->aifsn
+ * 								pAcQosParams->cwMax
+ * 								pAcQosParams->cwMin
+ * 								pAcQosParams->txopLimit
+ * \param  fCb      		- Pointer to Command CB Function
+ * \param  hCb      		- Handle to Command CB Function Obj Parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS TWD_CfgAcParams (TI_HANDLE hTWD, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb);
+/** @ingroup QoS
+ * \brief	Configure Power Save RX Streaming
+ * 
+ * \param  hTWD    			- TWD module object handle
+ * \param  pPsRxStreaming  	- Pointer to Input Power Save RX Straeming Parameters Structure
+ * 								Fields that should be filled:
+ * 								pPsRxStreaming->uTid
+ * 								pPsRxStreaming->bEnabled
+ * 								pPsRxStreaming->uStreamPeriod
+ * 								pPsRxStreaming->uTxTimeout
+ * \param  fCb      		- Pointer to Command CB Function
+ * \param  hCb      		- Handle to Command CB Function Obj Parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa TPsRxStreaming
+ */
+TI_STATUS TWD_CfgPsRxStreaming (TI_HANDLE hTWD, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb);
+/** @ingroup Power_Management
+ * \brief	Configure BET
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  Enable    			- 0: disable BET, Otherwirs: Enable BET
+ * \param  MaximumConsecutiveET - Max number of consecutive beacons that may be early terminated
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS TWD_CfgBet (TI_HANDLE hTWD, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET);
+/** @ingroup UnKnown
+ * \brief  Configure Keep Alive
+ * 
+ * \param hTWD 				- TWD module object handle
+ * \param  pKeepAliveParams - Pointer to Keep Alive parameters structure
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configures the keep-alive paramters
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgKeepAlive (TI_HANDLE hTWD, TKeepAliveParams *pKeepAliveParams);
+/** @ingroup Power_Management
+ * \brief  Configure Keep Alive Enable/Disable flag
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  enaDisFlag  	- Indicates whether to Enable (TI_TRUE) or Disable Keep Alive
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgKeepAliveEnaDis (TI_HANDLE hTWD, TI_UINT8 enaDisFlag);
+/** @ingroup Data_Path
+ * \brief	Configure Set BA Initiator
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  uTid 				- TID number
+ * \param  uState 				- Policy : Enable / Disable 
+ * \param  tRa 					- Mac address of: SA as receiver / RA as initiator
+ * \param  uWinSize 			- windows size in number of packet
+ * \param  uInactivityTimeout 	- as initiator inactivity timeout in time units(TU) of 1024us / as receiver reserved
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * configure BA session initiator parameters setting in the FW
+ * called after join in order to init the parameters for negotiating BA sessions as initiator.
+ * Parameters initialized: RA, TID, WinSize, Inactivity Timeout and state = Enable/Disable.
+ * In case the host sends a broadcast address as RA the FW is allowed to Set or Deleted BA sessions 
+ * to any receiver for that TID.
+ * In case of disassociate the FW allowed to establish BA session just after get that command.
+ * That command will not need any respond from the FW. In case DELBA send to STA or from the 
+ * STA as initiator the FW doesn't send event to the host
+ * 
+ * \sa
+ */
+TI_STATUS TWD_CfgSetBaInitiator (TI_HANDLE hTWD, 
+								 TI_UINT8 uTid, 
+								 TI_UINT8 uState, 
+								 TMacAddr tRa, 
+								 TI_UINT16 uWinSize, 
+								 TI_UINT16 uInactivityTimeout);
+/** @ingroup Data_Path
+ * \brief	Configure Set BA Receiver
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  uTid 				- TID number
+ * \param  uState 				- Policy : Enable / Disable 
+ * \param  tRa 					- Mac address of: SA as receiver / RA as initiator
+ * \param  uWinSize 			- windows size in number of packet
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * configure BA session receiver parameters setting in the FW
+ * called after join in order to init the parameters for incoming BA session, as a responder.
+ * Parameters initialized: SA, TID, winSize and state = Enable/Disable.
+ * In case the host sends a broadcast address as SA the FW is allowed to Set/Deleted BA sessions 
+ * to any sender for that TID.
+ * In case of disassociate the FW allowed to establish BA session just after get that command.
+ * The events of that command will respond via the RX path from the FW: ADDBA, DELBA, BAR packets. 
+ * 
+ * \sa
+ */
+TI_STATUS TWD_CfgSetBaReceiver (TI_HANDLE hTWD, 
+								TI_UINT8 uTid, 
+								TI_UINT8 uState, 
+								TMacAddr tRa, 
+								TI_UINT16 uWinSize);
+
+/** @ingroup Data_Path
+ * \brief	Close all BA receiver sessions
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \return None
+ * 
+ * \par Description
+ * Close all BA receiver sessions and pass all packets in the TID queue to upper layer. 
+ * 
+ * \sa
+ */
+void TWD_CloseAllBaSessions(TI_HANDLE hTWD); 
+
+/** @ingroup BSS
+ * \brief	Set FW HT Capabilities
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  pHtCapabilitiesIe 	- Pointer to string of HT capability IE unparsed
+ * \param  bAllowHtOperation 	- TI_TRUE: HT operation allowed, Otherwise: HT operation NOT allowed
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Parse HT capability IE and set the current AP HT Capabilities to the FW
+ * 
+ * \sa
+ */
+TI_STATUS TWD_CfgSetFwHtCapabilities (TI_HANDLE hTWD, 
+									  Tdot11HtCapabilitiesUnparse *pHtCapabilitiesIe, 
+									  TI_BOOL bAllowHtOperation);
+/** @ingroup BSS
+ * \brief Set FW HT Information
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  pHtInformationIe 	- Pointer to string of HT information IE unparsed
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Parse HT Information IE and set the current AP HT Information to the FW
+ * 
+ * \sa
+ */
+TI_STATUS TWD_CfgSetFwHtInformation (TI_HANDLE hTWD, Tdot11HtInformationUnparse *pHtInformationIe);
+
+
+/** @ingroup UnKnown
+ * \brief Enable/Disabel burst mode
+ * 
+ * \param  hTWD    				- TWD module object handle
+ * \param  bEnabled 	        - burst mode: Enable/Disable 
+ * \return TI_OK
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+TI_STATUS TWD_CfgBurstMode (TI_HANDLE hTWD, TI_BOOL bEnabled);
+
+
+/*-------------*/
+/* Interrogate */
+/*-------------*/
+
+/** @ingroup UnKnown
+ * \brief  Interrogate Roamming Statistics
+ * 
+ * \param  hTWD     	- TWD module object handle
+ * \param  fCb          - Pointer to Command CB Function
+ * \param  hCb          - Handle to Command CB Function Obj Parameters
+ * \param  pCb          - Pointer to read parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Interrogate ACX Roamming Statistics
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_ItrRoammingStatisitics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb);
+/** @ingroup UnKnown
+ * \brief  Configure/Interrogate RSSI
+ * 
+ * \param  hTWD    	- TWD module object handle
+ * \param  fCb      - Pointer to Command CB Function
+ * \param  hCb      - Handle to Command CB Function Obj Parameters
+ * \param  pCb      - Pointer to read parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Configure/Interrogate StationId information element to/from FW
+ * This information element specifies the MAC Address assigned to the STATION or AP.
+ * The RSSI is Configed to default value which is the permanent MAC address which 
+ * is stored in the adaptor's non-volatile memory.
+ * 
+ * \sa 
+ */ 
+TI_STATUS TWD_ItrRSSI (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb);
+/** @ingroup UnKnown
+ * \brief	Interrogate Memory Map
+ * 
+ * \param  hTWD    	- TWD module object handle
+ * \param  pMap    	- Pointer to Output Memory Map
+ * \param  fCb    	- Pointer to Callback Function
+ * \param  hCb    	- Handle to Callback Function Parameters Object 
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Interrogate Memory Map from FW
+ *
+ * \sa MemoryMap_t
+ */TI_STATUS TWD_ItrMemoryMap (TI_HANDLE hTWD, MemoryMap_t *pMap, void *fCb, TI_HANDLE hCb);
+/** @ingroup UnKnown
+ * \brief	Interrogate Statistics
+ * 
+ * \param  hTWD    	- TWD module object handle
+ * \param  fCb      - Pointer to Command CB Function
+ * \param  hCb      - Handle to Command CB Function Obj Parameters
+ * \param  pCb      - Pointer to read parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa
+ */
+TI_STATUS TWD_ItrStatistics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb);
+/** @ingroup Data_Path
+ * \brief	Interrogate Data Filter Statistics
+ * 
+ * \param  hTWD    	- TWD module object handle
+ * \param  fCb      - Pointer to Command CB Function
+ * \param  hCb      - Handle to Command CB Function Obj Parameters
+ * \param  pCb      - Pointer to read parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ *
+ * \sa
+ */TI_STATUS TWD_ItrDataFilterStatistics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb);
+
+/*
+ * --------------------------------------------------------------
+ *	TNETW-Driver  Tx  API  Functions
+ * --------------------------------------------------------------
+ */
+
+/** @ingroup Data_Path
+ * \brief  TWD TX Control Block Allocation
+ * 
+ * \param  hTWD   	- TWD module object handle
+ * \return Pointer to Control Block Entry on success or NULL on failure
+ * 
+ * \par Description
+ * Use this function for Allocate a Control-Block for the packet Tx parameters and descriptor
+ * 
+ * \sa
+ */ 
+TTxCtrlBlk *TWD_txCtrlBlk_Alloc (TI_HANDLE hTWD);
+/** @ingroup Data_Path
+ * \brief  TWD TX Control Block Free
+ * 
+ * \param  hTWD   			- TWD module object handle
+ * \param  pCurrentEntry   	- Pointer to TX Control Block Entry to Free
+ * \return void
+ * 
+ * \par Description
+ * Use this function for Free a Control-Block of packet Tx parameters and descriptor
+ * 
+ * \sa
+ */ 
+void TWD_txCtrlBlk_Free (TI_HANDLE hTWD, TTxCtrlBlk *pCurrentEntry);
+/** @ingroup Data_Path
+ * \brief  TWD TX Control Get Pointer
+ * 
+ * \param  hTWD   	- TWD module object handle
+ * \param  descId  	- Id of TX Control Block Descriptor
+ * \return Pointer to Control Block Entry on success or NULL on failure
+ * 
+ * \par Description
+ * Use this function for Get a Pointer to a Control-Block of packet Tx parameters and descriptor
+ * 
+ * \sa
+ */ 
+TTxCtrlBlk *TWD_txCtrlBlk_GetPointer (TI_HANDLE hTWD, TI_UINT8 descId);
+
+/** @ingroup Data_Path
+ * \brief  Allocate Resources for TX HW Queue
+ * 
+ * \param  hTWD   			- TWD module object handle
+ * \param  pTxCtrlBlk  		- The Tx packet control block
+ * \return see - ETxHwQueStatus
+ * 
+ * \par Description
+ * Allocates Resources (HW-blocks number required) for TX HW Queue 
+ * 
+ * \sa
+ */ 
+ETxHwQueStatus TWD_txHwQueue_AllocResources (TI_HANDLE hTWD, TTxCtrlBlk *pTxCtrlBlk);
+
+/** @ingroup Data_Path
+ * \brief  TX Xfer Send Packet
+ * 
+ * \param  hTWD   			- TWD module object handle
+ * \param  pPktCtrlBlk   	- Pointer to TX Control Block Entry to Free
+ * \return see ETxnStatus
+ * 
+ * \par Description
+ * Send Packet via TX Xfer 
+ * 
+ * \sa
+ */ 
+ETxnStatus TWD_txXfer_SendPacket (TI_HANDLE hTWD, TTxCtrlBlk *pPktCtrlBlk);
+/** @ingroup Control
+ * \brief  Watch Dog Expire Event
+ * 
+ * \param  hTWD   			- TWD module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * This function handles the Event of Watch Dog Expire (FW stopped)
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_WdExpireEvent (TI_HANDLE hTWD);
+/*
+ * --------------------------------------------------------------
+ *	BIT API Functions
+ * --------------------------------------------------------------
+ */
+/** @ingroup Control
+ * \brief TWD Test Command Complete CB
+ * 
+ * \param  Handle        	- handle to object
+ * \param  eStatus			- Status of Driver Test Performed
+ * \param  pTestCmdParams  	- Pointer to Output of Test Command Parameters
+ * \return void
+ * 
+ * \par Description
+ * The function prototype for the BIT Test Command Complete CB
+ * Enables user to implement and use its own BIT Test Command Complete CB 
+ * which will be called when Driver Test end
+ * 
+ * \sa	TWDriverTest
+ */ 
+typedef void (*TTestCmdCB)(TI_HANDLE Handle, 
+						   TI_STATUS eStatus, 
+						   TI_HANDLE pTestCmdParams);
+/** @ingroup Control
+ * \brief TWD Test Command Complete CB
+ * 
+ * \param  Handle        	- handle to object
+ * \param  eStatus			- Status of Driver Test Performed (Complete/Pending/Error)
+ * \param  pTestCmdParams  	- Pointer to Output of Test Command Parameters
+ * \return void
+ * 
+ * \par Description
+ * The function implementation for the BIT Test Command Complete CB
+ * 
+ * \sa
+ */ 
+void TWDriverTestCB(TI_HANDLE Handle, 
+					TI_STATUS eStatus, 
+					TI_HANDLE pTestCmdParams);
+/** @ingroup Control
+ * \brief TWD Driver Test
+ * 
+ * \param  hTWD        		- handle to TWD object
+ * \param  eTestCmd			- Identifier of test Command to Perform
+ * \param  pTestCmdParams  	- Pointer to Input/Output Test Command Parameters
+ * \param  fCb  			- Test Command Complete CB
+ * \param  hCb	  			- Handle to Test Command Complete CB Parameters
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * The implementation of the BIT Test Command
+ * 
+ * \sa
+ */ 
+TI_STATUS TWDriverTest(TI_HANDLE hTWD, 
+					   TestCmdID_enum eTestCmd, 
+					   void* pTestCmdParams, 
+					   TTestCmdCB fCb, 
+					   TI_HANDLE hCb);
+
+
+
+/** 
+ *  \brief TWD get FEM type
+ *  * 
+ * \param  Handle        	- handle to object
+ * \return uint8 
+ * 
+ * \par Description
+ * The function return the Front end module that was read frm FW register * 
+ * \sa
+ */ 
+
+TI_UINT8 TWD_GetFEMType (TI_HANDLE hTWD);
+
+
+/** 
+ *  \brief TWD end function of read radio state machine
+ *  *  * 
+ * \param  Handle        	- handle to object
+ * \return void
+ * 
+ * \par Description
+ * The function calling to HwInit call back function, after finish reading FEM registers * 
+ * \sa
+ */ 
+
+void TWD_FinalizeFEMRead(TI_HANDLE hTWD);
+void TWD_FinalizePolarityRead(TI_HANDLE hTWD);
+
+/**
+ * \function TWD_rxXfer_Handle
+ * 
+ *  Handle Rx buffers read in case we delayed it from upper layer 
+ * 
+ * \param hTWD 				- TWD module object handle
+ *
+ * \sa
+ */ 
+void TWD_rxXfer_Handle (TI_HANDLE hTWD);
+
+TI_STATUS TWD_SetRateMngDebug(TI_HANDLE hTWD, RateMangeParams_t *pRateMngParams);
+TI_STATUS TWD_GetRateMngDebug(TI_HANDLE hTWD, RateMangeReadParams_t  *pParamInfo);
+
+#endif  /* TWDRIVER_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriverCtrl.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,944 @@
+/*
+ * TWDriverCtrl.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TWDriver.c 
+ *  \brief TI WLAN Hardware Access Driver, Parameters control
+ *
+ *  \see   TWDriver.h 
+ */
+
+#define __FILE_ID__  FILE_ID_118
+#include "TWDriver.h"
+#include "tidef.h"
+#include "report.h"
+#include "txHwQueue_api.h"
+#include "txXfer_api.h"
+#include "txResult_api.h"
+#include "eventMbox_api.h" 
+#include "TWDriver.h"
+#include "TWDriverInternal.h"
+#include "FwEvent_api.h"
+#include "CmdBld.h"
+#include "RxQueue_api.h"
+
+
+TI_STATUS TWD_SetParam (TI_HANDLE hTWD, TTwdParamInfo *pParamInfo)
+{
+    TTwd           *pTWD = (TTwd *)hTWD;
+    TWlanParams    *pWlanParams = &DB_WLAN(pTWD->hCmdBld);
+
+    TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetParam: paramType=0x%X\n", pParamInfo->paramType);
+
+    switch (pParamInfo->paramType)
+    {
+        case TWD_RTS_THRESHOLD_PARAM_ID:
+
+            if  (pParamInfo->content.halCtrlRtsThreshold > TWD_RTS_THRESHOLD_MAX)
+            {
+                TRACE1(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD########TWD_RTS_THRESHOLD_PARAM: Value out of permitted range 0x%x\n", pParamInfo->content.halCtrlRtsThreshold);
+                return (PARAM_VALUE_NOT_VALID);
+            }
+
+            if (cmdBld_CfgRtsThreshold (pTWD->hCmdBld, pParamInfo->content.halCtrlRtsThreshold, NULL, NULL) == TI_OK)
+            {
+                TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########TWD_RTS_THRESHOLD_PARAM 0x%x\n", pParamInfo->content.halCtrlRtsThreshold);
+                pWlanParams->RtsThreshold = pParamInfo->content.halCtrlRtsThreshold;
+            }
+            break;
+
+        case TWD_CTS_TO_SELF_PARAM_ID:
+            return cmdBld_CfgCtsProtection (pTWD->hCmdBld, pParamInfo->content.halCtrlCtsToSelf, NULL, NULL);
+
+        case TWD_RX_TIME_OUT_PARAM_ID:
+            if (cmdBld_CfgServicePeriodTimeout (pTWD->hCmdBld, &pParamInfo->content.halCtrlRxTimeOut, NULL, NULL) == TI_OK)
+            {
+                pWlanParams->rxTimeOut.psPoll = pParamInfo->content.halCtrlRxTimeOut.psPoll;
+                pWlanParams->rxTimeOut.UPSD   = pParamInfo->content.halCtrlRxTimeOut.UPSD;  
+            }
+            break;
+
+        case TWD_FRAG_THRESHOLD_PARAM_ID:
+            if (pParamInfo->content.halCtrlFragThreshold < TWD_FRAG_THRESHOLD_MIN ||
+                pParamInfo->content.halCtrlFragThreshold > TWD_FRAG_THRESHOLD_MAX)
+                return PARAM_VALUE_NOT_VALID;
+
+            cmdBld_CfgFragmentThreshold (pTWD->hCmdBld, pParamInfo->content.halCtrlFragThreshold, NULL, NULL);
+            break;
+
+        case TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID:
+            cmdBld_CfgRxMsduLifeTime (pTWD->hCmdBld, pParamInfo->content.halCtrlMaxRxMsduLifetime, NULL, NULL);
+            break;
+
+        case TWD_ACX_STATISTICS_PARAM_ID:
+            if (cmdBld_CfgStatisitics (pTWD->hCmdBld, NULL, NULL) != TI_OK)
+                return TI_NOK;
+            break;
+
+        case TWD_LISTEN_INTERVAL_PARAM_ID:
+            if (pParamInfo->content.halCtrlListenInterval < TWD_LISTEN_INTERVAL_MIN ||
+                pParamInfo->content.halCtrlListenInterval > TWD_LISTEN_INTERVAL_MAX)
+                return PARAM_VALUE_NOT_VALID;
+
+            pWlanParams->ListenInterval = (TI_UINT8)pParamInfo->content.halCtrlListenInterval;
+            break;
+
+        case TWD_AID_PARAM_ID:
+            pWlanParams->Aid = pParamInfo->content.halCtrlAid;
+
+            /* Configure the ACXAID info element*/
+            if (cmdBld_CfgAid (pTWD->hCmdBld, pParamInfo->content.halCtrlAid, NULL, NULL) != TI_OK)
+               return TI_NOK;
+            break;
+
+        case TWD_RSN_HW_ENC_DEC_ENABLE_PARAM_ID:
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########HW_ENC_DEC_ENABLE %d\n", pParamInfo->content.rsnHwEncDecrEnable);
+
+            /* Set the Encryption/Decryption on the HW*/
+            if (cmdBld_CfgHwEncDecEnable (pTWD->hCmdBld, pParamInfo->content.rsnHwEncDecrEnable, NULL, NULL) != TI_OK)
+                return (TI_NOK);
+            break;
+
+        case TWD_RSN_KEY_ADD_PARAM_ID:
+            TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########KEY_ADD\n");
+
+            if (cmdBld_CmdAddKey (pTWD->hCmdBld,
+                                  (TSecurityKeys *) pParamInfo->content.configureCmdCBParams.pCb,
+                                  TI_FALSE,
+                                  pParamInfo->content.configureCmdCBParams.fCb, 
+                                  pParamInfo->content.configureCmdCBParams.hCb) != TI_OK)
+                return TI_NOK;
+            break;
+
+        case TWD_RSN_KEY_REMOVE_PARAM_ID:
+            TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########KEY_REMOVE\n");
+
+            if (cmdBld_CmdRemoveKey (pTWD->hCmdBld, 
+                                     (TSecurityKeys *) pParamInfo->content.configureCmdCBParams.pCb,
+                                     pParamInfo->content.configureCmdCBParams.fCb, 
+                                     pParamInfo->content.configureCmdCBParams.hCb) != TI_OK)
+                return TI_NOK;
+            break;
+
+        case TWD_RSN_DEFAULT_KEY_ID_PARAM_ID:
+            if (*((TI_UINT8 *)pParamInfo->content.configureCmdCBParams.pCb) > MAX_DEFAULT_KEY_ID)
+                return PARAM_VALUE_NOT_VALID;
+
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########DEFAULT_KEY_ID %d\n", (TI_UINT8)pParamInfo->content.rsnDefaultKeyID);
+
+			if (cmdBld_CmdSetWepDefaultKeyId (pTWD->hCmdBld,
+									  *((TI_UINT8 *)pParamInfo->content.interogateCmdCBParams.pCb),
+									  pParamInfo->content.interogateCmdCBParams.fCb, 
+									  pParamInfo->content.interogateCmdCBParams.hCb) != TI_OK) 
+                return TI_NOK;
+
+            break;
+
+        case TWD_RSN_SECURITY_MODE_PARAM_ID:
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD########SECURITY_MODE_SET %d\n", pParamInfo->content.rsnEncryptionStatus);
+            if (cmdBld_CfgSecureMode (pTWD->hCmdBld, (ECipherSuite)pParamInfo->content.rsnEncryptionStatus, NULL, NULL) != TI_OK)
+                return TI_NOK;
+            break;
+
+#ifdef XCC_MODULE_INCLUDED
+        case TWD_RSN_XCC_SW_ENC_ENABLE_PARAM_ID:
+        
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD: XCC_SW_ENC_ENABLE %d\n", pParamInfo->content.rsnXCCSwEncFlag);
+
+            /* when SW encryption is ON, HW encryption should be turned OFF and vice versa */
+
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD: Set HwEncDecrEnable to %d\n", !pParamInfo->content.rsnXCCSwEncFlag);
+
+            /* Set the Encryption/Decryption on the HW*/
+            if (cmdBld_CfgHwEncDecEnable (pTWD->hCmdBld, !pParamInfo->content.rsnXCCSwEncFlag, NULL, NULL) != TI_OK)
+                return TI_NOK;
+            break;
+             /* not supported - CKIP*/
+        case TWD_RSN_XCC_MIC_FIELD_ENABLE_PARAM_ID:
+            break;
+#endif /* XCC_MODULE_INCLUDED*/
+
+        case TWD_TX_POWER_PARAM_ID:
+
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_TX_POWER_PARAM_ID %d\n", pParamInfo->content.halCtrlTxPowerDbm);
+
+			if (pWlanParams->TxPowerDbm == pParamInfo->content.halCtrlTxPowerDbm)
+			{	/* Save up time if we set the same value */
+				return PARAM_ALREADY_CONFIGURED;
+			}
+
+
+            pWlanParams->TxPowerDbm = pParamInfo->content.halCtrlTxPowerDbm;
+
+            /* Configure the wlan hardware */
+            if (cmdBld_CfgTxPowerDbm (pTWD->hCmdBld, pWlanParams->TxPowerDbm, NULL, NULL) != TI_OK)
+                return TI_NOK;
+            break;
+
+        case TWD_SG_ENABLE_PARAM_ID:
+            return cmdBld_CfgSgEnable (pTWD->hCmdBld, 
+                                       (ESoftGeminiEnableModes)pParamInfo->content.SoftGeminiEnable, 
+                                       NULL, 
+                                       NULL);
+
+        case TWD_SG_CONFIG_PARAM_ID:
+            return cmdBld_CfgSg (pTWD->hCmdBld, &pParamInfo->content.SoftGeminiParam, NULL, NULL);
+
+        case TWD_FM_COEX_PARAM_ID:
+            return cmdBld_CfgFmCoex (pTWD->hCmdBld, &pParamInfo->content.tFmCoexParams, NULL, NULL);
+
+        /*
+         *  TX Parameters 
+         */ 
+
+        case TWD_TX_RATE_CLASS_PARAM_ID:
+            return cmdBld_CfgTxRatePolicy (pTWD->hCmdBld, pParamInfo->content.pTxRatePlicy, NULL, NULL);
+
+        case TWD_QUEUES_PARAM_ID:
+            return cmdBld_CfgTid (pTWD->hCmdBld, pParamInfo->content.pQueueTrafficParams, NULL, NULL);
+
+        case TWD_CLK_RUN_ENABLE_PARAM_ID:
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION, "TWD_SetParam: CLK_RUN_ENABLE %d\n", pParamInfo->content.halCtrlClkRunEnable);
+
+            /* Set the Encryption/Decryption on the HW*/
+            if (cmdBld_CfgClkRun (pTWD->hCmdBld, pParamInfo->content.halCtrlClkRunEnable, NULL, NULL) != TI_OK)
+                return TI_NOK;
+            break;
+
+        case TWD_COEX_ACTIVITY_PARAM_ID:
+            cmdBld_CfgCoexActivity (pTWD->hCmdBld, pParamInfo->content.tTwdParamsCoexActivityTable.entry, NULL, NULL);
+
+            break;
+
+        case TWD_DCO_ITRIM_PARAMS_ID:
+            cmdBld_CfgDcoItrimParams (pTWD->hCmdBld, pParamInfo->content.tDcoItrimParams.enable, 
+                                      pParamInfo->content.tDcoItrimParams.moderationTimeoutUsec, NULL, NULL);
+            break;
+
+        default:
+            TRACE1(pTWD->hReport, REPORT_SEVERITY_ERROR, "TWD_SetParam - ERROR - Param is not supported, 0x%x\n", pParamInfo->paramType);
+            return PARAM_NOT_SUPPORTED;
+    }
+
+    return TI_OK;
+}
+
+TI_STATUS TWD_GetParam (TI_HANDLE hTWD, TTwdParamInfo *pParamInfo)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetParam: called\n");
+
+    return cmdBld_GetParam (pTWD->hCmdBld, pParamInfo);
+}
+
+TI_STATUS TWD_CfgRx (TI_HANDLE hTWD, TI_UINT32 uRxConfigOption, TI_UINT32 uRxFilterOption)
+{
+    TTwd     *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgRx: called\n");
+
+    return cmdBld_CfgRx (pTWD->hCmdBld, uRxConfigOption, uRxFilterOption, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgArpIpAddrTable (TI_HANDLE hTWD, TIpAddr tIpAddr, TI_BOOL bEnabled, EIpVer eIpVer)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgArpIpAddrTable: called\n");
+
+    return cmdBld_CfgArpIpAddrTable (pTWD->hCmdBld, tIpAddr, bEnabled, eIpVer, NULL, NULL);
+}
+
+/** @ingroup Misc
+ * \brief  Configure ARP IP Filter
+ * 
+ * \param hTWD 			- TWD module object handle
+ * \param  bEnabled   	- Indicates if ARP filtering is Enabled (1) or Disabled (0)
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_CfgArpIpFilter (TI_HANDLE hTWD, TI_BOOL bEnabled)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgArpIpFilter: called\n");
+
+    return cmdBld_CfgArpIpFilter (pTWD->hCmdBld, bEnabled, NULL, NULL);
+}
+
+TI_STATUS TWD_CmdSetSplitScanTimeOut  ( TI_HANDLE hTWD, TI_UINT32 uTimeOut )
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdSetSplitScanTimeOut: called\n");
+
+    return cmdBld_CmdSetSplitScanTimeOut (pTWD->hCmdBld, uTimeOut);
+}
+
+TI_STATUS TWD_CmdJoinBss (TI_HANDLE hTWD, TJoinBss *pJoinBssParams)
+{
+    TTwd      *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdJoinBss: called\n");
+
+    return cmdBld_CmdJoinBss (pTWD->hCmdBld, pJoinBssParams, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgKeepAlive (TI_HANDLE hTWD, TKeepAliveParams *pKeepAliveParams)
+{
+    TTwd      *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgKeepAlive: called\n");
+
+    return cmdBld_CfgKeepAlive (pTWD->hCmdBld, pKeepAliveParams, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgKeepAliveEnaDis(TI_HANDLE hTWD, TI_UINT8 enaDisFlag)
+{
+    TTwd      *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgKeepAliveEnaDis: called\n");
+
+    return cmdBld_CfgKeepAliveEnaDis (pTWD->hCmdBld, enaDisFlag, NULL, NULL);
+}
+
+TI_STATUS TWD_CmdTemplate (TI_HANDLE hTWD, TSetTemplate *pTemplateParams, void *fCb, TI_HANDLE hCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdTemplate: called\n");
+
+    return cmdBld_CmdTemplate (pTWD->hCmdBld, pTemplateParams, fCb, hCb);
+}
+
+TI_STATUS TWD_CfgSlotTime (TI_HANDLE hTWD, ESlotTime eSlotTimeVal)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSlotTime: called\n");
+
+    return cmdBld_CfgSlotTime (pTWD->hCmdBld, eSlotTimeVal, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgPreamble (TI_HANDLE hTWD, EPreamble ePreamble)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgPreamble: called\n");
+
+    return cmdBld_CfgPreamble (pTWD->hCmdBld, (Preamble_e)ePreamble, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgPacketDetectionThreshold (TI_HANDLE hTWD, TI_UINT32 threshold)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgPacketDetectionThreshold: called\n");
+
+    return cmdBld_CfgPacketDetectionThreshold (pTWD->hCmdBld, threshold, NULL, NULL);
+}
+
+TI_STATUS TWD_CmdDisableTx (TI_HANDLE hTWD)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+    
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdDisableTx: called\n");
+
+    return cmdBld_CmdDisableTx (pTWD->hCmdBld, NULL, NULL);
+}
+    
+TI_STATUS TWD_CmdEnableTx (TI_HANDLE hTWD, TI_UINT8 channel)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+        
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdEnableTx: called\n");
+
+    return cmdBld_CmdEnableTx (pTWD->hCmdBld, channel, NULL, NULL);
+}
+
+TI_STATUS TWD_CmdSetStaState (TI_HANDLE hTWD, TI_UINT8 staState, void *fCb, TI_HANDLE hCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE1(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetStaState: %d\n", staState);
+
+    return cmdBld_CmdSetStaState (pTWD->hCmdBld, staState, fCb, hCb);
+}
+
+TI_STATUS TWD_ItrRoammingStatisitics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void * pCb)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrRoammingStatisitics: called\n");
+
+    return cmdBld_ItrRoamimgStatisitics (pTWD->hCmdBld, fCb, hCb, pCb);
+}
+
+/** @ingroup UnKnown
+ * \brief	Interrogate Error Count
+ * 
+ * \param  hTWD     	- TWD module object handle
+ * \param  fCb          - Pointer to Command CB Function
+ * \param  hCb          - Handle to Command CB Function Obj Parameters
+ * \param  pCb          - Pointer to read parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Interrogate ACX Error counter
+ * 
+ * \sa
+ */ 
+TI_STATUS TWD_ItrErrorCnt (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrErrorCnt: called\n");
+
+    return cmdBld_ItrErrorCnt (pTWD->hCmdBld, fCb, hCb, pCb);
+}
+
+TI_STATUS TWD_CmdNoiseHistogram (TI_HANDLE hTWD, TNoiseHistogram *pNoiseHistParams)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdNoiseHistogram: called\n");
+
+    return cmdBld_CmdNoiseHistogram (pTWD->hCmdBld, pNoiseHistParams, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgBeaconFilterOpt (TI_HANDLE hTWD, TI_UINT8 uBeaconFilteringStatus, TI_UINT8 uNumOfBeaconsToBuffer)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+       
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgBeaconFilterOpt: called\n");
+
+    return cmdBld_CfgBeaconFilterOpt (pTWD->hCmdBld, uBeaconFilteringStatus, uNumOfBeaconsToBuffer, NULL, NULL);
+}
+
+TI_STATUS TWD_SetRateMngDebug(TI_HANDLE hTWD, RateMangeParams_t *pRateMngParams)
+{
+  TTwd   *pTWD = (TTwd *)hTWD;
+
+   TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetRateMngDebug: called\n");
+
+   return cmdBld_CfgRateMngDbg (pTWD->hCmdBld, pRateMngParams, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgBeaconFilterTable (TI_HANDLE hTWD, TI_UINT8 uNumOfIe, TI_UINT8 *pIeTable, TI_UINT8 uIeTableSize)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+      
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgBeaconFilterTable: called\n");
+
+    return cmdBld_CfgBeaconFilterTable (pTWD->hCmdBld, uNumOfIe, pIeTable, uIeTableSize, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgWakeUpCondition (TI_HANDLE hTWD, TPowerMgmtConfig *pPowerMgmtConfig)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgWakeUpCondition: called\n");
+
+    return cmdBld_CfgWakeUpCondition (pTWD->hCmdBld, pPowerMgmtConfig, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgBcnBrcOptions (TI_HANDLE hTWD, TPowerMgmtConfig *pPowerMgmtConfig)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgBcnBrcOptions: called\n");
+
+    return cmdBld_CfgBcnBrcOptions (pTWD->hCmdBld, pPowerMgmtConfig, NULL, NULL);
+}
+
+TFwInfo * TWD_GetFWInfo (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetFWInfo: called\n");
+
+    return cmdBld_GetFWInfo (pTWD->hCmdBld);
+}
+
+TI_STATUS TWD_CmdSwitchChannel (TI_HANDLE hTWD, TSwitchChannelParams *pSwitchChannelCmd)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdSwitchChannel: called\n");
+
+    return cmdBld_CmdSwitchChannel (pTWD->hCmdBld, pSwitchChannelCmd, NULL, NULL);
+}
+
+TI_STATUS TWD_CmdSwitchChannelCancel (TI_HANDLE hTWD, TI_UINT8 channel)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdSwitchChannelCancel: called\n");
+
+    return cmdBld_CmdSwitchChannelCancel (pTWD->hCmdBld, channel, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgMaxTxRetry (TI_HANDLE hTWD, TRroamingTriggerParams *pRoamingTriggerCmd)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgMaxTxRetry: called\n");
+
+    return cmdBld_CfgMaxTxRetry (pTWD->hCmdBld, pRoamingTriggerCmd, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgConnMonitParams (TI_HANDLE hTWD, TRroamingTriggerParams *pRoamingTriggerCmd)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgConnMonitParams: called\n");
+
+    return cmdBld_CfgConnMonitParams (pTWD->hCmdBld, pRoamingTriggerCmd, NULL, NULL);
+}
+
+TI_STATUS TWD_ItrRSSI (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrRSSI: called\n");
+
+    return cmdBld_ItrRSSI (pTWD->hCmdBld, fCb, hCb, pCb);
+}
+
+TI_STATUS TWD_CmdFwDisconnect (TI_HANDLE hTWD, DisconnectType_e uDisconType, TI_UINT16 uDisconReason)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    return cmdBld_CmdFwDisconnect (pTWD->hCmdBld, 
+                                   RX_CONFIG_OPTION_MY_DST_MY_BSS, 
+                                   RX_FILTER_OPTION_FILTER_ALL, 
+                                   uDisconType, 
+                                   uDisconReason, 
+                                   NULL, 
+                                   NULL);
+}
+
+TI_STATUS TWD_CmdMeasurement (TI_HANDLE           hTWD, 
+                              TMeasurementParams *pMeasurementParams,
+                              void               *fCommandResponseCb, 
+                              TI_HANDLE           hCb)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdMeasurement: called\n");
+
+    return cmdBld_CmdMeasurement (pTWD->hCmdBld, pMeasurementParams, fCommandResponseCb, hCb);
+}
+
+TI_STATUS TWD_CmdMeasurementStop (TI_HANDLE hTWD, void* fCb, TI_HANDLE hCb)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdMeasurementStop: called\n");
+
+    return cmdBld_CmdMeasurementStop (pTWD->hCmdBld, fCb, hCb);
+}
+
+TI_STATUS TWD_CmdApDiscovery (TI_HANDLE hTWD, TApDiscoveryParams *pApDiscoveryParams)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdApDiscovery: called\n");
+
+    return cmdBld_CmdApDiscovery (pTWD->hCmdBld, pApDiscoveryParams, NULL, NULL);
+}
+
+TI_STATUS TWD_CmdApDiscoveryStop (TI_HANDLE hTWD)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdApDiscoveryStop: called\n");
+
+    return cmdBld_CmdApDiscoveryStop (pTWD->hCmdBld, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgGroupAddressTable (TI_HANDLE     hTWD, 
+                                    TI_UINT8      uNumGroupAddrs, 
+                                    TMacAddr      *pGroupAddr,
+                                    TI_BOOL       bEnabled)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgGroupAddressTable: called\n");
+
+    return cmdBld_CfgGroupAddressTable (pTWD->hCmdBld, uNumGroupAddrs, pGroupAddr, bEnabled, NULL, NULL);
+}
+
+TI_STATUS TWD_GetGroupAddressTable (TI_HANDLE hTWD, TI_UINT8* pEnabled, TI_UINT8* pNumGroupAddrs, TMacAddr *pGroupAddr)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_GetGroupAddressTable: called\n");
+
+    return cmdBld_GetGroupAddressTable (pTWD->hCmdBld, pEnabled, pNumGroupAddrs, pGroupAddr);
+}
+
+TI_STATUS TWD_SetRadioBand (TI_HANDLE hTWD, ERadioBand eRadioBand)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetRadioBand: called\n");
+
+    return cmdBld_SetRadioBand (pTWD->hCmdBld, eRadioBand);
+}
+
+TI_STATUS TWD_CfgSleepAuth (TI_HANDLE hTWD, EPowerPolicy eMinPowerPolicy)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSleepAuth: called\n");
+
+    /* Configure the new power policy to the FW */
+    cmdBld_CfgSleepAuth (pTWD->hCmdBld, eMinPowerPolicy, NULL, NULL);
+
+    return TI_OK;
+}
+
+TI_STATUS TWD_CfgBurstMode (TI_HANDLE hTWD, TI_BOOL bEnabled)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "cmdBld_CfgBurstMode: called\n");
+
+    /* Configure the burst mode to the FW */
+    cmdBld_CfgBurstMode (pTWD->hCmdBld, bEnabled, NULL, NULL);
+
+    return TI_OK;
+}
+
+
+
+TI_STATUS TWD_CmdHealthCheck (TI_HANDLE hTWD)
+{
+    TTwd   *pTWD = (TTwd *)hTWD;
+    
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CmdHealthCheck: called\n");
+
+    return cmdBld_CmdHealthCheck (pTWD->hCmdBld, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgMacClock (TI_HANDLE hTWD, TI_UINT32 uMacClock)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgMacClock: called\n");
+
+    return cmdBld_CfgMacClock (pTWD->hCmdBld, uMacClock, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgArmClock (TI_HANDLE hTWD, TI_UINT32 uArmClock)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgArmClock: called\n");
+
+    return cmdBld_CfgArmClock (pTWD->hCmdBld, uArmClock, NULL, NULL);
+}
+
+TI_STATUS TWD_ItrMemoryMap (TI_HANDLE hTWD, MemoryMap_t *pMap, void *fCb, TI_HANDLE hCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrMemoryMap: called\n");
+
+    return cmdBld_ItrMemoryMap (pTWD->hCmdBld, pMap, fCb, hCb);
+}
+
+TI_STATUS TWD_ItrStatistics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrStatistics: called\n");
+
+    return cmdBld_ItrStatistics (pTWD->hCmdBld, fCb, hCb, pCb);
+}
+
+TI_STATUS TWD_ItrDataFilterStatistics (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void *pCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_ItrDataFilterStatistics: called\n");
+
+    return cmdBld_ItrDataFilterStatistics (pTWD->hCmdBld, fCb, hCb, pCb);
+}
+
+TI_STATUS TWD_CfgEnableRxDataFilter (TI_HANDLE hTWD, TI_BOOL bEnabled, filter_e eDefaultAction)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgEnableRxDataFilter: called\n");
+
+    return cmdBld_CfgEnableRxDataFilter (pTWD->hCmdBld, bEnabled, eDefaultAction, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgRxDataFilter (TI_HANDLE    hTWD, 
+                               TI_UINT8     index, 
+                               TI_UINT8     command, 
+                               filter_e     eAction, 
+                               TI_UINT8     uNumFieldPatterns, 
+                               TI_UINT8     uLenFieldPatterns, 
+                               TI_UINT8     *pFieldPatterns)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgRxDataFilter: called\n");
+
+    return cmdBld_CfgRxDataFilter (pTWD->hCmdBld, 
+                                   index, 
+                                   command, 
+                                   eAction, 
+                                   uNumFieldPatterns, 
+                                   uLenFieldPatterns, 
+                                   pFieldPatterns, 
+                                   NULL, 
+                                   NULL);
+}
+
+TI_STATUS TWD_CfgRssiSnrTrigger (TI_HANDLE hTWD, RssiSnrTriggerCfg_t* pRssiSnrTrigger)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgRssiSnrTrigger: called\n");
+
+    return cmdBld_CfgRssiSnrTrigger (pTWD->hCmdBld, pRssiSnrTrigger, NULL, NULL);
+}
+
+TI_STATUS TWD_CfgAcParams (TI_HANDLE hTWD, TAcQosParams *pAcQosParams, void *fCb, TI_HANDLE hCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgAcParams: called\n");
+
+    return cmdBld_CfgAcParams (pTWD->hCmdBld, pAcQosParams, fCb, hCb);
+}
+
+TI_STATUS TWD_CfgPsRxStreaming (TI_HANDLE hTWD, TPsRxStreaming *pPsRxStreaming, void *fCb, TI_HANDLE hCb)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgPsRxStreaming: called\n");
+
+    return cmdBld_CfgPsRxStreaming (pTWD->hCmdBld, pPsRxStreaming, fCb, hCb);
+}
+
+TI_STATUS TWD_CfgBet (TI_HANDLE hTWD, TI_UINT8 Enable, TI_UINT8 MaximumConsecutiveET)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgBet: called\n");
+
+    return cmdBld_CfgBet (pTWD->hCmdBld, Enable, MaximumConsecutiveET, NULL, NULL);
+}
+
+TI_STATUS TWD_SetSecuritySeqNum (TI_HANDLE hTWD, TI_UINT8 securitySeqNumLsByte)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_SetSecuritySeqNum: called\n");
+
+    return cmdBld_SetSecuritySeqNum (pTWD->hCmdBld, securitySeqNumLsByte);
+}
+
+TI_STATUS TWD_CfgSetFwHtCapabilities (TI_HANDLE hTWD, 
+									  Tdot11HtCapabilitiesUnparse *pHtCapabilitiesIe, 
+									  TI_BOOL bAllowHtOperation)
+{
+    TTwd        *pTWD           = (TTwd *)hTWD;
+    TI_UINT32   uHtCapabilites;
+    TI_UINT8    uAmpduMaxLeng = 0;
+    TI_UINT8    uAmpduMinSpac = 0; 
+    TI_UINT16   uHtCapabilitesField;
+
+    /* Note, currently this value will be set to FFFFFFFFFFFF to indicate it is relevant for all peers 
+       since we only support HT in infrastructure mode. Later on this field will be relevant to IBSS/DLS operation */
+    TMacAddr    tMacAddress = {0xff,0xff,0xff,0xff,0xff,0xff};
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSetFwHtCapabilities: called\n");
+
+    /* Allow HT Operation ? */
+    if (bAllowHtOperation == TI_TRUE)
+    {
+       /* get date from HT capabilities field */
+       /* Handle endian for the field */
+       COPY_WLAN_WORD(&uHtCapabilitesField, pHtCapabilitiesIe->aHtCapabilitiesIe);
+       uHtCapabilites = FW_CAP_BIT_MASK_HT_OPERATION |
+                        ((uHtCapabilitesField & HT_CAP_GREENFIELD_FRAME_FORMAT_BITMASK)    ? FW_CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT       : 0) |
+                        ((uHtCapabilitesField & HT_CAP_SHORT_GI_FOR_20MHZ_BITMASK)         ? FW_CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS    : 0) |
+                        ((uHtCapabilitesField & HT_CAP_LSIG_TXOP_PROTECTION_BITMASK)       ? FW_CAP_BIT_MASK_LSIG_TXOP_PROTECTION          : 0);
+
+       /* get date from HT capabilities field */
+       uHtCapabilites |= ((uHtCapabilitesField & HT_EXT_HT_CONTROL_FIELDS_BITMASK) ? FW_CAP_BIT_MASK_HT_CONTROL_FIELDS : 0) |
+                         ((uHtCapabilitesField & HT_EXT_RD_INITIATION_BITMASK)     ? FW_CAP_BIT_MASK_RD_INITIATION     : 0);
+
+       /* get date from A-MPDU parameters field */
+       uAmpduMaxLeng = pHtCapabilitiesIe->aHtCapabilitiesIe[HT_CAP_AMPDU_PARAMETERS_FIELD_OFFSET] & HT_CAP_AMPDU_MAX_RX_FACTOR_BITMASK;
+       uAmpduMinSpac = (pHtCapabilitiesIe->aHtCapabilitiesIe[HT_CAP_AMPDU_PARAMETERS_FIELD_OFFSET] >> 2) & HT_CAP_AMPDU_MIN_START_SPACING_BITMASK;
+    }
+    /* not Allow HT Operation */
+    else
+    {
+        uHtCapabilites = 0;
+    }
+
+    return cmdBld_CfgSetFwHtCapabilities (pTWD->hCmdBld,
+                                          uHtCapabilites,
+                                          tMacAddress,
+                                          uAmpduMaxLeng,
+                                          uAmpduMinSpac,
+                                          NULL, 
+                                          NULL);
+}
+
+TI_STATUS TWD_CfgSetFwHtInformation (TI_HANDLE hTWD, Tdot11HtInformationUnparse *pHtInformationIe)
+{
+    TTwd        *pTWD           = (TTwd *)hTWD;
+    TI_UINT8    uRifsMode;
+    TI_UINT8    uHtProtection; 
+    TI_UINT8    uGfProtection;
+    TI_UINT8    uHtTxBurstLimit;
+    TI_UINT8    uDualCtsProtection;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSetFwHtInformation: called\n");
+
+    uRifsMode = (pHtInformationIe->aHtInformationIe[1] & HT_INF_RIFS_MOD_BITMASK) >> 3;
+
+    uHtProtection = (pHtInformationIe->aHtInformationIe[2] & HT_INF_OPERATION_MOD_BITMASK);
+
+    uGfProtection = (pHtInformationIe->aHtInformationIe[3] & HT_INF_NON_GF_PRES_BITMASK) >> 2; 
+
+    uHtTxBurstLimit = (pHtInformationIe->aHtInformationIe[3] & HT_INF_TX_BURST_LIMIT_BITMASK) >> 3; 
+
+    uDualCtsProtection = (pHtInformationIe->aHtInformationIe[4] & HT_INF_DUAL_BEACON_BITMASK) >> 6; 
+
+    return cmdBld_CfgSetFwHtInformation (pTWD->hCmdBld,
+                                         uRifsMode,
+                                         uHtProtection,
+                                         uGfProtection,
+                                         uHtTxBurstLimit,
+                                         uDualCtsProtection,
+                                         NULL, 
+                                         NULL);
+}
+
+TI_STATUS TWD_CfgSetBaInitiator (TI_HANDLE hTWD,
+                                 TI_UINT8 uTid,
+                                 TI_UINT8 uState,
+                                 TMacAddr tRa,
+                                 TI_UINT16 uWinSize,
+                                 TI_UINT16 uInactivityTimeout)
+
+{
+	TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSetBaInitiator: called\n");
+
+    return cmdBld_CfgSetBaSession (pTWD->hCmdBld,
+                                   ACX_BA_SESSION_INITIATOR_POLICY,
+                                   uTid,               
+                                   uState,             
+                                   tRa,                
+                                   uWinSize,          
+                                   uInactivityTimeout,
+                                   NULL, 
+                                   NULL);
+}
+
+TI_STATUS TWD_CfgSetBaReceiver (TI_HANDLE hTWD,
+                                TI_UINT8 uTid,
+                                TI_UINT8 uState,
+                                TMacAddr tRa,
+                                TI_UINT16 uWinSize)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgSetBaReceiver: called\n");
+
+    return cmdBld_CfgSetBaSession (pTWD->hCmdBld,
+                                   ACX_BA_SESSION_RESPONDER_POLICY,
+                                   uTid,               
+                                   uState,             
+                                   tRa,                
+                                   uWinSize,          
+                                   0,
+                                   (void *)NULL, 
+                                   (TI_HANDLE)NULL);
+}
+
+void TWD_CloseAllBaSessions(TI_HANDLE hTWD) 
+{
+    TTwd        *pTWD = (TTwd *)hTWD;
+    TI_UINT32    i;
+
+    TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CloseAllBaSessions: called\n");
+
+    /* close all BA sessions */
+    for(i=0; i <MAX_NUM_OF_802_1d_TAGS; ++i)
+    {
+        RxQueue_CloseBaSession(pTWD->hRxQueue, i);
+    }
+}
+
+TI_STATUS TWD_WdExpireEvent(TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd*)hTWD;
+
+	if ( hTWD == NULL )
+	{
+		return(TI_NOK);
+	}
+
+	if (( pTWD->fFailureEventCb == NULL ) ||
+		( pTWD->hFailureEventCb == NULL ))
+	{
+		return(TI_NOK);
+	}
+
+	pTWD->fFailureEventCb(pTWD->hFailureEventCb, HW_WD_EXPIRE);
+
+	return(TI_OK);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriverInternal.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,177 @@
+/*
+ * TWDriverInternal.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 TWDriverInternal.h
+ *  \brief TWD Driver internal common internal declarations
+ *
+ *  \see TWDriver.h
+ */
+
+
+#ifndef TWDRIVERINTERNAL_H
+#define TWDRIVERINTERNAL_H
+
+
+#include "TWDriver.h"
+#include "Device.h"
+
+
+/* Shift factor to conver between TU (1024 uSec) and uSec. */
+#define SHIFT_BETWEEN_TU_AND_USEC       10  
+
+/* keep-alive templates definitions */
+#define KLV_MAX_TMPL_NUM                4
+
+/* Definitions for Rx Filter MIB */
+
+/* Set A—Enable: Forward all frames to host driver */
+#define MIB_RX_FILTER_PROMISCOUS_SET    0x01       
+/* Cleared A— Disable: Do not orward all frames to the host driver */
+#define MIB_RX_FILTER_PROMISCOUS_CLEAR  0x00       
+/* Set A—filter enabled: receive only those frames that match the BSSID given in the Join command */
+#define MIB_RX_FILTER_BSSID_SET         0x02       
+/* Cleared A—filter disabled: ignore BSSID in receiving */
+#define MIB_RX_FILTER_BSSID_CLEAR       0x00       
+
+/* Asynchronous init mode callback function type */
+typedef void (*fnotify_t)(TI_HANDLE module, TI_STATUS status);
+
+        /* Callback function definition for EndOfRecovery */
+typedef void (*TEndOfRecoveryCb) (TI_HANDLE handle);
+
+
+/* TWD Driver Structure */
+typedef struct
+{
+    TI_HANDLE           hOs;
+    TI_HANDLE           hUser;
+    TI_HANDLE           hReport;
+    TI_HANDLE           hTimer;
+    TI_HANDLE           hContext;
+    TI_HANDLE           hMacServices;
+    TI_HANDLE           hTxCtrlBlk;
+    TI_HANDLE           hTxHwQueue;
+    TI_HANDLE           hHwIntr;
+    TI_HANDLE           hHealthMonitor;
+    TI_HANDLE           hTwIf;
+    TI_HANDLE           hTxnQ;
+    TI_HANDLE           hCmdQueue;
+    TI_HANDLE           hCmdBld;
+    TI_HANDLE           hTxXfer;
+    TI_HANDLE           hTxResult;
+    TI_HANDLE           hRxXfer;
+    TI_HANDLE           hFwEvent;
+    TI_HANDLE           hHwInit;
+    TI_HANDLE           hCmdMbox;
+    TI_HANDLE           hEventMbox;
+    TI_HANDLE           hFwDbg;
+    TI_HANDLE           hRxQueue;
+    
+    /* If true it means that we are in recovery process */  
+    TI_BOOL             bRecoveryEnabled;
+
+    /* Init success flag */
+    TI_BOOL             bInitSuccess;
+
+    ReadWriteCommand_t  tPrintRegsBuf;    
+
+    /* Init/Recovery/Stop callbacks */
+    TTwdCallback        fInitHwCb;
+    TTwdCallback        fInitFwCb;
+    TTwdCallback        fConfigFwCb;
+    TTwdCallback        fStopCb;
+    TTwdCallback        fInitFailCb;
+
+    TFailureEventCb     fFailureEventCb;
+    TI_HANDLE          	hFailureEventCb;
+
+    TI_UINT32           uNumMboxFailures;
+
+#ifdef TI_DBG  /* Just for debug. */
+    /* Packets sequence counter (common for all queues). */
+    TI_UINT32           dbgPktSeqNum;                               
+    /* Tx counters per queue:*/
+    /* Count packets sent from upper driver. */
+    TI_UINT32           dbgCountSentPackets[MAX_NUM_OF_AC];  
+    /* Count packets sent and queue not busy. */
+    TI_UINT32           dbgCountQueueAvailable[MAX_NUM_OF_AC];
+    /* Count XferDone return values from Xfer. */
+    TI_UINT32           dbgCountXferDone[MAX_NUM_OF_AC];     
+    /* Count Success return values from Xfer. */
+    TI_UINT32           dbgCountXferSuccess[MAX_NUM_OF_AC];  
+    /* Count Pending return value from Xfer. */
+    TI_UINT32           dbgCountXferPending[MAX_NUM_OF_AC];  
+    /* Count Error return value from Xfer. */
+    TI_UINT32           dbgCountXferError[MAX_NUM_OF_AC];    
+    /* Count XferDone callback calls. */
+    TI_UINT32           dbgCountXferDoneCB[MAX_NUM_OF_AC];   
+    /* Count TxComplete callback calls. */
+    TI_UINT32           dbgCountTxCompleteCB[MAX_NUM_OF_AC]; 
+
+    MemoryMap_t         MemMap;
+    ACXStatistics_t     acxStatistic;
+#endif
+
+	TTestCmdCB	fRadioCb;
+	void		*pRadioCb;
+	TI_HANDLE	hRadioCb;
+	TTestCmd 	testCmd; 
+
+} TTwd;
+
+
+/* External Functions Prototypes */
+
+void  SendPacketTransfer (TI_HANDLE         hUser,  
+                          TI_UINT32         aPacketId);
+void  SendPacketComplete (TI_HANDLE         hUser, 
+                          TI_STATUS         aStatus, 
+                          TI_UINT32         aPacketId, 
+                          TI_UINT32         aRate, 
+                          TI_UINT8          aAckFailures, 
+                          TI_UINT32         durationInAir, 
+                          TI_UINT32         fwHandlingTime, 
+                          TI_UINT32         mediumDelay);
+
+
+
+
+#endif /* TNETW_DRIVER_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriverMsr.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,281 @@
+/*
+ * TWDriverMsr.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 TWDDRIVERMSR_H
+#define TWDDRIVERMSR_H
+
+/** \file  TWDriverMsr.h 
+ *  \brief TWDriver Measurement APIs
+ *
+ *  \see 
+ */
+
+#include "TWDriverScan.h"
+#include "tidef.h"
+#include "public_radio.h"
+
+#define NOISE_HISTOGRAM_LENGTH              8
+#define MAX_NUM_OF_MSR_TYPES_IN_PARALLEL    3
+
+/* The size of the time frame in which we must start the */
+/* measurement request or give up */
+#define MSR_START_MAX_DELAY             50
+
+/* In non unicast measurement requests a random delay */
+/* between 4 and 40 milliseconds */
+#define MSR_ACTIVATION_DELAY_RANDOM     36
+#define MSR_ACTIVATION_DELAY_OFFSET     4
+
+
+/** \enum EMeasurementType
+ * \brief different measurement types
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum 
+{
+/*	0	*/	MSR_TYPE_BASIC_MEASUREMENT  = 0,			/**< */
+/*	1	*/	MSR_TYPE_CCA_LOAD_MEASUREMENT,				/**< */
+/*	2	*/	MSR_TYPE_NOISE_HISTOGRAM_MEASUREMENT,		/**< */
+/*	3	*/	MSR_TYPE_BEACON_MEASUREMENT,				/**< */
+/*	4	*/	MSR_TYPE_FRAME_MEASUREMENT,					/**< */
+/*	5	*/	MSR_TYPE_MAX_NUM_OF_MEASURE_TYPES			/**< */
+
+} EMeasurementType;
+
+/** \enum EMeasurementScanMode
+ * \brief Measurement Scan Modes
+ * 
+ * \par Description
+ * enumerates the different scan modes available for beacon measurement
+ * 
+ * \sa
+ */
+typedef enum
+{
+/*	0	*/	MSR_SCAN_MODE_PASSIVE = 0,				/**< Passive Scan Mode			*/
+/*	1	*/	MSR_SCAN_MODE_ACTIVE,					/**< Active Scan Mode			*/
+/*	2	*/	MSR_SCAN_MODE_BEACON_TABLE,				/**< Beacon Table Scan Mode		*/
+/*	3	*/	MSR_SCAN_MODE_MAX_NUM_OF_SCAN_MODES		/**< Max number of Scan Modes	*/
+
+} EMeasurementScanMode;
+
+/** \enum EMeasurementFrameType
+ * \brief Measurement Frame Types
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum 
+{
+/*	0	*/	MSR_FRAME_TYPE_NO_ACTIVE = 0,	/**< */
+/*	1	*/	MSR_FRAME_TYPE_BROADCAST,		/**< */
+/*	2	*/	MSR_FRAME_TYPE_MULTICAST,		/**< */
+/*	3	*/	MSR_FRAME_TYPE_UNICAST			/**< */
+
+} EMeasurementFrameType;
+
+/** \enum EMeasurementMode
+ * \brief Measurement Modes
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{
+/*	0	*/	MSR_MODE_NONE = 0,				/**< */
+/*	1	*/	MSR_MODE_XCC,					/**< */
+/*	2	*/	MSR_MODE_SPECTRUM_MANAGEMENT	/**< */
+
+} EMeasurementMode;
+
+/** \enum EMeasurementRejectReason
+ * \brief Measurement Reject Reason
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum 
+{
+/*	1	*/	MSR_REJECT_OTHER_REASON = 1, 				/**< */
+/*	2	*/	MSR_REJECT_INVALID_MEASUREMENT_TYPE,		/**< */		
+/*	3	*/	MSR_REJECT_DTIM_OVERLAP,					/**< */
+/*	4	*/	MSR_REJECT_DURATION_EXCEED_MAX_DURATION,	/**< */
+/*	5	*/	MSR_REJECT_TRAFFIC_INTENSITY_TOO_HIGH,		/**< */
+/*	6	*/	MSR_REJECT_SCR_UNAVAILABLE,					/**< */
+/*	7	*/	MSR_REJECT_MAX_DELAY_PASSED,				/**< */
+/*	8	*/	MSR_REJECT_INVALID_CHANNEL,					/**< */
+/*	9	*/	MSR_REJECT_NOISE_HIST_FAIL,					/**< */
+/*	10	*/	MSR_REJECT_CHANNEL_LOAD_FAIL,				/**< */
+/*	11	*/	MSR_REJECT_EMPTY_REPORT						/**< */
+
+} EMeasurementRejectReason;
+
+ /*
+ ***********************************************************************
+ *  Unions.
+ ***********************************************************************
+ */
+/** \union TMeasurementReplyValue
+ * \brief Measurement possible Reply Values 
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef union
+{
+    TI_UINT8                            CCABusyFraction;						/**< */
+    TI_UINT8                            RPIDensity[ NOISE_HISTOGRAM_LENGTH ];   /**< */
+
+} TMeasurementReplyValue;
+
+/***********************************************************************
+ *  Structure definitions.
+ ***********************************************************************
+ */
+/** \struct TMeasurementTypeRequest
+ * \brief Measurement Type Request 
+ * 
+ * \par Description
+ * This structure defines single channel parameters for normal scan operation (inc. triggered)
+ * 
+ * \sa
+ */
+typedef struct
+{
+    EMeasurementType                    msrType;	/**< */
+    EMeasurementScanMode                scanMode;	/**< */
+    TI_UINT32                           duration;	/**< */
+    TI_UINT8                            reserved;	/**< */
+
+} TMeasurementTypeRequest;
+
+/** \struct TMeasurementRequest
+ * \brief Measurement Request 
+ * 
+ * \par Description
+ * This structure defines measurement parameters of several measurement request types
+ * for one channel
+ * 
+ * \sa
+ */
+typedef struct
+{
+    ERadioBand                          band;												/**< */
+    TI_UINT8                            channel;											/**< */
+    TI_UINT64                           startTime;											/**< */
+    TI_UINT8                            txPowerDbm;								  			/**< */  			
+    EScanResultTag                      eTag;												/**< */
+    TI_UINT8                            numberOfTypes;										/**< */
+    TMeasurementTypeRequest             msrTypes[ MAX_NUM_OF_MSR_TYPES_IN_PARALLEL ];		/**< */
+
+} TMeasurementRequest;
+
+/** \struct TMeasurementTypeReply
+ * \brief Measurement Type Reply 
+ * 
+ * \par Description
+ * This structure defines the reply parameters for measurement of specific type performed
+ * (the type is indicated in the msrType field)
+ * 
+ * \sa
+ */
+typedef struct
+{
+    EMeasurementType                    msrType;		/**< The type of performed measurement the reply reffer to	*/
+    TI_UINT8                            status;			/**< The status of measurement performed					*/
+    TMeasurementReplyValue              replyValue;		/**< The Reply Value of performed measurement			 	*/
+    TI_UINT8                            reserved;		/**< */
+
+} TMeasurementTypeReply;
+
+/** \struct TMeasurementReply
+ * \brief Measurement Reply 
+ * 
+ * \par Description
+ * This structure defines the reply parameters for some measurements of some types performed
+ * 
+ * \sa
+ */
+typedef struct 
+{
+    TI_UINT8                            numberOfTypes;									/**< Number of measurements types (equal to number of measurement replys)	*/
+    TMeasurementTypeReply               msrTypes[ MAX_NUM_OF_MSR_TYPES_IN_PARALLEL ];	/**< Measurements Replys buffer. One Reply per type							*/
+
+} TMeasurementReply;
+
+/** \struct TMeasurementFrameHdr
+ * \brief Measurement Frame Header 
+ * 
+ * \par Description
+ * This structure defines a Header of a measurement
+ * 
+ * \sa
+ */
+typedef struct 
+{
+    TI_UINT16                           dialogToken;			/**< Indicates if the received Measurement is the same as the one that is being processed	*/
+    TI_UINT8                            activatioDelay;			/**< */
+    TI_UINT8                            measurementOffset;		/**< */
+
+} TMeasurementFrameHdr;
+
+/** \struct TMeasurementFrameRequest
+ * \brief Measurement Frame Request 
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef struct 
+{
+    TMeasurementFrameHdr                 *hdr; 			/**< */
+    EMeasurementFrameType                frameType;		/**< */
+    TI_UINT8                             *requests;		/**< */
+    TI_INT32                             requestsLen;	/**< */
+
+} TMeasurementFrameRequest;
+
+
+#endif /* #define TWDDRIVERMSR_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriverRadio.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,119 @@
+/*
+ * TWDriverRadio.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TWDriverRadio.c 
+ *  \brief TI WLAN BIT
+ *
+ *  \see   TWDriver.h 
+ */
+
+#define __FILE_ID__  FILE_ID_119
+#include "TWDriver.h"
+#include "osApi.h"
+#include "TWDriverInternal.h"
+#include "CmdBld.h"
+/*****************************************************************************
+*                                                                            *
+*                       Static functions                                     *
+*                                                                            *
+******************************************************************************/
+
+
+
+/*****************************************************************************
+*                                                                            *
+*                       API functions	                                     *
+*                                                                            *
+******************************************************************************/
+/****************************************************************************************
+ *                        TWDriverTestCB                                    
+ ****************************************************************************************/
+void TWDriverTestCB(TI_HANDLE hTWD, 
+					TI_STATUS eStatus, 
+					TI_HANDLE pTestCmdParams)
+{
+	TTwd *pTWD = (TTwd *)hTWD;
+
+	if (pTWD->pRadioCb != NULL)
+	{
+	os_memoryCopy(NULL, pTWD->pRadioCb, &pTWD->testCmd.testCmd_u, sizeof(pTWD->testCmd.testCmd_u));
+	}
+
+	if (pTWD->fRadioCb != NULL)
+	{
+	pTWD->fRadioCb(pTWD->hRadioCb, eStatus, pTWD->pRadioCb);
+}
+}
+
+/****************************************************************************************
+ *                        TWDriverTest                                    
+ ****************************************************************************************/
+TI_STATUS TWDriverTest(TI_HANDLE hTWD, 
+					   TestCmdID_enum eTestCmd, 
+					   void* pTestCmdParams, 
+					   TTestCmdCB fCb, 
+					   TI_HANDLE hCb)
+{
+	TTwd *pTWD = (TTwd *)hTWD;
+
+	/* check parameters */
+	if (( hTWD == NULL ) ||
+		( eTestCmd >= MAX_TEST_CMD_ID ) ||
+		( fCb == NULL ) ||
+		( hCb == NULL ))
+	{
+		return (TI_NOK);
+	}
+
+	pTWD->testCmd.testCmdId = eTestCmd;
+
+	if (pTestCmdParams != NULL)
+	{
+	os_memoryCopy(NULL, &pTWD->testCmd.testCmd_u, pTestCmdParams, sizeof(pTWD->testCmd.testCmd_u));
+	}
+
+	pTWD->fRadioCb = fCb;
+	pTWD->pRadioCb = pTestCmdParams;
+	pTWD->hRadioCb = hCb;
+
+	return(cmdBld_CmdTest (pTWD->hCmdBld, 
+						   (TI_HANDLE)TWDriverTestCB, 
+						   hTWD, 
+						   &pTWD->testCmd));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriverRate.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,123 @@
+/*
+ * TWDriverRate.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 TWDRIVERRATE_H
+#define TWDRIVERRATE_H
+
+/** \file  TWDriverRate.h 
+ *  \brief TWDriver Rate APIs
+ *
+ *  \see
+ */
+
+/** \enum ERate
+ * \brief Rate Types
+ * 
+ * \par Description
+ * Driver's TX Control Frame Rate Format Type
+ * 
+ * \sa
+ */
+typedef enum
+{
+    DRV_RATE_AUTO       = 0,				/**< Auto							*/
+    DRV_RATE_1M         = 1,				/**< 1M								*/
+    DRV_RATE_2M         = 2,				/**< 2M								*/
+    DRV_RATE_5_5M       = 3,				/**< 5.5M							*/
+    DRV_RATE_11M        = 4,				/**< 11M							*/
+    DRV_RATE_22M        = 5,				/**< 22M							*/
+    DRV_RATE_6M         = 6,				/**< 6M								*/
+    DRV_RATE_9M         = 7,				/**< 9M								*/	
+    DRV_RATE_12M        = 8,				/**< 12M							*/	
+    DRV_RATE_18M        = 9,				/**< 18M							*/
+    DRV_RATE_24M        = 10,				/**< 24M							*/
+    DRV_RATE_36M        = 11,				/**< 36M							*/
+    DRV_RATE_48M        = 12,				/**< 48M							*/
+    DRV_RATE_54M        = 13,				/**< 54M							*/
+    DRV_RATE_MCS_0      = 14,				/**< 6.5M or  7.2					*/ 	
+    DRV_RATE_MCS_1      = 15,				/**< 13.0M or 14.4					*/
+    DRV_RATE_MCS_2      = 16,				/**< 19.5M or 21.7 					*/
+    DRV_RATE_MCS_3      = 17,				/**< 26.0M or 28.9 					*/
+    DRV_RATE_MCS_4      = 18,				/**< 39.0M or 43.3 					*/
+    DRV_RATE_MCS_5      = 19,				/**< 52.0M or 57.8 					*/
+    DRV_RATE_MCS_6      = 20,				/**< 58.5M or 65.0 					*/
+    DRV_RATE_MCS_7      = 21,				/**< 65.0M or 72.2 					*/
+    DRV_RATE_MAX        = DRV_RATE_MCS_7,	/**< Maximum Driver's Rate Type 	*/
+    DRV_RATE_INVALID    = 0xFF				/**< Invalid Driver's Rate Type 	*/
+
+} ERate;
+
+#define RATE_TO_MASK(R)  (1 << ((R) - 1))
+
+/** \enum ERateMask
+ * \brief Driver rate mask
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{
+    DRV_RATE_MASK_AUTO          = DRV_RATE_AUTO,                  /**< 0x000000	*/
+    DRV_RATE_MASK_1_BARKER      = RATE_TO_MASK(DRV_RATE_1M),      /**< 0x000001	*/
+    DRV_RATE_MASK_2_BARKER      = RATE_TO_MASK(DRV_RATE_2M),      /**< 0x000002	*/
+    DRV_RATE_MASK_5_5_CCK       = RATE_TO_MASK(DRV_RATE_5_5M),    /**< 0x000004	*/
+    DRV_RATE_MASK_11_CCK        = RATE_TO_MASK(DRV_RATE_11M),     /**< 0x000008	*/
+    DRV_RATE_MASK_22_PBCC       = RATE_TO_MASK(DRV_RATE_22M),     /**< 0x000010	*/
+    DRV_RATE_MASK_6_OFDM        = RATE_TO_MASK(DRV_RATE_6M),      /**< 0x000020	*/
+    DRV_RATE_MASK_9_OFDM        = RATE_TO_MASK(DRV_RATE_9M),      /**< 0x000040	*/
+    DRV_RATE_MASK_12_OFDM       = RATE_TO_MASK(DRV_RATE_12M),     /**< 0x000080	*/
+    DRV_RATE_MASK_18_OFDM       = RATE_TO_MASK(DRV_RATE_18M),     /**< 0x000100	*/
+    DRV_RATE_MASK_24_OFDM       = RATE_TO_MASK(DRV_RATE_24M),     /**< 0x000200	*/
+    DRV_RATE_MASK_36_OFDM       = RATE_TO_MASK(DRV_RATE_36M),     /**< 0x000400	*/
+    DRV_RATE_MASK_48_OFDM       = RATE_TO_MASK(DRV_RATE_48M),     /**< 0x000800	*/
+    DRV_RATE_MASK_54_OFDM       = RATE_TO_MASK(DRV_RATE_54M),     /**< 0x001000	*/
+    DRV_RATE_MASK_MCS_0_OFDM    = RATE_TO_MASK(DRV_RATE_MCS_0),   /**< 0x002000	*/
+    DRV_RATE_MASK_MCS_1_OFDM    = RATE_TO_MASK(DRV_RATE_MCS_1),   /**< 0x004000	*/
+    DRV_RATE_MASK_MCS_2_OFDM    = RATE_TO_MASK(DRV_RATE_MCS_2),   /**< 0x008000	*/
+    DRV_RATE_MASK_MCS_3_OFDM    = RATE_TO_MASK(DRV_RATE_MCS_3),   /**< 0x010000	*/
+    DRV_RATE_MASK_MCS_4_OFDM    = RATE_TO_MASK(DRV_RATE_MCS_4),   /**< 0x020000	*/
+    DRV_RATE_MASK_MCS_5_OFDM    = RATE_TO_MASK(DRV_RATE_MCS_5),   /**< 0x040000	*/
+    DRV_RATE_MASK_MCS_6_OFDM    = RATE_TO_MASK(DRV_RATE_MCS_6),   /**< 0x080000	*/
+    DRV_RATE_MASK_MCS_7_OFDM    = RATE_TO_MASK(DRV_RATE_MCS_7)    /**< 0x100000	*/
+
+} ERateMask;
+
+#define PBCC_BIT        0x00000080 /* BIT_7 */
+
+#endif /* #define TWDRIVERRATE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriverScan.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,329 @@
+/*
+ * TWDriverScan.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 TWDRIVERSCAN_H
+#define TWDRIVERSCAN_H
+
+/** \file  TWDriverScan.h 
+ *  \brief TWDriver Scan APIs
+ *
+ *  \see
+ */
+
+#include "tidef.h"
+#include "TWDriverRate.h"
+#include "public_commands.h"
+
+/*****************************************************************************************
+                          Scan Definitions
+                          ---------------
+This file is included by the TWDriver.h , it should not be included apart. !!!!!!!
+*****************************************************************************************/
+
+
+/*
+ ***********************************************************************
+ *  Constant definitions.
+ ***********************************************************************
+ */
+#define MAX_NUMBER_OF_CHANNELS_PER_SCAN                     16
+#define SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND         MAX_NUMBER_OF_CHANNELS_PER_SCAN
+#define SCAN_MAX_NUM_OF_SPS_CHANNELS_PER_COMMAND            16
+#define SCAN_DEFAULT_MIN_CHANNEL_DWELL_TIME                 30000
+#define SCAN_DEFAULT_MAX_CHANNEL_DWELL_TIME                 60000
+#define SCAN_DEFAULT_EARLY_TERMINATION_EVENT                SCAN_ET_COND_DISABLE
+#define SCAN_DEFAULT_EARLY_TERMINATION_NUM_OF_FRAMES        0
+
+#define PERIODIC_SCAN_MAX_SSID_NUM      					8
+#define PERIODIC_SCAN_MAX_INTERVAL_NUM  					16
+#define PERIODIC_SCAN_MAX_CHANNEL_NUM   					37 /* G-14 + A-23 */
+
+#define MAX_SSID_LEN  										32
+
+ /*
+ ***********************************************************************
+ *  Enums.
+ ***********************************************************************
+ */
+/** \enum EScanType
+ * \brief Scan Type
+ *
+ * \par Description
+ * This Enumeration defines the available scan types.
+ *
+ * \sa TFileInfo
+ */
+typedef enum
+{
+/*	0	*/	SCAN_TYPE_NORMAL_PASSIVE = 0,   /**< Normal passive scan 	*/
+/*	1	*/	SCAN_TYPE_NORMAL_ACTIVE,        /**< Normal active scan 	*/
+/*	2	*/	SCAN_TYPE_SPS,                  /**< Scheduled Passive scan */
+/*	3	*/	SCAN_TYPE_TRIGGERED_PASSIVE,    /**< Triggered Passive scan */
+/*	4	*/	SCAN_TYPE_TRIGGERED_ACTIVE,     /**< Triggered Active scan 	*/
+/*	5	*/	SCAN_TYPE_NO_SCAN,              /**< No Scan to perform 	*/
+/*	6	*/	SCAN_TYPE_PACTSIVE              /**< Passive + Active Scan (used for DFS - driver internal use only!!!) */
+
+} EScanType;
+
+/** \enum EScanEtCondition
+ * \brief Scan Early Termonation Condition
+ *
+ * \par Description
+ * This Enumeration defines the different early termination causes.
+ *
+ * \sa TFileInfo
+ */
+typedef enum
+{
+    SCAN_ET_COND_DISABLE     = 0x00,        /**< No early termination is not disabled (Do not perform an early termination scan)*/
+    SCAN_ET_COND_BEACON      = 0x10,        /**< Early termination scan on beacon reception 									*/
+    SCAN_ET_COND_PROBE_RESP  = 0x20,        /**< Early termination scan on probe response reception 							*/
+    SCAN_ET_COND_ANY_FRAME   = 0x30,        /**< Early termination scan on both beacon or probe response reception 				*/
+    SCAN_ET_COND_NUM_OF_CONDS= 0x4          /**< Number of early termination conditions 										*/ 
+
+} EScanEtCondition;
+
+/** \enum EScanResultTag
+ * \brief Scan Debug Tags
+ * 
+ * \par Description
+ * Enumeration of the differnet Scan Result Tags possible
+ * 
+ * \sa	
+ */
+typedef enum
+{
+/*	0	*/	SCAN_RESULT_TAG_CURENT_BSS = 0,			/**< */
+/*	1	*/	SCAN_RESULT_TAG_APPLICATION_ONE_SHOT,	/**< */
+/*	2	*/	SCAN_RESULT_TAG_DRIVER_PERIODIC,		/**< */
+/*	3	*/	SCAN_RESULT_TAG_APPLICATION_PEIODIC,	/**< */
+/*	4	*/	SCAN_RESULT_TAG_MEASUREMENT,			/**< */
+/*	5	*/	SCAN_RESULT_TAG_IMMEDIATE,				/**< */
+/*	6	*/	SCAN_RESULT_TAG_CONTINUOUS,				/**< */
+ /*	7	*/	SCAN_RESULT_TAG_MAX_NUMBER				/**< */
+
+} EScanResultTag;
+
+/** \enum ESsidVisability
+ * \brief SSID Visablility Type
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+typedef enum
+{
+/*	0	*/	SCAN_SSID_VISABILITY_PUBLIC = 0,		/**< Visible	*/
+/*	1	*/	SCAN_SSID_VISABILITY_HIDDEN				/**< Hidden		*/
+} ESsidVisability;
+
+/***********************************************************************
+ *  Structure definitions.
+ ***********************************************************************
+ */
+/** \struct TSsid
+ * \brief SSID Parameters
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TI_UINT8    len;		  			/**< SSID Length		*/   		
+    char        str[ MAX_SSID_LEN ];	/**< SSID string buffer	*/
+
+}  TSsid;
+
+/** \struct TScanNormalChannelEntry
+ * \brief Scan Normal Channel Entry
+ * 
+ * \par Description
+ * This structure defines single channel parameters for normal scan operation other than SPS (inc. triggered)
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TMacAddr               bssId;                  	/**< BSSID (MAC address) to filter */
+    TI_UINT32              maxChannelDwellTime;     /**< Maximum time to stay on the channel if some frames were 
+													* received but the early termination limit has not been reached (microseconds) 
+													*/
+    TI_UINT32              minChannelDwellTime;     /**< Minimum time to stay on the channel if no frames were received (microseconds) */
+    EScanEtCondition       earlyTerminationEvent;   /**< Early termination frame type */
+    TI_UINT8               ETMaxNumOfAPframes;      /**< Number of frames from the early termination frame types according to the early 
+													* Termination Event setting, after which scan is stopped on this channel	
+													*/    
+    TI_UINT8               txPowerDbm;              /**< Power level used to transmit (for active scan only) (0: no change; 1-5: predefined power level */
+    TI_UINT8               channel;                 /**< Channel to scan */
+
+} TScanNormalChannelEntry;
+
+/** \struct TScanSpsChannelEntry
+ * \brief Scan SPS Channel Entry
+ * 
+ * \par Description
+ * This structure defines single channel parameters for an SPS scan operation
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TMacAddr               bssId;               	/**< BSSID (source is MAC address) to filter */
+    TI_UINT32              scanDuration;            /**< Length of time to start scanning the channel (TSF lower 4 bytes) */
+    TI_UINT32              scanStartTime;           /**< Exact time to start scanning the channel (TSF lower 4 bytes) */
+    EScanEtCondition       earlyTerminationEvent;   /**< Scan early termination frame type */
+    TI_UINT8               ETMaxNumOfAPframes;      /**< Number of frames from the early termination frame types according to 
+													* the early Termination Event setting, after which scan is stopped on this channel
+													*/
+    TI_UINT8               channel;                 /**< Channel to scan */
+
+} TScanSpsChannelEntry;
+
+/** \struct TScanChannelEntry
+ * \brief Scan Channel Entry
+ * 
+ * \par Description
+ * Holds single channel parameters single-channel parameters for all scan types,
+ * either for normal scan or for SPS scan
+ * 
+ * \sa
+ */ 
+typedef union
+{
+    TScanNormalChannelEntry   normalChannelEntry;	/**< Normal scan parameters: channel parameters for all scan types other than SPS 	*/
+    TScanSpsChannelEntry      SPSChannelEntry;      /**< SPS scan parameters: channel parameters for SPS type 	*/
+
+} TScanChannelEntry;
+
+/** \struct TScanParams
+ * \brief scan operation parameters
+ * 
+ * \par Description
+ * This structure defines parameters for a scan operation
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    TSsid                  desiredSsid;    		/**< The SSID to search (optional) 												*/
+    EScanType              scanType;            /**< Desired scan type (normal - active or passive, SPS, triggered - active or passive)	*/
+    ERadioBand             band;             	/**< Band to scan (A / BG) 														*/
+    TI_UINT8               probeReqNumber;     	/**< Number of probe requests to send on each channel (for active scan) 		*/
+    ERateMask              probeRequestRate;    /**< The rate at which to send the probe requests 								*/
+    TI_UINT8               Tid;                 /**< Time at which to trigger the scan (for triggered scan)						*/
+    TI_UINT64              latestTSFValue;      /**< For SPS scan: the latest TSF at which a frame was received. Used to detect 
+												* TSF error (AP recovery). 
+												*/
+    TI_UINT32              SPSScanDuration;    	/**< For SPS scan ONLY: the time duration of the scan (in milliseconds), used to 
+												* Set timer according to. Used to set scan-complete timer 
+												*/
+    TI_UINT8               numOfChannels;       /**< Number of channels to scan 														*/
+    TScanChannelEntry      channelEntry[ MAX_NUMBER_OF_CHANNELS_PER_SCAN ];	/**< Channel data array, actual size according to the above field. */
+
+} TScanParams;
+
+/** \struct TPeriodicScanSsid
+ * \brief Periodic Scan SSID
+ * 
+ * \par Description
+ * This structure defines parameters for Periodic scan for SSID
+ * 
+ * \sa
+ */ 
+typedef struct
+{
+    ESsidVisability eVisability;	/**< Indicates if SSID Visible or not	*/	
+    TSsid           tSsid;			/**< The Parameters of Scaned SSID 		*/
+} TPeriodicScanSsid;
+
+/** \struct TPeriodicChannelEntry
+ * \brief Periodic Channel Entry
+ * 
+ * \par Description
+ * This structure defines a Channel Entry of Periodic scan
+ * (each scanned channel has its own Channel Entry)
+ * 
+ * \sa
+ */
+typedef struct
+{
+    ERadioBand      eBand;			  	/**< Channel's Radio Band									*/  	
+    TI_UINT32       uChannel;			/**< Channel's Number										*/
+    EScanType       eScanType;			/**< The Type of Scan Performed on the channel				*/
+    TI_UINT32       uMinDwellTimeMs;	/**< minimum time to dwell on the channel, in microseconds	*/
+    TI_UINT32       uMaxDwellTimeMs;	/**< maximum time to dwell on the channel, in microseconds	*/
+    TI_UINT32       uTxPowerLevelDbm;	/**< Channel's Power Level In Dbm/10 units 		 			*/
+} TPeriodicChannelEntry;
+
+/** \struct TPeriodicScanParams
+ * \brief Periodic Scan Parameters
+ * 
+ * \par Description
+ * This structure defines all the parameters of Periodic scan
+ * 
+ * \sa
+ */
+typedef struct
+{
+    TI_UINT32               uSsidNum;												/**< Number of Desired SSID scanned			 					*/
+    TPeriodicScanSsid       tDesiredSsid[ PERIODIC_SCAN_MAX_SSID_NUM ];				/**< Buffer of size of maximum possible Periodic Scanned SSIDs. 
+																					* This buffer holds the Parameters of Desired SSIDs (for each SSID: 
+																					* visibility, length, string buffer) --> number of init entries in 
+																					* buffer: uSsidNum	
+																					*/
+    TI_UINT32               uCycleNum;												/**< number of Scan cycles to run 						   		*/ 								
+    TI_UINT32               uCycleIntervalMsec[ PERIODIC_SCAN_MAX_INTERVAL_NUM ];	/**< Intervals (in Msec) between two sequential  scan cycle    	*/
+    TI_INT8                 iRssiThreshold;											/**< RSSI threshold 											*/
+    TI_INT8                 iSnrThreshold;											/**< SNR threshold	 											*/
+    TI_UINT32               uFrameCountReportThreshold;								/**< Report after N results are received 						*/
+    TI_BOOL                 bTerminateOnReport;										/**< Indicates if to Terminate after report 					*/
+    ScanBssType_e           eBssType;												/**< Scan BSS Type												*/
+    TI_UINT32               uProbeRequestNum;										/**< Number of probe requests to transmit per SSID				*/
+    TI_UINT32               uChannelNum;											/**< Number of Scaned Channels									*/
+    TPeriodicChannelEntry   tChannels[ PERIODIC_SCAN_MAX_CHANNEL_NUM ];				/**< Buffer of size of maximum possible Periodic Scanned Channels. 
+																					* This buffer holds the Parameters of each Scanned Channel	
+																					*/
+} TPeriodicScanParams;
+
+#endif /* TWDRIVERSCAN_H */
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TWDriver/TWDriverTx.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,114 @@
+/*
+ * TWDriverTx.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:    TNETW_Driver_Tx.c
+ *
+ *   PURPOSE:   TNETW_Driver Tx API functions needed externally to the driver.
+ *
+ ****************************************************************************/
+
+#define __FILE_ID__  FILE_ID_120
+#include "report.h"
+#include "TWDriver.h"
+#include "txCtrlBlk_api.h"
+#include "txHwQueue_api.h"
+#include "txXfer_api.h"
+#include "txResult_api.h"
+#include "CmdBld.h"
+
+/** \file  TWDriverTx.c 
+ *  \brief TI WLAN HW TX Access Driver
+ *
+ *  \see   TWDriver.h 
+ */
+
+
+/****************************************************************************
+ *                  Tx Control Block API functions                          *
+ ****************************************************************************/
+
+TTxCtrlBlk *TWD_txCtrlBlk_Alloc (TI_HANDLE hTWD)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    return txCtrlBlk_Alloc (pTWD->hTxCtrlBlk);
+}
+
+void TWD_txCtrlBlk_Free (TI_HANDLE hTWD, TTxCtrlBlk *pCurrentEntry)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    txCtrlBlk_Free (pTWD->hTxCtrlBlk, pCurrentEntry);
+}
+
+TTxCtrlBlk *TWD_txCtrlBlk_GetPointer (TI_HANDLE hTWD, TI_UINT8 descId)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    return txCtrlBlk_GetPointer (pTWD->hTxCtrlBlk, descId);
+}
+
+
+
+/****************************************************************************
+ *                      Tx HW Queue API functions                           *
+ ****************************************************************************/
+ETxHwQueStatus TWD_txHwQueue_AllocResources (TI_HANDLE hTWD, TTxCtrlBlk *pTxCtrlBlk)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    return txHwQueue_AllocResources (pTWD->hTxHwQueue, pTxCtrlBlk);
+}
+
+/****************************************************************************
+ *                          Tx Xfer API functions                           *
+ ****************************************************************************/
+
+ETxnStatus TWD_txXfer_SendPacket (TI_HANDLE hTWD, TTxCtrlBlk *pPktCtrlBlk)
+{
+    TTwd *pTWD = (TTwd *)hTWD;
+
+    return txXfer_SendPacket (pTWD->hTxXfer, pPktCtrlBlk);
+}
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TwIf/TwIf.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1081 @@
+/*
+ * TwIf.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   TwIf.c 
+ *  \brief  The TWD bottom API towards the Txn-Queue. 
+ *
+ * The TwIf module is the lowest WLAN-specific layer and presents a common interface to all Xfer modules.
+ * As such, it is responsible for the common functionalities related to device access, which includes:
+ *    - transactions submission
+ *    - interface power control
+ *    - address translation (paging) when needed (depends on bus attributes).
+ * The TwIf has no OS, platform or bus type dependencies.
+ * 
+ *  \see    TwIf.h, TxnQueue.c, TxnQueue.h
+ */
+
+#define __FILE_ID__  FILE_ID_121
+#include "tidef.h"
+#include "report.h"
+#include "context.h"
+#include "TxnDefs.h"
+#include "TxnQueue.h"
+#include "TwIf.h"
+#include "TWDriver.h"
+ 
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+#define TXN_DONE_QUE_SIZE       64  /* TxnDone-queue size */
+
+/* Values to write to the ELP register for sleep/awake */
+#define ELP_CTRL_REG_SLEEP      0
+#define ELP_CTRL_REG_AWAKE      1
+
+/* 
+ * Device interface-control registers addresses (at the end ot the 17-bit address space):
+ */
+#define PARTITION_REGISTERS_ADDR        (0x1FFC0)   /* Four 32 bit register:                      */
+                                                    /*    Memory region size            (0x1FFC0) */
+                                                    /*    Memory region base address    (0x1FFC4) */
+                                                    /*    Registers region size         (0x1FFC8) */
+                                                    /*    Registers region base address (0x1FFCC) */
+
+#define ELP_CTRL_REG_ADDR		        (0x1FFFC)   /* ELP control register address */
+
+
+
+/************************************************************************
+ * Types
+ ************************************************************************/
+
+/* TwIf SM States */
+typedef enum
+{
+	SM_STATE_AWAKE,           /* HW is awake and Txn-Queue is running */
+	SM_STATE_SLEEP,           /* HW is asleep and Txn-Queue is stopped */
+	SM_STATE_WAIT_HW          /* Waiting for HW to wake up (after triggering it), Txn-Queue is stopped */
+} ESmState;
+
+/* TwIf SM Events */
+typedef enum
+{
+	SM_EVENT_START,           /* Need to wake up the device to handle transactions */
+	SM_EVENT_HW_AVAILABLE,    /* The device woke up */
+	SM_EVENT_SLEEP            /* Need to let the device go to sleep */
+} ESmEvent;
+
+/* The addresses partitioning configuration Txn data */
+typedef struct 
+{
+    TI_UINT32       uMemSize;        /* The HW memory region size. */
+    TI_UINT32       uMemAddr;        /* The HW memory region address. */
+    TI_UINT32       uRegSize;        /* The HW registers region size. */
+    TI_UINT32       uRegAddr;        /* The HW registers region address. */
+
+} TPartitionTxnData;
+
+/* The addresses partitioning configuration Txn */
+typedef struct 
+{
+    TTxnStruct          tHdr;        /* The generic transaction structure */
+    TI_UINT8            *pData;      /* The addresses partitioning configuration data */
+
+} TPartitionTxn;
+
+/* The addresses partitioning configuration Txn */
+typedef struct 
+{
+    TTxnStruct      tHdr;           /* The generic transaction structure */
+    TI_UINT8       *pData;       /* The addresses partitioning configuration data for one register */
+
+} TPartitionRegTxn;
+
+/* The addresses partitioning configuration Txn */
+typedef struct 
+{
+    TTxnStruct      tHdr;           /* The generic transaction structure */
+    TI_UINT8        uElpData;       /* The value to write to the ELP register */
+
+} TElpTxn;
+
+/* The TwIf module Object */
+typedef struct _TTwIfObj
+{
+    /* Other modules handles */
+    TI_HANDLE	    hOs;		   	 
+    TI_HANDLE	    hReport;
+	TI_HANDLE       hContext;
+	TI_HANDLE	    hTxnQ;
+
+    ESmState        eState;          /* SM current state */
+    TI_HANDLE       hTxnDoneQueue;   /* Queue for completed transactions not reported yet to the upper layer */
+    TI_UINT32       uContextId;      /* The ID allocated to this module on registration to context module */
+    TFailureEventCb fErrCb;          /* The upper layer CB function for error handling */
+    TI_HANDLE       hErrCb;          /* The CB function handle */
+    TRecoveryCb     fRecoveryCb;     /* The upper layer CB for restart complete */
+    TI_HANDLE       hRecoveryCb;     /* The CB function handle */
+    TI_UINT32       uAwakeReqCount;  /* Increment on awake requests and decrement on sleep requests */
+    TI_UINT32       uPendingTxnCount;/* Count pending transactions (sent to TxnQ and not completed yet) */
+    TElpTxn         tElpTxnSleep;    /* Transaction structure for writing sleep to ELP register  */
+    TElpTxn         tElpTxnAwake;    /* Transaction structure for writing awake to ELP register  */
+
+    /* HW Addresses partitioning */
+    TI_UINT32       uMemAddr1;        /* The HW memory region start address. */
+    TI_UINT32       uMemSize1;        /* The HW memory region end address. */
+    TI_UINT32       uMemAddr2;        /* The HW registers region start address. */
+    TI_UINT32       uMemSize2;        /* The HW registers region end address. */
+    TI_UINT32       uMemAddr3;        /* The INT Status registers region start address. */
+    TI_UINT32       uMemSize3;        /* The INT Status registers region end address. */
+    TI_UINT32       uMemAddr4;        /* The FW Status mem registers region start address. */
+    
+
+#ifdef TI_DBG
+    /* Debug counters */
+    TI_UINT32       uDbgCountAwake;      /* Count calls to twIf_Awake */
+    TI_UINT32       uDbgCountSleep;      /* Count calls to twIf_Sleep */
+    TI_UINT32       uDbgCountTxn;        /* Count calls to twIf_SendTransaction (including TwIf internal Txns) */
+    TI_UINT32       uDbgCountTxnPending; /* Count transactions that returned PENDING */
+    TI_UINT32       uDbgCountTxnComplete;/* Count transactions that returned COMPLETE */
+    TI_UINT32       uDbgCountTxnDoneCb;  /* Count calls to twIf_TxnDoneCb */
+#endif
+
+} TTwIfObj;
+
+
+/************************************************************************
+ * Internal functions prototypes
+ ************************************************************************/
+static void        twIf_WriteElpReg        (TTwIfObj *pTwIf, TI_UINT32 uValue);
+static void        twIf_PartitionTxnDoneCb (TI_HANDLE hTwIf, void *hTxn);
+static ETxnStatus  twIf_SendTransaction    (TTwIfObj *pTwIf, TTxnStruct *pTxn);
+static void        twIf_HandleSmEvent      (TTwIfObj *pTwIf, ESmEvent eEvent);
+static void        twIf_TxnDoneCb          (TI_HANDLE hTwIf, TTxnStruct *pTxn);
+static void        twIf_HandleTxnDone      (TI_HANDLE hTwIf);
+static void        twIf_ClearTxnDoneQueue  (TI_HANDLE hTwIf);
+
+
+
+/************************************************************************
+ *
+ *   Module functions implementation
+ *
+ ************************************************************************/
+
+/** 
+ * \fn     twIf_Create 
+ * \brief  Create the module
+ * 
+ * Allocate and clear the module's object.
+ * 
+ * \note   
+ * \param  hOs - Handle to Os Abstraction Layer
+ * \return Handle of the allocated object, NULL if allocation failed 
+ * \sa     twIf_Destroy
+ */ 
+TI_HANDLE twIf_Create (TI_HANDLE hOs)
+{
+    TI_HANDLE  hTwIf;
+    TTwIfObj  *pTwIf;
+
+    hTwIf = os_memoryAlloc (hOs, sizeof(TTwIfObj),MemoryNormal);
+    if (hTwIf == NULL)
+        return NULL;
+    
+    pTwIf = (TTwIfObj *)hTwIf;
+
+    os_memoryZero (hOs, hTwIf, sizeof(TTwIfObj));
+    
+    pTwIf->hOs = hOs;
+
+    return pTwIf;
+}
+
+
+/** 
+ * \fn     twIf_Destroy
+ * \brief  Destroy the module. 
+ * 
+ * Unregister from TxnQ and free the TxnDone-queue and the module's object.
+ * 
+ * \note   
+ * \param  The module's object
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     twIf_Create
+ */ 
+TI_STATUS twIf_Destroy (TI_HANDLE hTwIf)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*)hTwIf;
+
+    if (pTwIf)
+    {
+        txnQ_Close (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN);
+        que_Destroy (pTwIf->hTxnDoneQueue);
+        os_memoryFree (pTwIf->hOs, pTwIf, sizeof(TTwIfObj));     
+    }
+    return TI_OK;
+}
+
+
+/** 
+ * \fn     twIf_Init 
+ * \brief  Init module 
+ * 
+ * - Init required handles and module variables
+ * - Create the TxnDone-queue
+ * - Register to TxnQ
+ * - Register to context module
+ * 
+ * \note    
+ * \param  hTwIf     - The module's object
+ * \param  hReport   - Handle to report module
+ * \param  hContext  - Handle to context module
+ * \param  hTxnQ     - Handle to TxnQ module
+ * \return void        
+ * \sa     
+ */ 
+void twIf_Init (TI_HANDLE hTwIf, TI_HANDLE hReport, TI_HANDLE hContext, TI_HANDLE hTxnQ, TRecoveryCb fRecoveryCb, TI_HANDLE hRecoveryCb)
+{
+    TTwIfObj   *pTwIf = (TTwIfObj*)hTwIf;
+    TI_UINT32   uNodeHeaderOffset;
+    TTxnStruct *pTxnHdr;   /* The ELP transactions header (as used in the TxnQ API) */
+
+    pTwIf->hReport          = hReport;
+    pTwIf->hContext         = hContext;
+    pTwIf->hTxnQ            = hTxnQ;
+    pTwIf->fRecoveryCb      = fRecoveryCb;
+    pTwIf->hRecoveryCb      = hRecoveryCb;
+
+    /* Prepare ELP sleep transaction */
+    pTwIf->tElpTxnSleep.uElpData = ELP_CTRL_REG_SLEEP;
+    pTxnHdr = &(pTwIf->tElpTxnSleep.tHdr);
+    TXN_PARAM_SET(pTxnHdr, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    TXN_PARAM_SET_MORE(pTxnHdr, 0);         /* Sleep is the last transaction! */
+    /* NOTE: Function id for single step will be replaced to 0 by the bus driver */
+    TXN_PARAM_SET_SINGLE_STEP(pTxnHdr, 1);  /* ELP write is always single step (TxnQ is topped)! */
+    BUILD_TTxnStruct(pTxnHdr, ELP_CTRL_REG_ADDR, &(pTwIf->tElpTxnSleep.uElpData), sizeof(TI_UINT8), NULL, NULL)
+
+    /* Prepare ELP awake transaction */
+    pTwIf->tElpTxnAwake.uElpData = ELP_CTRL_REG_AWAKE;
+    pTxnHdr = &(pTwIf->tElpTxnAwake.tHdr);
+    TXN_PARAM_SET(pTxnHdr, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+    TXN_PARAM_SET_MORE(pTxnHdr, 1);         
+    /* NOTE: Function id for single step will be replaced to 0 by the bus driver */
+    TXN_PARAM_SET_SINGLE_STEP(pTxnHdr, 1);  /* ELP write is always single step (TxnQ is topped)! */
+    BUILD_TTxnStruct(pTxnHdr, ELP_CTRL_REG_ADDR, &(pTwIf->tElpTxnAwake.uElpData), sizeof(TI_UINT8), NULL, NULL)
+
+    /* Create the TxnDone queue. */
+    uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode); 
+    pTwIf->hTxnDoneQueue = que_Create (pTwIf->hOs, pTwIf->hReport, TXN_DONE_QUE_SIZE, uNodeHeaderOffset);
+    if (pTwIf->hTxnDoneQueue == NULL)
+    {
+        TRACE0(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_Init: TxnDone queue creation failed!\n");
+    }
+
+    /* Register to the context engine and get the client ID */
+    pTwIf->uContextId = context_RegisterClient (pTwIf->hContext,
+                                                twIf_HandleTxnDone,
+                                                hTwIf,
+                                                TI_TRUE,
+                                                "TWIF",
+                                                sizeof("TWIF"));
+
+    /* Register to TxnQ */
+    txnQ_Open (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN, TXN_NUM_PRIORITYS, (TTxnQueueDoneCb)twIf_TxnDoneCb, hTwIf);
+
+    /* Restart TwIf and TxnQ modules */
+    twIf_Restart (hTwIf);
+}
+
+
+/** 
+ * \fn     twIf_Restart
+ * \brief  Restart module upon driver stop or recovery
+ * 
+ * Called upon driver stop command or upon recovery. 
+ * Calls txnQ_Restart to clear the WLAN queues and call the TxnDone CB on each tansaction.
+ * If no transaction in progress, the queues are cleared immediately. 
+ * If a transaction is in progress, it is done upon TxnDone.
+ * The status in transactions that were dropped due to restart is TXN_STATUS_RECOVERY,
+ *     and its originator (Xfer module) handles it if required (if its CB was written in the Txn).
+ * 
+ * \note   
+ * \param  hTwIf - The module's object
+ * \return COMPLETE if the WLAN queues were restarted, PENDING if waiting for TxnDone to restart queues
+ * \sa     
+ */ 
+ETxnStatus twIf_Restart (TI_HANDLE hTwIf)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*) hTwIf;
+
+    pTwIf->eState           = SM_STATE_SLEEP;
+    pTwIf->uAwakeReqCount   = 0;
+
+    pTwIf->uPendingTxnCount = 0;
+
+    /* Clear done queue */
+    twIf_ClearTxnDoneQueue(hTwIf);
+
+    /* Restart WLAN queues and return result (COMPLETE or PENDINF if completed in TxnDone context) */
+    return txnQ_Restart (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN);
+}
+
+
+/** 
+ * \fn     twIf_RegisterErrCb
+ * \brief  Register Error CB
+ * 
+ * Register upper layer (health monitor) CB for bus error
+ * 
+ * \note   
+ * \param  hTwIf  - The module's object
+ * \param  fErrCb - The upper layer CB function for error handling 
+ * \param  hErrCb - The CB function handle
+ * \return void
+ * \sa     
+ */ 
+void twIf_RegisterErrCb (TI_HANDLE hTwIf, void *fErrCb, TI_HANDLE hErrCb)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*) hTwIf;
+
+    /* Save upper layer (health monitor) CB for bus error */
+    pTwIf->fErrCb = (TFailureEventCb)fErrCb;
+    pTwIf->hErrCb = hErrCb;
+}
+
+
+/** 
+ * \fn     twIf_WriteElpReg
+ * \brief  write ELP register
+ * 
+ * \note   
+ * \param  pTwIf   - The module's object
+ * \param  uValue  - ELP_CTRL_REG_SLEEP or ELP_CTRL_REG_AWAKE
+ * \return void
+ * \sa     
+ */ 
+static void twIf_WriteElpReg (TTwIfObj *pTwIf, TI_UINT32 uValue)
+{
+    TRACE1(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_WriteElpReg:  ELP Txn data = 0x%x\n", uValue);
+
+    /* Send ELP (awake or sleep) transaction to TxnQ */
+    if (uValue == ELP_CTRL_REG_AWAKE)
+    {
+        txnQ_Transact (pTwIf->hTxnQ, &(pTwIf->tElpTxnAwake.tHdr));
+    }
+    else
+    {
+        txnQ_Transact (pTwIf->hTxnQ, &(pTwIf->tElpTxnSleep.tHdr));
+    }
+}
+
+
+/** 
+ * \fn     twIf_SetPartition
+ * \brief  Set HW addresses partition
+ * 
+ * Called by the HwInit module to set the HW address ranges for download or working access.
+ * Generate and configure the bus access address mapping table.
+ * The partition is split between register (fixed partition of 24KB size, exists in all modes), 
+ *     and memory (dynamically changed during init and gets constant value in run-time, 104KB size).
+ * The TwIf configures the memory mapping table on the device by issuing write transaction to 
+ *     table address (note that the TxnQ and bus driver see this as a regular transaction). 
+ * 
+ * \note In future versions, a specific bus may not support partitioning (as in wUART), 
+ *       In this case the HwInit module shall not call this function (will learn the bus 
+ *       configuration from the INI file).
+ *
+ * \param  hTwIf          - The module's object
+ * \param  uMemAddr  - The memory partition base address
+ * \param  uMemSize  - The memory partition size
+ * \param  uRegAddr  - The registers partition base address
+ * \param  uRegSize  - The register partition size
+ * \return void
+ * \sa     
+ */ 
+
+void twIf_SetPartition (TI_HANDLE hTwIf,
+                        TPartition *pPartition)
+{
+    TTwIfObj          *pTwIf = (TTwIfObj*) hTwIf;
+    TPartitionRegTxn  *pPartitionRegTxn;/* The partition transaction structure for one register */
+    TTxnStruct        *pTxnHdr;         /* The partition transaction header (as used in the TxnQ API) */
+    ETxnStatus         eStatus;
+    int i;
+
+    /* Save partition information for translation and validation. */
+    pTwIf->uMemAddr1 = pPartition[0].uMemAdrr;
+    pTwIf->uMemSize1 = pPartition[0].uMemSize;
+    pTwIf->uMemAddr2 = pPartition[1].uMemAdrr;
+    pTwIf->uMemSize2 = pPartition[1].uMemSize;
+    pTwIf->uMemAddr3 = pPartition[2].uMemAdrr;
+    pTwIf->uMemSize3 = pPartition[2].uMemSize;
+    pTwIf->uMemAddr4 = pPartition[3].uMemAdrr;
+
+    /* Allocate memory for the current 4 partition transactions */
+    pPartitionRegTxn = (TPartitionRegTxn *) os_memoryAlloc (pTwIf->hOs, 7*sizeof(TPartitionRegTxn),MemoryNormal);
+    /* Zero the allocated memory to be certain that unused fields will be initialized */
+    os_memoryZero (pTwIf->hOs, pPartitionRegTxn, 7*sizeof(TPartitionRegTxn));
+    pTxnHdr       = &(pPartitionRegTxn->tHdr);
+
+    for (i = 0; i < 7; i++) 
+    {
+        pPartitionRegTxn[i].pData = os_memoryAlloc (pTwIf->hOs, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ, MemoryDMA);
+        os_memoryZero (pTwIf->hOs, pPartitionRegTxn[i].pData, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+        pPartitionRegTxn[i].pData += WSPI_PAD_LEN_READ;
+    }
+
+    
+    /* Prepare partition transaction data */
+    *((TI_UINT32*)(pPartitionRegTxn[0].pData))  = ENDIAN_HANDLE_LONG(pTwIf->uMemAddr1); 
+    *((TI_UINT32*)(pPartitionRegTxn[1].pData))  = ENDIAN_HANDLE_LONG(pTwIf->uMemSize1);  
+    *((TI_UINT32*)(pPartitionRegTxn[2].pData))  = ENDIAN_HANDLE_LONG(pTwIf->uMemAddr2); 
+    *((TI_UINT32*)(pPartitionRegTxn[3].pData))  = ENDIAN_HANDLE_LONG(pTwIf->uMemSize2);  
+    *((TI_UINT32*)(pPartitionRegTxn[4].pData))  = ENDIAN_HANDLE_LONG(pTwIf->uMemAddr3); 
+    *((TI_UINT32*)(pPartitionRegTxn[5].pData))  = ENDIAN_HANDLE_LONG(pTwIf->uMemSize3);  
+    *((TI_UINT32*)(pPartitionRegTxn[6].pData))  = ENDIAN_HANDLE_LONG(pTwIf->uMemAddr4); 
+    
+
+    /* Prepare partition Txn header */
+    for (i=0; i<7; i++)
+    {
+        pTxnHdr = &(pPartitionRegTxn[i].tHdr);
+        TXN_PARAM_SET(pTxnHdr, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR)
+        TXN_PARAM_SET_MORE(pTxnHdr, 1);         
+        TXN_PARAM_SET_SINGLE_STEP(pTxnHdr, 0);
+    }
+
+
+    /* Memory address */
+    pTxnHdr = &(pPartitionRegTxn[0].tHdr);
+    BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+4,  pPartitionRegTxn[0].pData, REGISTER_SIZE, 0, 0)
+    twIf_SendTransaction (pTwIf, pTxnHdr);
+
+    /* Memory size */
+    pTxnHdr = &(pPartitionRegTxn[1].tHdr);
+    BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+0,  pPartitionRegTxn[1].pData, REGISTER_SIZE, 0, 0)
+    twIf_SendTransaction (pTwIf, pTxnHdr);
+
+    /* Registers address */
+    pTxnHdr = &(pPartitionRegTxn[2].tHdr);
+    BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+12, pPartitionRegTxn[2].pData, REGISTER_SIZE, 0, 0)
+    twIf_SendTransaction (pTwIf, pTxnHdr);
+
+    /* Registers size */
+    pTxnHdr = &(pPartitionRegTxn[3].tHdr);
+    BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+8,  pPartitionRegTxn[3].pData, REGISTER_SIZE, 0, 0)
+    eStatus = twIf_SendTransaction (pTwIf, pTxnHdr);
+
+
+    /* Registers address */
+    pTxnHdr = &(pPartitionRegTxn[4].tHdr);
+    BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+20, pPartitionRegTxn[4].pData, REGISTER_SIZE, 0, 0)
+    twIf_SendTransaction (pTwIf, pTxnHdr);
+
+    /* Registers size */
+    pTxnHdr = &(pPartitionRegTxn[5].tHdr);
+    BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+16,  pPartitionRegTxn[5].pData, REGISTER_SIZE, 0, 0)
+    eStatus = twIf_SendTransaction (pTwIf, pTxnHdr);
+
+    /* Registers address */
+    pTxnHdr = &(pPartitionRegTxn[6].tHdr);
+    BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+24, pPartitionRegTxn[6].pData, REGISTER_SIZE, twIf_PartitionTxnDoneCb, pTwIf)
+    twIf_SendTransaction (pTwIf, pTxnHdr);
+
+    /* If the transaction is done, free the allocated memory (otherwise freed in the partition CB) */
+    if (eStatus != TXN_STATUS_PENDING) 
+    {
+        for (i = 0; i < 7; i++)
+        {
+            os_memoryFree (pTwIf->hOs, pPartitionRegTxn[i].pData - WSPI_PAD_LEN_READ, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+        }
+        /* Release the memory for the 4 partition transactions */
+        os_memoryFree (pTwIf->hOs, pPartitionRegTxn, 7 * sizeof(TPartitionRegTxn)); 
+    }
+}
+
+
+static void twIf_PartitionTxnDoneCb (TI_HANDLE hTwIf, void *hTxn)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*) hTwIf;
+    TPartitionRegTxn *pPartitionTxn;
+    int i;
+
+    pPartitionTxn = (TPartitionRegTxn *)((char *)hTxn - (6 * sizeof(TPartitionRegTxn)));
+
+    /* Free the partition transaction buffer after completed (see transaction above) */
+    for (i = 0; i < 7; i++)
+        {
+            os_memoryFree (pTwIf->hOs, pPartitionTxn[i].pData - WSPI_PAD_LEN_READ, sizeof(TI_UINT32) + WSPI_PAD_LEN_READ);
+        }
+    os_memoryFree (pTwIf->hOs, 
+                   (char *)hTxn - (6 * sizeof(TPartitionRegTxn)),  /* Move back to the first Txn start */
+                   7 * sizeof(TPartitionRegTxn)); 
+}
+
+
+/** 
+ * \fn     twIf_Awake
+ * \brief  Request to keep the device awake
+ * 
+ * Used by the Xfer modules to request to keep the device awake until twIf_Sleep() is called.
+ * Each call to this function increments AwakeReq counter. Once the device is awake (upon transaction), 
+ *     the TwIf SM keeps it awake as long as this counter is not zero.
+ * 
+ * \note   
+ * \param  hTwIf - The module's object
+ * \return void
+ * \sa     twIf_Sleep
+ */ 
+void twIf_Awake (TI_HANDLE hTwIf)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*) hTwIf;
+
+    /* Increment awake requests counter */
+    pTwIf->uAwakeReqCount++;
+
+#ifdef TI_DBG
+    pTwIf->uDbgCountAwake++;
+    TRACE1(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_Awake: uAwakeReqCount = %d\n", pTwIf->uAwakeReqCount);
+#endif
+}
+
+
+/** 
+ * \fn     twIf_Sleep
+ * \brief  Remove request to keep the device awake
+ * 
+ * Each call to this function decrements AwakeReq counter.
+ * Once this counter is zeroed, if the TxnQ is empty (no WLAN transactions), the TwIf SM is 
+ *     invoked to stop the TxnQ and enable the device to sleep (write 0 to ELP register).
+ * 
+ * \note   
+ * \param  hTwIf - The module's object
+ * \return void
+ * \sa     twIf_Awake
+ */ 
+void twIf_Sleep (TI_HANDLE hTwIf)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*) hTwIf;
+
+    /* Decrement awake requests counter */
+    if (pTwIf->uAwakeReqCount > 0) /* in case of redundant call after recovery */
+    {   
+    pTwIf->uAwakeReqCount--;
+    }
+
+#ifdef TI_DBG
+    pTwIf->uDbgCountSleep++;
+    TRACE1(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_Sleep: uAwakeReqCount = %d\n", pTwIf->uAwakeReqCount);
+#endif
+
+    /* If Awake not required and no pending transactions in TxnQ, issue Sleep event to SM */
+    if ((pTwIf->uAwakeReqCount == 0) && (pTwIf->uPendingTxnCount == 0))
+    {
+        twIf_HandleSmEvent (pTwIf, SM_EVENT_SLEEP);
+    }
+}
+
+
+/** 
+ * \fn     twIf_HwAvailable
+ * \brief  The device is awake
+ * 
+ * This is an indication from the FwEvent that the device is awake.
+ * Issue HW_AVAILABLE event to the SM.
+ * 
+ * \note   
+ * \param  hTwIf - The module's object
+ * \return void
+ * \sa     
+ */ 
+void twIf_HwAvailable (TI_HANDLE hTwIf)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*) hTwIf;
+
+    TRACE0(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_HwAvailable: HW is Available\n");
+
+    /* Issue HW_AVAILABLE event to the SM */
+    twIf_HandleSmEvent (pTwIf, SM_EVENT_HW_AVAILABLE);
+}
+
+
+/** 
+ * \fn     twIf_Transact
+ * \brief  Issue a transaction
+ * 
+ * This method is used by the Xfer modules to issue all transaction types.
+ * Translate HW address according to bus partition and call twIf_SendTransaction().
+ * 
+ * \note   
+ * \param  hTwIf - The module's object
+ * \param  pTxn  - The transaction object 
+ * \return COMPLETE if the transaction was completed in this context, PENDING if not, ERROR if failed
+ * \sa     twIf_SendTransaction
+ */ 
+ETxnStatus twIf_Transact (TI_HANDLE hTwIf, TTxnStruct *pTxn)
+{
+    TTwIfObj  *pTwIf   = (TTwIfObj*)hTwIf;
+
+    /* Translate HW address for registers region */
+    if ((pTxn->uHwAddr >= pTwIf->uMemAddr2) && (pTxn->uHwAddr <= pTwIf->uMemAddr2 + pTwIf->uMemSize2))
+    {
+        pTxn->uHwAddr = pTxn->uHwAddr - pTwIf->uMemAddr2 + pTwIf->uMemSize1;
+    }
+    /* Translate HW address for memory region */
+    else 
+    {
+        pTxn->uHwAddr = pTxn->uHwAddr - pTwIf->uMemAddr1;
+    }
+
+    /* Regular transaction are not the last and are not single step (only ELP write is) */
+    TXN_PARAM_SET_MORE(pTxn, 1);         
+    TXN_PARAM_SET_SINGLE_STEP(pTxn, 0);
+
+    /* Send the transaction to the TxnQ and update the SM if needed. */  
+    return twIf_SendTransaction (pTwIf, pTxn);
+}
+
+ETxnStatus twIf_TransactReadFWStatus (TI_HANDLE hTwIf, TTxnStruct *pTxn)
+{
+    TTwIfObj  *pTwIf   = (TTwIfObj*)hTwIf;
+
+    /* Regular transaction are not the last and are not single step (only ELP write is) */
+    TXN_PARAM_SET_MORE(pTxn, 1);         
+    TXN_PARAM_SET_SINGLE_STEP(pTxn, 0);
+
+    /* Send the transaction to the TxnQ and update the SM if needed. */  
+    return twIf_SendTransaction (pTwIf, pTxn);
+}
+
+
+/** 
+ * \fn     twIf_SendTransaction
+ * \brief  Send a transaction to the device
+ * 
+ * This method is used by the Xfer modules and the TwIf to send all transaction types to the device.
+ * Send the transaction to the TxnQ and update the SM if needed.
+ * 
+ * \note   
+ * \param  pTwIf - The module's object
+ * \param  pTxn  - The transaction object 
+ * \return COMPLETE if the transaction was completed in this context, PENDING if not, ERROR if failed
+ * \sa     
+ */ 
+static ETxnStatus twIf_SendTransaction (TTwIfObj *pTwIf, TTxnStruct *pTxn)
+{
+    ETxnStatus eStatus;
+
+#ifdef TI_DBG
+    /* Verify that the Txn HW-Address is 4-bytes aligned 
+	- in QOS it should be 2 bytes aligned */
+	if (pTxn->uHwAddr & 0x3)
+	{
+		TRACE2(pTwIf->hReport, REPORT_SEVERITY_WARNING, "twIf_SendTransaction: Unaligned HwAddr! might be QOS: HwAddr=0x%x, Params=0x%x\n", pTxn->uHwAddr, pTxn->uTxnParams);		
+	}	
+    /* Verify that the host addresses lengths are 4-bytes aligned */
+	if ((pTxn->aLen[0] & 0x3) || (pTxn->aLen[1] & 0x3))
+	{
+		TRACE6(pTwIf->hReport, REPORT_SEVERITY_WARNING, "twIf_SendTransaction: Unaligned Length! might be QOS: Len0=%d, Len1=%d, Len2=%d, Len3=%d, Params=0x%x, HwAddr=0x%x\n", pTxn->aLen[0], pTxn->aLen[1], pTxn->aLen[2], pTxn->aLen[3], pTxn->uTxnParams, pTxn->uHwAddr);
+	
+	}	
+    /* 
+     * Note: We may add other checks here, like length 2 & 3 and host addresses alignment.
+     *       Note that the host address for read transaction may be unaligned (for Rx-Xfer QoS packets)
+     */
+#endif
+
+
+    /* Send transaction to TxnQ */
+    eStatus = txnQ_Transact(pTwIf->hTxnQ, pTxn);
+
+#ifdef TI_DBG
+    pTwIf->uDbgCountTxn++;
+    if      (eStatus == TXN_STATUS_COMPLETE) { pTwIf->uDbgCountTxnComplete++; }
+    else if (eStatus == TXN_STATUS_PENDING ) { pTwIf->uDbgCountTxnPending++;  }
+    TRACE8(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_SendTransaction: Status = %d, Params=0x%x, HwAddr=0x%x, Len0=%d, Len1=%d, Len2=%d, Len3=%d, Data0=%x \n", eStatus, pTxn->uTxnParams, pTxn->uHwAddr, pTxn->aLen[0], pTxn->aLen[1], pTxn->aLen[2], pTxn->aLen[3], *((TI_UINT32*)pTxn->aBuf[0]));
+#endif
+
+    /* If Txn status is PENDING, increment pending Txn counter and issue Start event to the SM */
+    if (eStatus == TXN_STATUS_PENDING)
+    {
+        pTwIf->uPendingTxnCount++;
+        twIf_HandleSmEvent (pTwIf, SM_EVENT_START);
+    }
+
+    /* Else (COMPLETE or ERROR) */
+    else
+    {
+        /* If Awake not required and no pending transactions in TxnQ, issue Sleep event to SM */
+        if ((pTwIf->uAwakeReqCount == 0) && (pTwIf->uPendingTxnCount == 0))
+        {
+            twIf_HandleSmEvent (pTwIf, SM_EVENT_SLEEP);
+        }
+
+        /* If Txn failed and error CB available, call it to initiate recovery */
+        if (eStatus == TXN_STATUS_ERROR)
+        {
+            TRACE6(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_SendTransaction: Txn failed!!  Params=0x%x, HwAddr=0x%x, Len0=%d, Len1=%d, Len2=%d, Len3=%d\n", pTxn->uTxnParams, pTxn->uHwAddr, pTxn->aLen[0], pTxn->aLen[1], pTxn->aLen[2], pTxn->aLen[3]);
+
+            if (pTwIf->fErrCb)
+            {
+                pTwIf->fErrCb (pTwIf->hErrCb, BUS_FAILURE);
+            }
+        }
+    }
+
+    /* Return the Txn status (COMPLETE if completed in this context, PENDING if not, ERROR if failed) */
+    return eStatus;
+}
+
+
+/** 
+ * \fn     twIf_HandleSmEvent
+ * \brief  The TwIf SM implementation
+ * 
+ * Handle SM event.
+ * Control the device awake/sleep states and the TxnQ run/stop states according to the event.
+ *  
+ * \note   
+ * \param  hTwIf - The module's object
+ * \return void
+ * \sa     
+ */ 
+static void twIf_HandleSmEvent (TTwIfObj *pTwIf, ESmEvent eEvent)
+{
+	ESmState eState = pTwIf->eState;  /* The state before handling the event */
+
+    /* Switch by current state and handle event */
+    switch (eState)
+    {
+    case SM_STATE_AWAKE:
+        /* SLEEP event:  AWAKE ==> SLEEP,  stop TxnQ and set ELP reg to sleep */
+        if (eEvent == SM_EVENT_SLEEP)
+        {
+            pTwIf->eState = SM_STATE_SLEEP;
+            txnQ_Stop (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN);
+            twIf_WriteElpReg (pTwIf, ELP_CTRL_REG_SLEEP);
+        }
+        break;
+    case SM_STATE_SLEEP:
+        /* START event:  SLEEP ==> WAIT_HW,  set ELP reg to wake-up */
+        if (eEvent == SM_EVENT_START)
+        {
+            pTwIf->eState = SM_STATE_WAIT_HW;
+            twIf_WriteElpReg (pTwIf, ELP_CTRL_REG_AWAKE);
+        }
+        /* HW_AVAILABLE event:  SLEEP ==> AWAKE,  set ELP reg to wake-up and run TxnQ */
+        else if (eEvent == SM_EVENT_HW_AVAILABLE)
+        {
+            pTwIf->eState = SM_STATE_AWAKE;
+            twIf_WriteElpReg (pTwIf, ELP_CTRL_REG_AWAKE);
+            txnQ_Run (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN);
+        }
+        break;
+    case SM_STATE_WAIT_HW:
+        /* HW_AVAILABLE event:  WAIT_HW ==> AWAKE,  run TxnQ */
+        if (eEvent == SM_EVENT_HW_AVAILABLE)
+        {
+            pTwIf->eState = SM_STATE_AWAKE;
+            txnQ_Run (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN);
+        }
+        break;
+    }
+
+	TRACE3(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_HandleSmEvent: <currentState = %d, event = %d> --> nextState = %d\n", eState, eEvent, pTwIf->eState);
+}
+
+
+/** 
+ * \fn     twIf_TxnDoneCb
+ * \brief  Transaction completion CB
+ * 
+ * This callback is called by the TxnQ upon transaction completion, unless is was completed in
+ *     the original context where it was issued.
+ * It may be called from bus driver external context (TxnDone ISR) or from WLAN driver context.
+ *  
+ * \note   
+ * \param  hTwIf - The module's object
+ * \param  pTxn  - The completed transaction object 
+ * \return void
+ * \sa     twIf_HandleTxnDone
+ */ 
+static void twIf_TxnDoneCb (TI_HANDLE hTwIf, TTxnStruct *pTxn)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*)hTwIf;
+
+#ifdef TI_DBG
+    pTwIf->uDbgCountTxnDoneCb++;
+    TRACE6(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_TxnDoneCb: Params=0x%x, HwAddr=0x%x, Len0=%d, Len1=%d, Len2=%d, Len3=%d\n", pTxn->uTxnParams, pTxn->uHwAddr, pTxn->aLen[0], pTxn->aLen[1], pTxn->aLen[2], pTxn->aLen[3]);
+#endif
+
+    /* In case of recovery flag, Call directly restart callback */
+    if (TXN_PARAM_GET_STATUS(pTxn) == TXN_PARAM_STATUS_RECOVERY)
+    {
+        if (pTwIf->fRecoveryCb)
+        {
+            TRACE0(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_TxnDoneCb: call RecoveryCb\n");
+            pTwIf->fRecoveryCb(pTwIf->hRecoveryCb);
+            return;
+        }
+    }
+
+    /* If the completed Txn is ELP, nothing to do (not counted) so exit */
+    if (TXN_PARAM_GET_SINGLE_STEP(pTxn)) 
+    {
+        return;
+    }
+
+    if (pTxn->fTxnDoneCb)
+    {
+        /* In critical section, enqueue the completed transaction in the TxnDoneQ. */
+        que_Enqueue (pTwIf->hTxnDoneQueue, (TI_HANDLE)pTxn);
+    }
+    else
+    {
+         /* Decrement pending Txn counter, It's value will be checked in twIf_HandleTxnDone() */
+        if (pTwIf->uPendingTxnCount > 0) /* in case of callback on recovery after restart */
+        {
+            pTwIf->uPendingTxnCount--;
+        }
+    }
+    
+        /* Request schedule to continue handling in driver context (will call twIf_HandleTxnDone()) */
+        context_RequestSchedule (pTwIf->hContext, pTwIf->uContextId);
+    }
+
+
+/** 
+ * \fn     twIf_HandleTxnDone
+ * \brief  Completed transactions handler
+ * 
+ * The completed transactions handler, called upon TxnDone event, either from the context engine
+ *     or directly from twIf_TxnDoneCb() if we are already in the WLAN driver's context.
+ * Dequeue all completed transactions in critical section, and call their callbacks if available.
+ * If awake is not required and no pending transactions in TxnQ, issue Sleep event to SM.
+ *  
+ * \note   
+ * \param  hTwIf - The module's object
+ * \return void
+ * \sa     
+ */ 
+static void twIf_HandleTxnDone (TI_HANDLE hTwIf)
+{
+    TTwIfObj   *pTwIf = (TTwIfObj*)hTwIf;
+    TTxnStruct *pTxn;
+
+    /* Loop while there are completed transactions to handle */
+    while (1) 
+    {
+        /* In critical section, dequeue completed transaction from the TxnDoneQ. */
+        CONTEXT_ENTER_CRITICAL_SECTION (pTwIf->hContext);
+        pTxn = (TTxnStruct *) que_Dequeue (pTwIf->hTxnDoneQueue);
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTwIf->hContext);
+
+        /* If no more transactions to handle, exit */
+        if (pTxn != NULL)
+        {
+            /* Decrement pending Txn counter */ 
+            if (pTwIf->uPendingTxnCount > 0) /* in case of callback on recovery after restart */
+            {   
+            pTwIf->uPendingTxnCount--;
+            }
+            
+            TRACE4(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_HandleTxnDone: Completed-Txn: Params=0x%x, HwAddr=0x%x, Len0=%d, fTxnDoneCb=0x%x\n", pTxn->uTxnParams, pTxn->uHwAddr, pTxn->aLen[0], pTxn->fTxnDoneCb);
+    
+            /* If Txn failed and error CB available, call it to initiate recovery */
+            if (TXN_PARAM_GET_STATUS(pTxn) == TXN_PARAM_STATUS_ERROR)
+            {
+                TRACE6(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_HandleTxnDone: Txn failed!!  Params=0x%x, HwAddr=0x%x, Len0=%d, Len1=%d, Len2=%d, Len3=%d\n", pTxn->uTxnParams, pTxn->uHwAddr, pTxn->aLen[0], pTxn->aLen[1], pTxn->aLen[2], pTxn->aLen[3]);
+    
+                if (pTwIf->fErrCb)
+                {
+                    pTwIf->fErrCb (pTwIf->hErrCb, BUS_FAILURE);
+                }
+                /* in error do not continue */
+		return;
+            }
+    
+            /* If Txn specific CB available, call it (may free Txn resources and issue new Txns) */
+            if (pTxn->fTxnDoneCb != NULL)
+            {
+                ((TTxnDoneCb)(pTxn->fTxnDoneCb)) (pTxn->hCbHandle, pTxn);
+            } 
+        }
+
+        /*If uPendingTxnCount == 0 and awake not required, issue Sleep event to SM */
+        if ((pTwIf->uAwakeReqCount == 0) && (pTwIf->uPendingTxnCount == 0))
+        {
+            twIf_HandleSmEvent (pTwIf, SM_EVENT_SLEEP);
+        }
+
+        if (pTxn == NULL)
+        {
+            return;
+        }
+    }
+} 
+
+/** 
+ * \fn     twIf_ClearTxnDoneQueue
+ * \brief  Clean the DoneQueue
+ * 
+ * Clear the specified done queue - don't call the callbacks.
+ *  
+ * \note   
+ * \param  hTwIf - The module's object
+ * \return void
+ * \sa     
+ */ 
+static void twIf_ClearTxnDoneQueue (TI_HANDLE hTwIf)
+{
+    TTwIfObj   *pTwIf = (TTwIfObj*)hTwIf;
+    TTxnStruct *pTxn;
+
+    /* Loop while there are completed transactions to handle */
+    while (1) 
+    {
+        /* In critical section, dequeue completed transaction from the TxnDoneQ. */
+        CONTEXT_ENTER_CRITICAL_SECTION (pTwIf->hContext);
+        pTxn = (TTxnStruct *) que_Dequeue (pTwIf->hTxnDoneQueue);
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTwIf->hContext);
+
+        /* If no more transactions to handle, exit */
+        if (pTxn != NULL)
+        {
+            /* Decrement pending Txn counter */ 
+            if (pTwIf->uPendingTxnCount > 0) /* in case of callback on recovery after restart */
+            {   
+                pTwIf->uPendingTxnCount--;
+            }
+            
+            /* 
+             * Drop on Recovery 
+             * do not call pTxn->fTxnDoneCb (pTxn->hCbHandle, pTxn) callback 
+             */
+        }
+
+        if (pTxn == NULL)
+        {
+            return;
+        }
+    }
+}
+TI_BOOL	twIf_isValidMemoryAddr(TI_HANDLE hTwIf, TI_UINT32 Address, TI_UINT32 Length)
+{
+    TTwIfObj   *pTwIf = (TTwIfObj*)hTwIf;
+
+	if ((Address >= pTwIf->uMemAddr1) && 
+			(Address + Length < pTwIf->uMemAddr1 + pTwIf->uMemSize1 ))
+	return TI_TRUE;
+
+	return TI_FALSE;
+}
+
+TI_BOOL	twIf_isValidRegAddr(TI_HANDLE hTwIf, TI_UINT32 Address, TI_UINT32 Length)
+{
+    TTwIfObj   *pTwIf = (TTwIfObj*)hTwIf;
+
+	if ((Address >= pTwIf->uMemAddr2 ) && 
+		( Address < pTwIf->uMemAddr2 + pTwIf->uMemSize2 ))
+	return TI_TRUE;
+
+	return TI_FALSE;
+}
+
+/*******************************************************************************
+*                       DEBUG  FUNCTIONS  IMPLEMENTATION					   *
+********************************************************************************/
+
+#ifdef TI_DBG
+
+/** 
+ * \fn     twIf_PrintModuleInfo
+ * \brief  Print module's parameters (debug)
+ * 
+ * This function prints the module's parameters.
+ * 
+ * \note   
+ * \param  hTwIf - The module's object                                          
+ * \return void 
+ * \sa     
+ */ 
+void twIf_PrintModuleInfo (TI_HANDLE hTwIf) 
+{
+    TTwIfObj *pTwIf = (TTwIfObj*)hTwIf;
+	
+	WLAN_OS_REPORT(("-------------- TwIf Module Info-- ------------------------\n"));
+	WLAN_OS_REPORT(("==========================================================\n"));
+	WLAN_OS_REPORT(("eSmState             = %d\n",   pTwIf->eState					));
+	WLAN_OS_REPORT(("uContextId           = %d\n",   pTwIf->uContextId              ));
+	WLAN_OS_REPORT(("fErrCb               = %d\n",   pTwIf->fErrCb                  ));
+	WLAN_OS_REPORT(("hErrCb               = %d\n",   pTwIf->hErrCb                  ));
+	WLAN_OS_REPORT(("uAwakeReqCount       = %d\n",   pTwIf->uAwakeReqCount          ));
+	WLAN_OS_REPORT(("uPendingTxnCount     = %d\n",   pTwIf->uPendingTxnCount        ));
+	WLAN_OS_REPORT(("uMemAddr             = 0x%x\n", pTwIf->uMemAddr1                ));
+	WLAN_OS_REPORT(("uMemSize             = 0x%x\n", pTwIf->uMemSize1                ));
+	WLAN_OS_REPORT(("uRegAddr             = 0x%x\n", pTwIf->uMemAddr2                ));
+	WLAN_OS_REPORT(("uRegSize             = 0x%x\n", pTwIf->uMemSize2                ));
+	WLAN_OS_REPORT(("uFWStatuSize         = 0x%x\n", pTwIf->uMemSize3                ));
+	WLAN_OS_REPORT(("uFWStatuAddr             = 0x%x\n", pTwIf->uMemSize3            ));
+	WLAN_OS_REPORT(("uFWMemAddr             = 0x%x\n", pTwIf->uMemAddr4             ));
+	WLAN_OS_REPORT(("uDbgCountAwake       = %d\n",   pTwIf->uDbgCountAwake          ));
+	WLAN_OS_REPORT(("uDbgCountSleep       = %d\n",   pTwIf->uDbgCountSleep          ));
+	WLAN_OS_REPORT(("uDbgCountTxn         = %d\n",   pTwIf->uDbgCountTxn            ));
+	WLAN_OS_REPORT(("uDbgCountTxnPending  = %d\n",   pTwIf->uDbgCountTxnPending     ));
+	WLAN_OS_REPORT(("uDbgCountTxnComplete = %d\n",   pTwIf->uDbgCountTxnComplete    ));
+	WLAN_OS_REPORT(("uDbgCountTxnDone     = %d\n",   pTwIf->uDbgCountTxnDoneCb      ));
+	WLAN_OS_REPORT(("==========================================================\n\n"));
+} 
+
+
+void twIf_PrintQueues (TI_HANDLE hTwIf)
+{
+    TTwIfObj *pTwIf = (TTwIfObj*)hTwIf;
+
+    txnQ_PrintQueues(pTwIf->hTxnQ);
+}
+
+
+#endif /* TI_DBG */
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TWD/TwIf/TwIf.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,109 @@
+/*
+ * TwIf.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   TwIf.h 
+ *  \brief  TwIf module API definition                                  
+ *
+ *  \see    TwIf.c
+ */
+
+#ifndef __TWIF_API_H__
+#define __TWIF_API_H__
+
+
+#include "Device.h"
+#include "TxnDefs.h"
+#include "BusDrv.h"
+
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+
+
+/************************************************************************
+ * Macros
+ ************************************************************************/
+/* 
+ * Defines a TNETWIF read/write field with padding.
+ * A low level driver may use this padding internally
+ */
+#define PADDING(field) \
+    TI_UINT8 padding [TNETWIF_READ_OFFSET_BYTES];  \
+    field;
+
+
+/************************************************************************
+ * Types
+ ************************************************************************/
+
+typedef void (*TTwIfCallback)(TI_HANDLE hCb);
+typedef void (*TRecoveryCb)(TI_HANDLE hCb);
+
+
+
+/************************************************************************
+ * Functions
+ ************************************************************************/
+TI_HANDLE   twIf_Create (TI_HANDLE hOs);
+TI_STATUS   twIf_Destroy (TI_HANDLE hTwIf);
+void        twIf_Init (TI_HANDLE hTwIf, TI_HANDLE hReport, TI_HANDLE hContext, TI_HANDLE hTxnQ, TRecoveryCb fRecoveryCb, TI_HANDLE hRecoveryCb);
+void        twIf_RegisterErrCb (TI_HANDLE hTwIf, void *fErrCb, TI_HANDLE hErrCb);
+ETxnStatus  twIf_Restart (TI_HANDLE hTwIf);
+void        twIf_SetPartition (TI_HANDLE hTwIf,
+                               TPartition *pPartition);
+void        twIf_Awake (TI_HANDLE hTwIf);
+void        twIf_Sleep (TI_HANDLE hTwIf);
+void        twIf_HwAvailable (TI_HANDLE hTwIf);
+ETxnStatus  twIf_Transact (TI_HANDLE hTwIf, TTxnStruct *pTxn);
+ETxnStatus  twIf_TransactReadFWStatus (TI_HANDLE hTwIf, TTxnStruct *pTxn);
+
+TI_BOOL		twIf_isValidMemoryAddr(TI_HANDLE hTwIf, TI_UINT32 Address, TI_UINT32 Length);
+TI_BOOL		twIf_isValidRegAddr(TI_HANDLE hTwIf, TI_UINT32 Address, TI_UINT32 Length);
+
+#ifdef TI_DBG
+    void        twIf_PrintModuleInfo (TI_HANDLE hTwIf);
+    void        twIf_PrintQueues (TI_HANDLE hTwIf);
+#endif /* TI_DBG */
+
+
+
+
+#endif /*__TWIF_API_H__*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Txn/BusDrv.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,208 @@
+/*
+ * BusDrv.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   BusDrv.h 
+ *  \brief  Bus-Driver module API definition                                  
+ *
+ *  \see    SdioBusDrv.c, WspiBusDrv.c
+ */
+
+#ifndef __BUS_DRV_API_H__
+#define __BUS_DRV_API_H__
+
+
+#include "TxnDefs.h"
+#include "queue.h"
+
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+
+
+/* In SDIO block-mode:  BlkSize = 1 << BlkSizeShift    (current block size is: 1<<9 = 512 bytes) */
+#define SDIO_BLK_SIZE_SHIFT_MIN                             0
+#define SDIO_BLK_SIZE_SHIFT_MAX                             16
+#define SDIO_BLK_SIZE_SHIFT_DEF                             9
+
+#define WSPI_PAD_LEN_WRITE          4
+#define WSPI_PAD_LEN_READ           8                    
+#define MAX_XFER_BUFS               4
+
+#define TXN_PARAM_STATUS_OK         0
+#define TXN_PARAM_STATUS_ERROR      1
+#define TXN_PARAM_STATUS_RECOVERY   2
+
+#define TXN_DIRECTION_WRITE         0
+#define TXN_DIRECTION_READ          1
+
+#define TXN_FUNC_ID_CTRL            0
+#define TXN_FUNC_ID_BT              1
+#define TXN_FUNC_ID_WLAN            2
+
+#define TXN_HIGH_PRIORITY           0
+#define TXN_LOW_PRIORITY            1
+#define TXN_NUM_PRIORITYS           2
+
+#define TXN_INC_ADDR                0
+#define TXN_FIXED_ADDR              1
+#define TXN_NON_SLEEP_ELP           1
+#define TXN_SLEEP_ELP               0
+
+#define TXN_AGGREGATE_OFF           0
+#define TXN_AGGREGATE_ON            1
+
+#define NUM_OF_PARTITION            4
+
+/************************************************************************
+ * Macros
+ ************************************************************************/
+/* Get field from TTxnStruct->uTxnParams */
+#define TXN_PARAM_GET_PRIORITY(pTxn)            ( (pTxn->uTxnParams & 0x00000003) >> 0 )
+#define TXN_PARAM_GET_FUNC_ID(pTxn)             ( (pTxn->uTxnParams & 0x0000000C) >> 2 )
+#define TXN_PARAM_GET_DIRECTION(pTxn)           ( (pTxn->uTxnParams & 0x00000010) >> 4 )
+#define TXN_PARAM_GET_FIXED_ADDR(pTxn)          ( (pTxn->uTxnParams & 0x00000020) >> 5 )
+#define TXN_PARAM_GET_MORE(pTxn)                ( (pTxn->uTxnParams & 0x00000040) >> 6 )
+#define TXN_PARAM_GET_SINGLE_STEP(pTxn)         ( (pTxn->uTxnParams & 0x00000080) >> 7 )
+#define TXN_PARAM_GET_STATUS(pTxn)              ( (pTxn->uTxnParams & 0x00000F00) >> 8 )
+#define TXN_PARAM_GET_AGGREGATE(pTxn)           ( (pTxn->uTxnParams & 0x00001000) >> 12 )
+
+/* Set field in TTxnStruct->uTxnParams */
+#define TXN_PARAM_SET_PRIORITY(pTxn, uValue)    ( pTxn->uTxnParams = (pTxn->uTxnParams & ~0x00000003) | (uValue << 0 ) )
+#define TXN_PARAM_SET_FUNC_ID(pTxn, uValue)     ( pTxn->uTxnParams = (pTxn->uTxnParams & ~0x0000000C) | (uValue << 2 ) )
+#define TXN_PARAM_SET_DIRECTION(pTxn, uValue)   ( pTxn->uTxnParams = (pTxn->uTxnParams & ~0x00000010) | (uValue << 4 ) )
+#define TXN_PARAM_SET_FIXED_ADDR(pTxn, uValue)  ( pTxn->uTxnParams = (pTxn->uTxnParams & ~0x00000020) | (uValue << 5 ) )
+#define TXN_PARAM_SET_MORE(pTxn, uValue)        ( pTxn->uTxnParams = (pTxn->uTxnParams & ~0x00000040) | (uValue << 6 ) )
+#define TXN_PARAM_SET_SINGLE_STEP(pTxn, uValue) ( pTxn->uTxnParams = (pTxn->uTxnParams & ~0x00000080) | (uValue << 7 ) )
+#define TXN_PARAM_SET_STATUS(pTxn, uValue)      ( pTxn->uTxnParams = (pTxn->uTxnParams & ~0x00000F00) | (uValue << 8 ) )
+#define TXN_PARAM_SET_AGGREGATE(pTxn, uValue)   ( pTxn->uTxnParams = (pTxn->uTxnParams & ~0x00001000) | (uValue << 12 ) )
+
+
+#define TXN_PARAM_SET(pTxn, uPriority, uId, uDirection, uAddr) \
+        TXN_PARAM_SET_PRIORITY(pTxn, uPriority); \
+        TXN_PARAM_SET_FUNC_ID(pTxn, uId); \
+        TXN_PARAM_SET_DIRECTION(pTxn, uDirection); \
+        TXN_PARAM_SET_FIXED_ADDR(pTxn, uAddr);
+
+#define BUILD_TTxnStruct(pTxn, uAddr, pBuf, uLen, fCB, hCB) \
+    pTxn->aBuf[0] = (TI_UINT8*)(pBuf); \
+    pTxn->aLen[0] = (TI_UINT16)(uLen); \
+    pTxn->aLen[1] = 0;                 \
+    pTxn->uHwAddr = uAddr;             \
+    pTxn->hCbHandle = (void*)hCB;      \
+    pTxn->fTxnDoneCb = fCB;
+
+
+/************************************************************************
+ * Types
+ ************************************************************************/
+/* The TxnDone CB called by the bus driver upon Async Txn completion */
+typedef void (*TBusDrvTxnDoneCb)(TI_HANDLE hCbHandle, void *pTxn);
+
+/* The TxnDone CB called by the TxnQueue upon Async Txn completion */
+typedef void (*TTxnQueueDoneCb)(TI_HANDLE hCbHandle, void *pTxn);
+
+/* The TxnDone CB of the specific Txn originator (Xfer layer) called upon Async Txn completion */
+typedef void (*TTxnDoneCb)(TI_HANDLE hCbHandle, void *pTxn);
+
+/* The transactions structure */
+typedef struct
+{
+    TQueNodeHdr  tTxnQNode;                /* Header for queueing */
+    TI_UINT32    uTxnParams;               /* Txn attributes (bit fields) - see macros above */
+    TI_UINT32    uHwAddr;                  /* Physical (32 bits) HW Address */
+    TTxnDoneCb	 fTxnDoneCb;               /* CB called by TwIf upon Async Txn completion (may be NULL) */
+    TI_HANDLE    hCbHandle;                /* The handle to use when calling fTxnDoneCb */
+    TI_UINT16    aLen[MAX_XFER_BUFS];      /* Lengths of the following aBuf data buffers respectively.
+                                              Zero length marks last used buffer, or MAX_XFER_BUFS of all are used. */
+    TI_UINT8*    aBuf[MAX_XFER_BUFS];      /* Host data buffers to be written to or read from the device */
+} TTxnStruct; 
+
+/* Parameters for all bus types configuration in ConnectBus process */
+
+typedef struct
+{
+    TI_UINT32    uBlkSizeShift;
+} TSdioCfg; 
+
+typedef struct
+{
+    TI_UINT32    uDummy;
+} TWspiCfg; 
+
+typedef struct
+{
+    TI_UINT32    uBaudRate;
+} TUartCfg; 
+
+typedef union
+{
+    TSdioCfg    tSdioCfg;       
+    TWspiCfg    tWspiCfg;       
+    TUartCfg    tUartCfg;       
+
+} TBusDrvCfg;
+
+
+typedef struct
+{
+    TI_UINT32   uMemAdrr;
+    TI_UINT32   uMemSize;
+} TPartition;
+
+
+/************************************************************************
+ * Functions
+ ************************************************************************/
+TI_HANDLE   busDrv_Create     (TI_HANDLE hOs);
+TI_STATUS   busDrv_Destroy    (TI_HANDLE hBusDrv);
+void        busDrv_Init       (TI_HANDLE hBusDrv, TI_HANDLE hReport);
+TI_STATUS   busDrv_ConnectBus (TI_HANDLE        hBusDrv, 
+                               TBusDrvCfg       *pBusDrvCfg,
+                               TBusDrvTxnDoneCb fCbFunc,
+                               TI_HANDLE        hCbArg,
+                               TBusDrvTxnDoneCb fConnectCbFunc);
+TI_STATUS   busDrv_DisconnectBus (TI_HANDLE hBusDrv);
+ETxnStatus  busDrv_Transact   (TI_HANDLE hBusDrv, TTxnStruct *pTxn);
+TI_HANDLE busDrv_Cfg (TI_HANDLE hOs);
+
+
+
+#endif /*__BUS_DRV_API_H__*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Txn/SdioBusDrv.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,547 @@
+/*
+ * SdioBusDrv.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   SdioBusDrv.c 
+ *  \brief  The SDIO bus driver upper layer. Platform independent. 
+ *          Uses the SdioAdapter API. 
+ *          Introduces a generic bus-independent API upwards.
+ *  
+ *  \see    BusDrv.h, SdioAdapter.h, SdioAdapter.c
+ */
+
+#define __FILE_ID__  FILE_ID_122
+#include "tidef.h"
+#include "report.h"
+#include "osApi.h"
+#include "TxnDefs.h"
+#include "SdioAdapter.h"
+#include "BusDrv.h"
+
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+#undef  USE_BLOCK_MODE    /* Don't use SDIO block mode */
+
+#define MAX_TXN_PARTS     MAX_XFER_BUFS * 2   /* Max number of txn parts derived from one TxnStruct */
+
+
+/************************************************************************
+ * Types
+ ************************************************************************/
+
+/* A single SDIO bus transaction which is a part of a complete transaction (TTxnStruct) */ 
+typedef struct
+{
+    TI_BOOL          bBlkMode;           /* If TRUE this is a block-mode SDIO transaction */
+    TI_UINT32        uLength;            /* Length in byte */
+    TI_UINT32        uHwAddr;            /* The device address to write to or read from */
+    void *           pHostAddr;          /* The host buffer address to write from or read into */
+    TI_BOOL          bMore;              /* If TRUE, indicates the lower driver to keep awake for more transactions */
+} TTxnPart; 
+
+
+/* The busDrv module Object */
+typedef struct _TBusDrvObj
+{
+    TI_HANDLE	     hOs;		   	 
+    TI_HANDLE	     hReport;
+
+	TBusDrvTxnDoneCb fTxnDoneCb;         /* The callback to call upon full transaction completion. */
+	TI_HANDLE        hCbHandle;          /* The callback handle */
+    TTxnStruct *     pCurrTxn;           /* The transaction currently being processed */
+    ETxnStatus       eCurrTxnStatus;     /* COMPLETE, PENDING or ERROR */
+    TTxnPart         aTxnParts[MAX_TXN_PARTS]; /* The actual bus transactions of current transaction */
+    TI_UINT32        uCurrTxnPartsNum;   /* Number of transaction parts composing the current transaction */
+    TI_UINT32        uCurrTxnPartsCount; /* Number of transaction parts already executed */
+    TI_UINT32        uBlkSizeShift;      /* In block-mode:  uBlkSize = (1 << uBlkSizeShift) = 512 bytes */
+    TI_UINT32        uBlkSize;           /* In block-mode:  uBlkSize = (1 << uBlkSizeShift) = 512 bytes */
+    TI_UINT32        uBlkSizeMask;       /* In block-mode:  uBlkSizeMask = uBlkSize - 1 = 0x1FF*/
+	TI_HANDLE	     hWsdio;
+} TBusDrvObj;
+
+
+/************************************************************************
+ * Internal functions prototypes
+ ************************************************************************/
+static void busDrv_PrepareTxnParts  (TBusDrvObj *pBusDrv, TTxnStruct *pTxn);
+static void busDrv_SendTxnParts     (TBusDrvObj *pBusDrv);
+static void busDrv_TxnDoneCb        (TI_HANDLE hBusDrv, TI_INT32 status);
+ 
+
+
+/************************************************************************
+ *
+ *   Module functions implementation
+ *
+ ************************************************************************/
+
+/** 
+ * \fn     busDrv_Create 
+ * \brief  Create the module
+ * 
+ * Create and clear the bus driver's object, and the SDIO-adapter.
+ * 
+ * \note   
+ * \param  hOs - Handle to Os Abstraction Layer
+ * \return Handle of the allocated object, NULL if allocation failed 
+ * \sa     busDrv_Destroy
+ */ 
+TI_HANDLE busDrv_Create (TI_HANDLE hOs)
+{
+    TI_HANDLE   hBusDrv;
+    TBusDrvObj *pBusDrv;
+
+    hBusDrv = os_memoryAlloc(hOs, sizeof(TBusDrvObj),MemoryNormal);
+    if (hBusDrv == NULL)
+    {
+		WLAN_OS_REPORT(("SdioBusDrv.c - os_memoryAlloc - ERROR"));
+        return NULL;
+    }
+    
+    pBusDrv = (TBusDrvObj *)hBusDrv;
+
+    os_memoryZero(hOs, hBusDrv, sizeof(TBusDrvObj));
+    
+    pBusDrv->hOs = hOs;
+	pBusDrv->hWsdio = wsdioAdapt_Open(pBusDrv->hOs);
+
+    return pBusDrv;
+}
+
+TI_HANDLE busDrv_Cfg (TI_HANDLE hOs)
+{
+	TI_HANDLE	hBusDrvCfg;
+    TBusDrvCfg *pBusDrvCfg;
+	
+	//WLAN_OS_REPORT(("SdioBusDrv.c - busDrv_Create - BEGIN"));
+
+    hBusDrvCfg = os_memoryAlloc(hOs, sizeof(TBusDrvCfg),MemoryNormal);
+    if (hBusDrvCfg == NULL)
+    {
+		WLAN_OS_REPORT(("SdioBusDrv.c - os_memoryAlloc - ERROR"));
+		return NULL;
+    }
+    
+    pBusDrvCfg = (TBusDrvCfg *)hBusDrvCfg;
+
+	return pBusDrvCfg;
+}
+
+/** 
+ * \fn     busDrv_Destroy
+ * \brief  Destroy the module. 
+ * 
+ * Close SDIO lower bus driver and free the module's object.
+ * 
+ * \note   
+ * \param  The module's object
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     busDrv_Create
+ */ 
+TI_STATUS busDrv_Destroy (TI_HANDLE hBusDrv)
+{
+    TBusDrvObj *pBusDrv = (TBusDrvObj*)hBusDrv;
+
+    if (pBusDrv)
+    {
+        wSdioAdapt_Close(pBusDrv->hWsdio);
+        os_memoryFree (pBusDrv->hOs, pBusDrv, sizeof(TBusDrvObj));     
+    }
+    return TI_OK;
+}
+
+
+/** 
+ * \fn     busDrv_Init
+ * \brief  Init bus driver 
+ * 
+ * Init module parameters.
+
+ * \note   
+ * \param  hBusDrv - The module's handle
+ * \param  hReport - report module handle
+ * \return void
+ * \sa     
+ */ 
+void busDrv_Init (TI_HANDLE hBusDrv, TI_HANDLE hReport)
+{
+    TBusDrvObj *pBusDrv = (TBusDrvObj*) hBusDrv;
+
+    pBusDrv->hReport = hReport;
+}
+
+
+/** 
+ * \fn     busDrv_ConnectBus
+ * \brief  Configure bus driver
+ * 
+ * Called by TxnQ.
+ * Configure the bus driver with its connection configuration (such as baud-rate, bus width etc) 
+ *     and establish the physical connection. 
+ * Done once upon init (and not per functional driver startup). 
+ * 
+ * \note   
+ * \param  hBusDrv    - The module's object
+ * \param  pBusDrvCfg - A union used for per-bus specific configuration. 
+ * \param  fCbFunc    - CB function for Async transaction completion (after all txn parts are completed).
+ * \param  hCbArg     - The CB function handle
+ * \return TI_OK / TI_NOK
+ * \sa     
+ */ 
+TI_STATUS busDrv_ConnectBus (TI_HANDLE        hBusDrv, 
+                             TBusDrvCfg       *pBusDrvCfg,
+                             TBusDrvTxnDoneCb fCbFunc,
+                             TI_HANDLE        hCbArg,
+                             TBusDrvTxnDoneCb fConnectCbFunc)
+{
+    TBusDrvObj *pBusDrv = (TBusDrvObj*)hBusDrv;
+    int         iStatus;
+
+    /* Save the parameters (TxnQ callback for TxnDone events, and block-size) */
+    pBusDrv->fTxnDoneCb    = fCbFunc;
+    pBusDrv->hCbHandle     = hCbArg;
+    pBusDrv->uBlkSizeShift = pBusDrvCfg->tSdioCfg.uBlkSizeShift;
+    pBusDrv->uBlkSize      = 1 << pBusDrv->uBlkSizeShift;
+    pBusDrv->uBlkSizeMask  = pBusDrv->uBlkSize - 1;
+    /* This should cover stop send Txn parts in recovery */
+    pBusDrv->uCurrTxnPartsCount = 0;
+    pBusDrv->uCurrTxnPartsNum = 0;
+
+	iStatus = wsdioAdapt_ConnectBus (pBusDrv->hWsdio, 
+									 /*pBusDrv->hWsdiobusDrv_TxnDoneCb,*/
+									 (TAny*)busDrv_TxnDoneCb,
+									 hBusDrv,
+									 pBusDrv->uBlkSizeShift,
+									 0);
+
+    /* Configure the SDIO driver parameters and handle SDIO enumeration */
+//    iStatus = sdioAdapt_ConnectBus (busDrv_TxnDoneCb, hBusDrv, pBusDrv->uBlkSizeShift);
+
+    if (iStatus == 0) 
+    {
+        return TI_OK;
+    }
+    else 
+    {
+        TRACE2(pBusDrv->hReport, REPORT_SEVERITY_ERROR, ": Status = 0x%x, BlkSize = %d\n", iStatus, pBusDrv->uBlkSize);
+        return TI_NOK;
+    }
+}
+
+
+/** 
+ * \fn     busDrv_DisconnectBus
+ * \brief  Disconnect SDIO driver
+ * 
+ * Called by TxnQ. Disconnect the SDIO driver.
+ *  
+ * \note   
+ * \param  hBusDrv - The module's object
+ * \return TI_OK / TI_NOK
+ * \sa     
+ */ 
+TI_STATUS busDrv_DisconnectBus (TI_HANDLE hBusDrv)
+{
+    TBusDrvObj *pBusDrv = (TBusDrvObj*)hBusDrv;
+
+    TRACE0(pBusDrv->hReport, REPORT_SEVERITY_INFORMATION, "\n");
+
+    /* Disconnect SDIO driver */
+    return wsdioAdapt_DisconnectBus (pBusDrv->hWsdio);
+}
+
+
+/** 
+ * \fn     busDrv_Transact
+ * \brief  Process transaction 
+ * 
+ * Called by the TxnQ module to initiate a new transaction.
+ * Prepare the transaction parts (lower layer single transactions),
+ *      and send them one by one to the lower layer.
+ * 
+ * \note   It's assumed that this function is called only when idle (i.e. previous Txn is done).
+ * \param  hBusDrv - The module's object
+ * \param  pTxn    - The transaction object 
+ * \return COMPLETE if Txn completed in this context, PENDING if not, ERROR if failed
+ * \sa     busDrv_PrepareTxnParts, busDrv_SendTxnParts
+ */ 
+ETxnStatus busDrv_Transact (TI_HANDLE hBusDrv, TTxnStruct *pTxn)
+{
+    TBusDrvObj *pBusDrv = (TBusDrvObj*)hBusDrv;
+
+    pBusDrv->pCurrTxn           = pTxn;
+    pBusDrv->uCurrTxnPartsCount = 0;
+    pBusDrv->eCurrTxnStatus     = TXN_STATUS_COMPLETE;  /* The Txn is Sync as long as it continues in this context */
+
+    /* Prepare the transaction parts in a table. */
+    busDrv_PrepareTxnParts (pBusDrv, pTxn);
+
+    /* Send the prepared transaction parts. */
+    busDrv_SendTxnParts (pBusDrv);
+
+    TRACE1(pBusDrv->hReport, REPORT_SEVERITY_INFORMATION, ": Status = %d\n", pBusDrv->eCurrTxnStatus);
+
+    /* return transaction status - COMPLETE, PENDING or ERROR */
+    return pBusDrv->eCurrTxnStatus;
+}
+
+
+/** 
+ * \fn     busDrv_PrepareTxnParts
+ * \brief  Prepare write or read transaction parts
+ * 
+ * Called by busDrv_Transact().
+ * Prepares the actual sequence of SDIO bus transactions in a table.
+ * 
+ * \note   
+ * \param  pBusDrv - The module's object
+ * \param  pTxn    - The transaction object 
+ * \return void
+ * \sa     busDrv_Transact, busDrv_SendTxnParts, 
+ */ 
+static void busDrv_PrepareTxnParts (TBusDrvObj *pBusDrv, TTxnStruct *pTxn)
+{
+    TI_UINT32 uBufNum;
+    TI_UINT32 uPartNum = 0;
+    TI_UINT32 uRemainderLen;
+    TI_UINT32 uCurrHwAddr = pTxn->uHwAddr;
+    TI_BOOL   bFixedHwAddr = TXN_PARAM_GET_FIXED_ADDR(pTxn);
+#ifndef  USE_BLOCK_MODE  
+    TI_UINT32 uLen;  
+#endif
+
+    /* For all occupied buffers in current transaction do */
+    for (uBufNum = 0; uBufNum < MAX_XFER_BUFS; uBufNum++) 
+    {
+        /* If no more buffers, exit the for loop */
+        if (pTxn->aLen[uBufNum] == 0)
+        {
+            break;
+        }
+
+        /* If current buffer has a remainder, prepare its transaction part */
+        uRemainderLen = pTxn->aLen[uBufNum] & pBusDrv->uBlkSizeMask;
+        if (uRemainderLen > 0)
+        {
+            pBusDrv->aTxnParts[uPartNum].bBlkMode  = TI_FALSE;
+            pBusDrv->aTxnParts[uPartNum].uLength   = uRemainderLen;
+            pBusDrv->aTxnParts[uPartNum].uHwAddr   = uCurrHwAddr;
+            pBusDrv->aTxnParts[uPartNum].pHostAddr = (void *)(pTxn->aBuf[uBufNum]);
+            pBusDrv->aTxnParts[uPartNum].bMore     = TI_TRUE;
+
+            /* If not fixed HW address, increment it by this part's size */
+            if (!bFixedHwAddr)
+            {
+                uCurrHwAddr += uRemainderLen;
+            }
+
+            uPartNum++;
+        }
+
+#ifdef  USE_BLOCK_MODE     /* Block Mode */
+
+        /* If current buffer has full SDIO blocks, prepare a block-mode transaction part */
+        if (pTxn->aLen[uBufNum] >= pBusDrv->uBlkSize)
+        {
+            pBusDrv->aTxnParts[uPartNum].bBlkMode  = TI_TRUE;
+            pBusDrv->aTxnParts[uPartNum].uLength   = pTxn->aLen[uBufNum] - uRemainderLen;
+            pBusDrv->aTxnParts[uPartNum].uHwAddr   = uCurrHwAddr;
+            pBusDrv->aTxnParts[uPartNum].pHostAddr = (void *)(pTxn->aBuf[uBufNum] + uRemainderLen);
+            pBusDrv->aTxnParts[uPartNum].bMore     = TI_TRUE;
+
+            /* If not fixed HW address, increment it by this part's size */
+            if (!bFixedHwAddr)
+            {
+                uCurrHwAddr += pTxn->aLen[uBufNum] - uRemainderLen;
+            }
+
+            uPartNum++;
+        }
+
+#else   
+
+		/* Split to blocks of block mode size only (512 bytes) */
+		for (uLen = uRemainderLen; uLen < pTxn->aLen[uBufNum]; uLen += pBusDrv->uBlkSize)
+		{
+			pBusDrv->aTxnParts[uPartNum].bBlkMode  = TI_FALSE;
+			pBusDrv->aTxnParts[uPartNum].uLength   = pBusDrv->uBlkSize;
+			pBusDrv->aTxnParts[uPartNum].uHwAddr   = uCurrHwAddr;
+			pBusDrv->aTxnParts[uPartNum].pHostAddr = (void *)(pTxn->aBuf[uBufNum] + uLen);
+			pBusDrv->aTxnParts[uPartNum].bMore     = TI_TRUE;
+
+			/* If not fixed HW address, increment it by this part's size */
+			if (!bFixedHwAddr)
+			{
+				uCurrHwAddr += pBusDrv->uBlkSize;
+			}
+
+			uPartNum++;
+		}
+
+#endif
+
+    }
+
+    /* Set last More flag as specified for the whole Txn */
+    pBusDrv->aTxnParts[uPartNum - 1].bMore = TXN_PARAM_GET_MORE(pTxn);
+    pBusDrv->uCurrTxnPartsNum = uPartNum;
+}
+
+
+/** 
+ * \fn     busDrv_SendTxnParts
+ * \brief  Send prepared transaction parts
+ * 
+ * Called first by busDrv_Transact(), and also from TxnDone CB after Async completion.
+ * Sends the prepared transaction parts in a loop.
+ * If a transaction part is Async, the loop continues later in the TxnDone ISR context.
+ * When all parts are done, the upper layer TxnDone CB is called.
+ * 
+ * \note   
+ * \param  pBusDrv - The module's object
+ * \return void
+ * \sa     busDrv_Transact, busDrv_PrepareTxnParts
+ */ 
+static void busDrv_SendTxnParts (TBusDrvObj *pBusDrv)
+{
+    ETxnStatus  eStatus;
+    TTxnPart   *pTxnPart;
+
+    /* While there are transaction parts to send */
+    while (pBusDrv->uCurrTxnPartsCount < pBusDrv->uCurrTxnPartsNum)
+    {
+        pTxnPart = &(pBusDrv->aTxnParts[pBusDrv->uCurrTxnPartsCount]);
+
+        /* If single step, send ELP byte */
+        if (TXN_PARAM_GET_SINGLE_STEP(pBusDrv->pCurrTxn)) 
+        {
+            /* Overwrite the function id with function 0 - for ELP register !!!! */
+            eStatus = wsdioAdapt_TransactBytes (pBusDrv->hWsdio,
+											   	TXN_FUNC_ID_CTRL,
+                                               pTxnPart->uHwAddr,
+                                               pTxnPart->pHostAddr,
+                                               pTxnPart->uLength,
+                                               TXN_PARAM_GET_DIRECTION(pBusDrv->pCurrTxn),
+                                               pTxnPart->bMore);
+        }
+        else
+        {
+            eStatus = wsdioAdapt_Transact (pBusDrv->hWsdio,
+										   TXN_PARAM_GET_FUNC_ID(pBusDrv->pCurrTxn),
+                                          pTxnPart->uHwAddr,
+                                          pTxnPart->pHostAddr,
+                                          pTxnPart->uLength,
+                                          TXN_PARAM_GET_DIRECTION(pBusDrv->pCurrTxn),
+                                          pTxnPart->bBlkMode,
+                                          ((TXN_PARAM_GET_FIXED_ADDR(pBusDrv->pCurrTxn)==1)?0:1),
+                                          pTxnPart->bMore);
+        }
+
+        TRACE7(pBusDrv->hReport, REPORT_SEVERITY_INFORMATION, ": PartNum = %d, SingleStep = %d, Direction = %d, HwAddr = 0x%x, HostAddr = 0x%x, Length = %d, BlkMode = %d\n", pBusDrv->uCurrTxnPartsCount, TXN_PARAM_GET_SINGLE_STEP(pBusDrv->pCurrTxn), TXN_PARAM_GET_DIRECTION(pBusDrv->pCurrTxn), pTxnPart->uHwAddr, pTxnPart->pHostAddr, pTxnPart->uLength, pTxnPart->bBlkMode);
+
+        /* Increment transaction parts counter */
+        pBusDrv->uCurrTxnPartsCount++;
+
+        /* If transaction is not fully Sync, continue it in next TxnDone interrupt */
+        if (eStatus == TXN_STATUS_PENDING)
+        {
+            pBusDrv->eCurrTxnStatus = TXN_STATUS_PENDING;   
+            return; 
+        }
+
+        /* If error, set error in Txn struct, call TxnDone CB if not fully sync, and exit */
+        if (eStatus == TXN_STATUS_ERROR)
+        {
+            TXN_PARAM_SET_STATUS(pBusDrv->pCurrTxn, TXN_PARAM_STATUS_ERROR);
+            if (pBusDrv->eCurrTxnStatus == TXN_STATUS_PENDING)
+            {
+                pBusDrv->fTxnDoneCb (pBusDrv->hCbHandle, pBusDrv->pCurrTxn);
+            }
+        	return;
+        }
+    }
+
+    /* If we got here we sent all buffers and we don't pend transaction end */
+    TRACE1(pBusDrv->hReport, REPORT_SEVERITY_INFORMATION, ": Txn finished successfully, Status = %d\n", pBusDrv->eCurrTxnStatus);
+
+    /* Set status OK in Txn struct, and call TxnDone CB if not fully sync */
+    TXN_PARAM_SET_STATUS(pBusDrv->pCurrTxn, TXN_PARAM_STATUS_OK);
+    if (pBusDrv->eCurrTxnStatus == TXN_STATUS_PENDING)
+    {
+        pBusDrv->fTxnDoneCb (pBusDrv->hCbHandle, pBusDrv->pCurrTxn);
+    }
+}
+
+
+/** 
+ * \fn     busDrv_TxnDoneCb
+ * \brief  Continue async transaction processing (CB)
+ * 
+ * Called back by the lower (BSP) bus-driver upon Async transaction completion (TxnDone ISR).
+ * Call busDrv_SendTxnParts to continue sending the remained transaction parts.
+ * 
+ * \note   
+ * \param  hBusDrv - The module's object
+ * \param  status  - The last transaction result - 0 = OK, else Error
+ * \return void
+ * \sa     busDrv_SendTxnParts
+ */ 
+static void busDrv_TxnDoneCb (TI_HANDLE hBusDrv, int iStatus)
+{
+    TBusDrvObj *pBusDrv = (TBusDrvObj*)hBusDrv;
+
+    /* If last transaction part failed, set error in Txn struct, call TxnDone CB and exit. */
+    if (iStatus != 0)
+    {
+        TRACE1(pBusDrv->hReport, REPORT_SEVERITY_ERROR, ": Status = 0x%x\n", iStatus);
+
+        TXN_PARAM_SET_STATUS(pBusDrv->pCurrTxn, TXN_PARAM_STATUS_ERROR);
+        pBusDrv->fTxnDoneCb (pBusDrv->hCbHandle, pBusDrv->pCurrTxn);
+        return;
+    }
+
+    TRACE0(pBusDrv->hReport, REPORT_SEVERITY_INFORMATION, "\n");
+
+    /* Continue sending the remained transaction parts. */
+    busDrv_SendTxnParts (pBusDrv);
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Txn/TxnDefs.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,84 @@
+/*
+ * TxnDefs.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   TxnDefs.h 
+ *  \brief  Common TXN definitions                                  
+ *
+ * These defintions are used also by the SDIO/SPI adapters, so they shouldn't
+ *     base on any non-standart types (e.g. use unsigned int and not TI_UINT32)
+ * 
+ *  \see    
+ */
+
+#ifndef __TXN_DEFS_API_H__
+#define __TXN_DEFS_API_H__
+
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+#define TXN_FUNC_ID_CTRL         0
+#define TXN_FUNC_ID_BT           1
+#define TXN_FUNC_ID_WLAN         2
+
+
+/************************************************************************
+ * Types
+ ************************************************************************/
+/* Transactions status (shouldn't override TI_OK and TI_NOK values) */
+/** \enum ETxnStatus
+ * \brief  Txn Transactions status
+ *
+ * \par Description
+ * Txn Transactions status - shouldn't override TI_OK and TI_NOK values
+ *
+ * \sa
+ */
+typedef enum
+{
+    TXN_STATUS_NONE = 2,	/**< */
+    TXN_STATUS_OK,         	/**< */
+    TXN_STATUS_COMPLETE,  	/**< */ 
+    TXN_STATUS_PENDING,    	/**< */
+    TXN_STATUS_ERROR     	/**< */
+
+} ETxnStatus;
+
+
+#endif /*__TXN_DEFS_API_H__*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Txn/TxnQueue.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,861 @@
+/*
+ * TxnQueue.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   TxnQueue.c 
+ *  \brief  The transaction-queue module. 
+ *
+ * The Transaction Queue encapsulates the bus access from a functional driver (WLAN, BT).
+ * This TI proprietary module presents the same interface and same behavior for different 
+ *     bus configuration: SDIO (multi or single function) or SPI and for different modes 
+ *     of operation: Synchronous, a-synchronous or combination of both. 
+ * It will also be used over the RS232 interface (using wUART protocol) which is applicable 
+ *     for RS applications (on PC).
+ * 
+ * The TxnQ module provides the following requirements:
+ *     Inter process protection on queue's internal database and synchronization between 
+ *         functional drivers that share the bus.
+ *     Support multiple queues per function, handled by priority. 
+ *     Support the TTxnStruct API (as the Bus Driver) with the ability to manage commands 
+ *         queuing of multiple functions on top of the Bus Driver. 
+ *     The TxnQ (as well as the layers above it) is agnostic to the bus driver used beneath it 
+ *         (SDIO, WSPI or wUART), since all bus drivers introduce the same API and hide bus details. 
+ *     The TxnQ has no OS dependencies. It supports access from multiple OS threads.
+ * Note: It is assumed that any transaction forwarded to the TxnQ has enough resources in HW. 
+ * 
+ *  \see    TxnQueue.h
+ */
+
+#define __FILE_ID__  FILE_ID_123
+#include "tidef.h"
+#include "report.h"
+#include "context.h"
+#include "osApi.h"
+#include "TxnDefs.h"
+#include "BusDrv.h"
+#include "TxnQueue.h"
+
+
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+#define MAX_FUNCTIONS       4   /* Maximum 4 functional drivers (including Func 0 which is for bus control) */
+#define MAX_PRIORITY        2   /* Maximum 2 prioritys per functional driver */
+#define TXN_QUE_SIZE        QUE_UNLIMITED_SIZE
+#define TXN_DONE_QUE_SIZE   QUE_UNLIMITED_SIZE
+
+
+/************************************************************************
+ * Types
+ ************************************************************************/
+
+/* Functional driver's SM States */
+typedef enum
+{
+    FUNC_STATE_NONE,              /* Function not registered */
+	FUNC_STATE_STOPPED,           /* Queues are stopped */
+	FUNC_STATE_RUNNING,           /* Queues are running */
+	FUNC_STATE_RESTART            /* Wait for current Txn to finish before restarting queues */
+} EFuncState;
+
+/* The functional drivers registered to TxnQ */
+typedef struct 
+{
+    EFuncState      eState;             /* Function crrent state */
+    TI_UINT32       uNumPrios;          /* Number of queues (priorities) for this function */
+	TTxnQueueDoneCb fTxnQueueDoneCb;    /* The CB called by the TxnQueue upon full transaction completion. */
+	TI_HANDLE       hCbHandle;          /* The callback handle */
+    TTxnStruct *    pSingleStep;        /* A single step transaction waiting to be sent */
+
+} TFuncInfo;
+
+
+/* The TxnQueue module Object */
+typedef struct _TTxnQObj
+{
+    TI_HANDLE	    hOs;		   	 
+    TI_HANDLE	    hReport;
+    TI_HANDLE	    hContext;
+	TI_HANDLE	    hBusDrv;
+
+    TFuncInfo       aFuncInfo[MAX_FUNCTIONS];  /* Registered functional drivers - see above */
+    TI_HANDLE       aTxnQueues[MAX_FUNCTIONS][MAX_PRIORITY];  /* Handle of the Transactions-Queue */
+    TI_HANDLE       hTxnDoneQueue;      /* Queue for completed transactions not reported to yet to the upper layer */
+    TTxnStruct *    pCurrTxn;           /* The transaction currently processed in the bus driver (NULL if none) */
+    TI_UINT32       uMinFuncId;         /* The minimal function ID actually registered (through txnQ_Open) */
+    TI_UINT32       uMaxFuncId;         /* The maximal function ID actually registered (through txnQ_Open) */
+    TI_BOOL         bSchedulerBusy;     /* If set, the scheduler is currently running so it shouldn't be reentered */
+    TI_BOOL         bSchedulerPend;     /* If set, a call to the scheduler was postponed because it was busy */
+    
+    /* Environment dependent: TRUE if needed and allowed to protect TxnDone in critical section */
+    TTxnDoneCb      fConnectCb;
+    TI_HANDLE       hConnectCb;
+
+#ifdef TI_DBG
+    TI_HANDLE       pAggregQueue;       /* While Tx aggregation in progress, saves its queue pointer to ensure continuity */
+#endif
+
+} TTxnQObj;
+
+
+/************************************************************************
+ * Internal functions prototypes
+ ************************************************************************/
+static void         txnQ_TxnDoneCb    (TI_HANDLE hTxnQ, void *hTxn);
+static ETxnStatus   txnQ_RunScheduler (TTxnQObj *pTxnQ, TTxnStruct *pInputTxn);
+static ETxnStatus   txnQ_Scheduler    (TTxnQObj *pTxnQ, TTxnStruct *pInputTxn);
+static TTxnStruct  *txnQ_SelectTxn    (TTxnQObj *pTxnQ);
+static void         txnQ_ConnectCB    (TI_HANDLE hTxnQ, void *hTxn);
+
+
+
+/************************************************************************
+ *
+ *   Module functions implementation
+ *
+ ************************************************************************/
+
+TI_HANDLE txnQ_Create (TI_HANDLE hOs)
+{
+    TI_HANDLE  hTxnQ;
+    TTxnQObj  *pTxnQ;
+    TI_UINT32  i;
+
+    hTxnQ = os_memoryAlloc(hOs, sizeof(TTxnQObj),MemoryNormal);
+    if (hTxnQ == NULL)
+        return NULL;
+    
+    pTxnQ = (TTxnQObj *)hTxnQ;
+
+    os_memoryZero(hOs, hTxnQ, sizeof(TTxnQObj));
+    
+    pTxnQ->hOs             = hOs;
+    pTxnQ->pCurrTxn        = NULL;
+    pTxnQ->uMinFuncId      = MAX_FUNCTIONS; /* Start at maximum and save minimal value in txnQ_Open */
+    pTxnQ->uMaxFuncId      = 0;             /* Start at minimum and save maximal value in txnQ_Open */
+#ifdef TI_DBG
+    pTxnQ->pAggregQueue    = NULL;
+#endif
+
+    for (i = 0; i < MAX_FUNCTIONS; i++)
+    {
+        pTxnQ->aFuncInfo[i].eState          = FUNC_STATE_NONE;
+        pTxnQ->aFuncInfo[i].uNumPrios       = 0;
+        pTxnQ->aFuncInfo[i].pSingleStep     = NULL;
+        pTxnQ->aFuncInfo[i].fTxnQueueDoneCb = NULL;
+        pTxnQ->aFuncInfo[i].hCbHandle       = NULL;
+    }
+    
+    /* Create the Bus-Driver module */
+    pTxnQ->hBusDrv = busDrv_Create (hOs);
+    if (pTxnQ->hBusDrv == NULL)
+    {
+        WLAN_OS_REPORT(("%s: Error - failed to create BusDrv\n", __FUNCTION__));
+        txnQ_Destroy (hTxnQ);
+        return NULL;
+    }
+
+    return pTxnQ;
+}
+
+TI_STATUS txnQ_Destroy (TI_HANDLE hTxnQ)
+{
+    TTxnQObj *pTxnQ = (TTxnQObj*)hTxnQ;
+
+    if (pTxnQ)
+    {
+        if (pTxnQ->hBusDrv) 
+        {
+            busDrv_Destroy (pTxnQ->hBusDrv);
+        }
+        if (pTxnQ->hTxnDoneQueue) 
+        {
+            que_Destroy (pTxnQ->hTxnDoneQueue);
+        }
+        os_memoryFree (pTxnQ->hOs, pTxnQ, sizeof(TTxnQObj));     
+    }
+    return TI_OK;
+}
+
+void txnQ_Init (TI_HANDLE hTxnQ, TI_HANDLE hOs, TI_HANDLE hReport, TI_HANDLE hContext)
+{
+    TTxnQObj  *pTxnQ = (TTxnQObj*)hTxnQ;
+    TI_UINT32  uNodeHeaderOffset;
+
+    pTxnQ->hOs             = hOs;
+    pTxnQ->hReport         = hReport;
+    pTxnQ->hContext        = hContext;
+
+    /* Create the TxnDone queue. */
+    uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode); 
+    pTxnQ->hTxnDoneQueue = que_Create (pTxnQ->hOs, pTxnQ->hReport, TXN_DONE_QUE_SIZE, uNodeHeaderOffset);
+    if (pTxnQ->hTxnDoneQueue == NULL)
+    {
+        TRACE0(pTxnQ->hReport, REPORT_SEVERITY_ERROR, ": TxnDone queue creation failed!\n");
+    }
+
+    busDrv_Init (pTxnQ->hBusDrv, hReport);
+}
+
+TI_STATUS txnQ_ConnectBus (TI_HANDLE  hTxnQ, 
+                           TBusDrvCfg *pBusDrvCfg, 
+                           TTxnDoneCb fConnectCb, 
+                           TI_HANDLE  hConnectCb, 
+                           TI_UINT32  *pRxDmaBufLen,
+                           TI_UINT32  *pTxDmaBufLen)
+{
+    TTxnQObj *pTxnQ = (TTxnQObj*) hTxnQ;
+
+    TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_ConnectBus()\n");
+
+    pTxnQ->fConnectCb = fConnectCb;
+    pTxnQ->hConnectCb = hConnectCb;
+
+    return busDrv_ConnectBus (pTxnQ->hBusDrv, pBusDrvCfg, txnQ_TxnDoneCb, hTxnQ, txnQ_ConnectCB);
+}
+
+TI_STATUS txnQ_DisconnectBus (TI_HANDLE hTxnQ)
+{
+    TTxnQObj *pTxnQ = (TTxnQObj*) hTxnQ;
+
+    return busDrv_DisconnectBus (pTxnQ->hBusDrv);
+}
+
+TI_STATUS txnQ_Open (TI_HANDLE       hTxnQ, 
+                     TI_UINT32       uFuncId, 
+                     TI_UINT32       uNumPrios, 
+                     TTxnQueueDoneCb fTxnQueueDoneCb,
+                     TI_HANDLE       hCbHandle)
+{
+    TTxnQObj     *pTxnQ = (TTxnQObj*) hTxnQ;
+    TI_UINT32     uNodeHeaderOffset;
+    TI_UINT32     i;
+
+    if (uFuncId >= MAX_FUNCTIONS  ||  uNumPrios > MAX_PRIORITY) 
+    {
+        TRACE2(pTxnQ->hReport, REPORT_SEVERITY_ERROR, ": Invalid Params!  uFuncId = %d, uNumPrios = %d\n", uFuncId, uNumPrios);
+        return TI_NOK;
+    }
+
+    CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+
+    /* Save functional driver info */
+    pTxnQ->aFuncInfo[uFuncId].uNumPrios       = uNumPrios;
+    pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb = fTxnQueueDoneCb;
+    pTxnQ->aFuncInfo[uFuncId].hCbHandle       = hCbHandle;
+    pTxnQ->aFuncInfo[uFuncId].eState          = FUNC_STATE_STOPPED;
+    
+    /* Create the functional driver's queues. */
+    uNodeHeaderOffset = TI_FIELD_OFFSET(TTxnStruct, tTxnQNode); 
+    for (i = 0; i < uNumPrios; i++)
+    {
+        pTxnQ->aTxnQueues[uFuncId][i] = que_Create (pTxnQ->hOs, pTxnQ->hReport, TXN_QUE_SIZE, uNodeHeaderOffset);
+        if (pTxnQ->aTxnQueues[uFuncId][i] == NULL)
+        {
+            TRACE0(pTxnQ->hReport, REPORT_SEVERITY_ERROR, ": Queues creation failed!\n");
+            CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+            return TI_NOK;
+        }
+    }
+
+    /* Update functions actual range (to optimize Txn selection loops - see txnQ_SelectTxn) */
+    if (uFuncId < pTxnQ->uMinFuncId) 
+    {
+        pTxnQ->uMinFuncId = uFuncId;
+    }
+    if (uFuncId > pTxnQ->uMaxFuncId) 
+    {
+        pTxnQ->uMaxFuncId = uFuncId;
+    }
+
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+
+    TRACE2(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, ": Function %d registered successfully, uNumPrios = %d\n", uFuncId, uNumPrios);
+
+    return TI_OK;
+}
+
+void txnQ_Close (TI_HANDLE  hTxnQ, TI_UINT32 uFuncId)
+{
+    TTxnQObj     *pTxnQ = (TTxnQObj*)hTxnQ;
+    TI_UINT32     i;
+
+    CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+
+    /* Destroy the functional driver's queues */
+    for (i = 0; i < pTxnQ->aFuncInfo[uFuncId].uNumPrios; i++)
+    {
+        que_Destroy (pTxnQ->aTxnQueues[uFuncId][i]);
+    }
+
+    /* Clear functional driver info */
+    pTxnQ->aFuncInfo[uFuncId].uNumPrios       = 0;
+    pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb = NULL;
+    pTxnQ->aFuncInfo[uFuncId].hCbHandle       = NULL;
+    pTxnQ->aFuncInfo[uFuncId].eState          = FUNC_STATE_NONE;
+    
+    /* Update functions actual range (to optimize Txn selection loops - see txnQ_SelectTxn) */
+    pTxnQ->uMinFuncId      = MAX_FUNCTIONS; 
+    pTxnQ->uMaxFuncId      = 0;             
+    for (i = 0; i < MAX_FUNCTIONS; i++) 
+    {
+        if (pTxnQ->aFuncInfo[i].eState != FUNC_STATE_NONE) 
+        {
+            if (i < pTxnQ->uMinFuncId) 
+            {
+                pTxnQ->uMinFuncId = i;
+            }
+            if (i > pTxnQ->uMaxFuncId) 
+            {
+                pTxnQ->uMaxFuncId = i;
+            }
+        }
+    }
+
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+
+    TRACE1(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, ": Function %d Unregistered\n", uFuncId);
+}
+
+ETxnStatus txnQ_Restart (TI_HANDLE hTxnQ, TI_UINT32 uFuncId)
+{
+    TTxnQObj *pTxnQ = (TTxnQObj*) hTxnQ;
+
+    TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Restart()\n");
+
+    CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+
+    /* If a Txn from the calling function is in progress, set state to RESTART return PENDING */
+    if (pTxnQ->pCurrTxn) 
+    {
+        if (TXN_PARAM_GET_FUNC_ID(pTxnQ->pCurrTxn) == uFuncId)
+        {
+            pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_RESTART;
+
+            CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+
+            TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Restart(): pCurrTxn pending\n");
+
+            /* Return PENDING to indicate that the restart will be completed later (in TxnDone) */
+            return TXN_STATUS_PENDING;
+        }
+    }
+
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+
+    /* Clear the calling function's queues (call function CB with status=RECOVERY) */
+    txnQ_ClearQueues (hTxnQ, uFuncId);
+
+    /* Return COMPLETE to indicate that the restart was completed */
+    return TXN_STATUS_COMPLETE;
+}
+
+void txnQ_Run (TI_HANDLE hTxnQ, TI_UINT32 uFuncId)
+{
+    TTxnQObj *pTxnQ = (TTxnQObj*) hTxnQ;
+
+#ifdef TI_DBG
+    TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Run()\n");
+    if (pTxnQ->aFuncInfo[uFuncId].eState != FUNC_STATE_STOPPED) 
+    {
+        TRACE2(pTxnQ->hReport, REPORT_SEVERITY_WARNING, "txnQ_Run(): Called while func %d state is %d!\n", uFuncId, pTxnQ->aFuncInfo[uFuncId].eState);
+    }
+#endif
+
+    /* Enable function's queues */
+    pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_RUNNING;
+
+    /* Send queued transactions as possible */
+    txnQ_RunScheduler (pTxnQ, NULL); 
+}
+
+void txnQ_Stop (TI_HANDLE hTxnQ, TI_UINT32 uFuncId)
+{
+    TTxnQObj *pTxnQ = (TTxnQObj*) hTxnQ;
+
+#ifdef TI_DBG
+    TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Stop()\n");
+    if (pTxnQ->aFuncInfo[uFuncId].eState != FUNC_STATE_RUNNING) 
+    {
+        TRACE2(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_Stop(): Called while func %d state is %d!\n", uFuncId, pTxnQ->aFuncInfo[uFuncId].eState);
+    }
+#endif
+
+    /* Enable function's queues */
+    pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_STOPPED;
+}
+
+ETxnStatus txnQ_Transact (TI_HANDLE hTxnQ, TTxnStruct *pTxn)
+{
+    TTxnQObj    *pTxnQ   = (TTxnQObj*)hTxnQ;
+    TI_UINT32    uFuncId = TXN_PARAM_GET_FUNC_ID(pTxn);
+    ETxnStatus   rc;
+
+    if (TXN_PARAM_GET_SINGLE_STEP(pTxn)) 
+    {
+        pTxnQ->aFuncInfo[uFuncId].pSingleStep = pTxn;
+        TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Transact(): Single step Txn\n");
+    }
+    else 
+    {
+        TI_STATUS eStatus;
+        TI_HANDLE hQueue = pTxnQ->aTxnQueues[uFuncId][TXN_PARAM_GET_PRIORITY(pTxn)];
+        CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+        eStatus = que_Enqueue (hQueue, (TI_HANDLE)pTxn);
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+        if (eStatus != TI_OK)
+        {
+            TRACE3(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_Transact(): Enqueue failed, pTxn=0x%x, HwAddr=0x%x, Len0=%d\n", pTxn, pTxn->uHwAddr, pTxn->aLen[0]);
+            return TXN_STATUS_ERROR;
+        }
+        TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Transact(): Regular Txn\n");
+    }
+
+    /* Send queued transactions as possible */
+    rc = txnQ_RunScheduler (pTxnQ, pTxn); 
+
+    return rc;
+}
+
+
+/** 
+ * \fn     txnQ_ConnectCB
+ * \brief  Pending Connection completion CB
+ * 
+ *  txnQ_ConnectBus CB
+ * 
+ * \note   
+ * \param  hTxnQ - The module's object
+ * \param  pTxn  - The completed transaction object 
+ * \return void
+ * \sa     
+ */ 
+static void txnQ_ConnectCB (TI_HANDLE hTxnQ, void *hTxn)
+{
+    TTxnQObj   *pTxnQ   = (TTxnQObj*)hTxnQ;
+
+    /* Call the Client Connect CB */
+    pTxnQ->fConnectCb (pTxnQ->hConnectCb, NULL);
+}
+
+
+/** 
+ * \fn     txnQ_TxnDoneCb
+ * \brief  Pending Transaction completion CB
+ * 
+ * Called back by bus-driver upon pending transaction completion in TxnDone context (external!).
+ * Enqueue completed transaction in TxnDone queue and call scheduler to send queued transactions.
+ * 
+ * \note   
+ * \param  hTxnQ - The module's object
+ * \param  pTxn  - The completed transaction object 
+ * \return void
+ * \sa     
+ */ 
+static void txnQ_TxnDoneCb (TI_HANDLE hTxnQ, void *hTxn)
+{
+    TTxnQObj   *pTxnQ   = (TTxnQObj*)hTxnQ;
+    TTxnStruct *pTxn    = (TTxnStruct *)hTxn;
+    TI_UINT32   uFuncId = TXN_PARAM_GET_FUNC_ID(pTxn);
+
+#ifdef TI_DBG
+    TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_TxnDoneCb()\n");
+    if (pTxn != pTxnQ->pCurrTxn) 
+    {
+        TRACE2(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_TxnDoneCb(): CB returned pTxn 0x%x  while pCurrTxn is 0x%x !!\n", pTxn, pTxnQ->pCurrTxn);
+    }
+#endif
+
+    /* If the function of the completed Txn is waiting for restart */
+    if (pTxnQ->aFuncInfo[uFuncId].eState == FUNC_STATE_RESTART) 
+    {
+        TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_TxnDoneCb(): Handling restart\n");
+
+        /* First, Clear the restarted function queues  */
+        txnQ_ClearQueues (hTxnQ, uFuncId);
+
+        /* Call function CB for current Txn with restart indication */
+        TXN_PARAM_SET_STATUS(pTxn, TXN_PARAM_STATUS_RECOVERY);
+        pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb (pTxnQ->aFuncInfo[uFuncId].hCbHandle, pTxn);
+    }
+
+    /* In the normal case (no restart), enqueue completed transaction in TxnDone queue */
+    else 
+    {
+        TI_STATUS eStatus;
+
+        CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+        eStatus = que_Enqueue (pTxnQ->hTxnDoneQueue, (TI_HANDLE)pTxn);
+        if (eStatus != TI_OK)
+        {
+            TRACE3(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_TxnDoneCb(): Enqueue failed, pTxn=0x%x, HwAddr=0x%x, Len0=%d\n", pTxn, pTxn->uHwAddr, pTxn->aLen[0]);
+        }
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+    }
+
+    /* Indicate that no transaction is currently processed in the bus-driver */
+    pTxnQ->pCurrTxn = NULL;
+
+    /* Send queued transactions as possible (TRUE indicates we are in external context) */
+    txnQ_RunScheduler (pTxnQ, NULL); 
+}
+
+
+/** 
+ * \fn     txnQ_RunScheduler
+ * \brief  Send queued transactions
+ * 
+ * Run the scheduler, which issues transactions as long as possible.
+ * Since this function is called from either internal or external (TxnDone) context,
+ *   it handles reentry by setting a bSchedulerPend flag, and running the scheduler again
+ *   when its current iteration is finished.
+ * 
+ * \note   
+ * \param  pTxnQ            - The module's object
+ * \param  pInputTxn - The transaction inserted in the current context (NULL if none)
+ * \return COMPLETE if pCurrTxn completed in this context, PENDING if not, ERROR if failed
+ * \sa     
+ */ 
+static ETxnStatus txnQ_RunScheduler (TTxnQObj *pTxnQ, TTxnStruct *pInputTxn)
+{
+    TI_BOOL bFirstIteration;  
+	ETxnStatus eStatus = TXN_STATUS_NONE;
+
+    TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_RunScheduler()\n");
+
+    CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+
+    /* If the scheduler is currently busy, set bSchedulerPend flag and exit */
+    if (pTxnQ->bSchedulerBusy)
+    {
+        TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_RunScheduler(): Scheduler is busy\n");
+        pTxnQ->bSchedulerPend = TI_TRUE;
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+        return TXN_STATUS_PENDING;
+    }
+
+    /* Indicate that the scheduler is currently busy */
+    pTxnQ->bSchedulerBusy = TI_TRUE;
+
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+
+    bFirstIteration = TI_TRUE;  
+
+    /* 
+     * Run the scheduler while it has work to do 
+     */
+    while (1)
+    {
+        /* If first scheduler iteration, save its return code to return the original Txn result */
+        if (bFirstIteration) 
+        {
+            eStatus = txnQ_Scheduler (pTxnQ, pInputTxn);
+            bFirstIteration = TI_FALSE;
+        }
+        /* This is for handling pending calls when the scheduler was busy (see above) */
+        else 
+        {    
+            TRACE0(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_RunScheduler(): Handle pending scheduler call\n");
+            txnQ_Scheduler (pTxnQ, NULL);
+        }
+
+        CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+
+        /* If no pending calls, clear the busy flag and return the original caller Txn status */
+        if (!pTxnQ->bSchedulerPend) 
+        {
+            pTxnQ->bSchedulerBusy = TI_FALSE;
+            CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+            return eStatus;
+        }
+        pTxnQ->bSchedulerPend = TI_FALSE;
+
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+    }
+}
+
+
+/** 
+ * \fn     txnQ_Scheduler
+ * \brief  Send queued transactions
+ * 
+ * Issue transactions as long as they are available and the bus is not occupied.
+ * Call CBs of completed transactions, except completion of pInputTxn (covered by the return value).
+ * Note that this function is called from either internal or external (TxnDone) context.
+ * However, the txnQ_RunScheduler which calls it, prevents scheduler reentry.
+ * 
+ * \note   
+ * \param  pTxnQ     - The module's object
+ * \param  pInputTxn - The transaction inserted in the current context (NULL if none)
+ * \return COMPLETE if pInputTxn completed in this context, PENDING if not, ERROR if failed
+ * \sa     txnQ_RunScheduler
+ */ 
+static ETxnStatus txnQ_Scheduler (TTxnQObj *pTxnQ, TTxnStruct *pInputTxn)
+{
+    ETxnStatus eInputTxnStatus;  
+
+    /* Use as return value the status of the input transaction (PENDING unless sent and completed here) */
+    eInputTxnStatus = TXN_STATUS_PENDING;  
+
+    /* if a previous transaction is in progress, return PENDING */
+    if (pTxnQ->pCurrTxn)
+    {
+        TRACE1(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Scheduler(): pCurrTxn isn't null (0x%x) so exit\n", pTxnQ->pCurrTxn);
+        return TXN_STATUS_PENDING;
+    }
+
+    /* Loop while transactions are available and can be sent to bus driver */
+    while (1)
+    {
+        TTxnStruct   *pSelectedTxn;
+        ETxnStatus    eStatus;
+
+        /* Get next enabled transaction by priority. If none, exit loop. */
+        CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+        pSelectedTxn = txnQ_SelectTxn (pTxnQ);
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+        if (pSelectedTxn == NULL)
+        {
+            break;
+        }
+
+        /* Save transaction in case it will be async (to indicate that the bus driver is busy) */
+        pTxnQ->pCurrTxn = pSelectedTxn;
+
+        /* Send selected transaction to bus driver */
+        eStatus = busDrv_Transact (pTxnQ->hBusDrv, pSelectedTxn);
+
+        /* If we've just sent the input transaction, use the status as the return value */
+        if (pSelectedTxn == pInputTxn)
+        {
+            eInputTxnStatus = eStatus;
+        }
+
+        TRACE3(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Scheduler(): Txn 0x%x sent, status = %d, eInputTxnStatus = %d\n", pSelectedTxn, eStatus, eInputTxnStatus);
+
+        /* If transaction completed */
+        if (eStatus != TXN_STATUS_PENDING)
+        {
+            pTxnQ->pCurrTxn = NULL;
+
+            /* If it's not the input transaction, enqueue it in TxnDone queue */
+            if (pSelectedTxn != pInputTxn)
+            {
+                TI_STATUS eStatus;
+
+                CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+                eStatus = que_Enqueue (pTxnQ->hTxnDoneQueue, (TI_HANDLE)pSelectedTxn);
+                if (eStatus != TI_OK)
+                {
+                    TRACE3(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_Scheduler(): Enqueue failed, pTxn=0x%x, HwAddr=0x%x, Len0=%d\n", pSelectedTxn, pSelectedTxn->uHwAddr, pSelectedTxn->aLen[0]);
+                }
+                CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+            }
+        }
+
+        /* If pending Exit loop! */
+        else 
+        {
+            break;
+        }
+    }
+
+    /* Dequeue completed transactions and call their functional driver CB */
+    /* Note that it's the functional driver CB and not the specific CB in the Txn! */
+    while (1)
+    {
+        TTxnStruct      *pCompletedTxn;
+        TI_UINT32        uFuncId;
+        TTxnQueueDoneCb  fTxnQueueDoneCb;
+        TI_HANDLE        hCbHandle;
+
+        CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+        pCompletedTxn   = (TTxnStruct *) que_Dequeue (pTxnQ->hTxnDoneQueue);
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+        if (pCompletedTxn == NULL)
+        {
+            /* Return the status of the input transaction (PENDING unless sent and completed here) */
+            return eInputTxnStatus;
+        }
+
+        TRACE1(pTxnQ->hReport, REPORT_SEVERITY_INFORMATION, "txnQ_Scheduler(): Calling TxnDone for Txn 0x%x\n", pCompletedTxn);
+
+        uFuncId         = TXN_PARAM_GET_FUNC_ID(pCompletedTxn);
+        fTxnQueueDoneCb = pTxnQ->aFuncInfo[uFuncId].fTxnQueueDoneCb;
+        hCbHandle       = pTxnQ->aFuncInfo[uFuncId].hCbHandle;
+
+        fTxnQueueDoneCb (hCbHandle, pCompletedTxn);
+    }
+}
+
+
+/** 
+ * \fn     txnQ_SelectTxn
+ * \brief  Select transaction to send
+ * 
+ * Called from txnQ_RunScheduler() which is protected in critical section.
+ * Select the next enabled transaction by priority.
+ * 
+ * \note   
+ * \param  pTxnQ - The module's object
+ * \return The selected transaction to send (NULL if none available)
+ * \sa     
+ */ 
+static TTxnStruct *txnQ_SelectTxn (TTxnQObj *pTxnQ)
+{
+    TTxnStruct *pSelectedTxn;
+    TI_UINT32   uFunc;
+    TI_UINT32   uPrio;
+
+#ifdef TI_DBG
+    /* If within Tx aggregation, dequeue Txn from same queue, and if not NULL return it */
+    if (pTxnQ->pAggregQueue)
+    {
+        pSelectedTxn = (TTxnStruct *) que_Dequeue (pTxnQ->pAggregQueue);
+        if (pSelectedTxn != NULL)
+        {
+            /* If aggregation ended, reset the aggregation-queue pointer */
+            if (TXN_PARAM_GET_AGGREGATE(pSelectedTxn) == TXN_AGGREGATE_OFF) 
+            {
+                if ((TXN_PARAM_GET_FIXED_ADDR(pSelectedTxn) != TXN_FIXED_ADDR) ||
+                    (TXN_PARAM_GET_DIRECTION(pSelectedTxn)  != TXN_DIRECTION_WRITE))
+                {
+                    TRACE2(pTxnQ->hReport, REPORT_SEVERITY_ERROR, "txnQ_SelectTxn: Mixed transaction during aggregation, HwAddr=0x%x, TxnParams=0x%x\n", pSelectedTxn->uHwAddr, pSelectedTxn->uTxnParams);
+                }
+                pTxnQ->pAggregQueue = NULL;
+            }
+            return pSelectedTxn;
+        }
+        return NULL;
+    }
+#endif
+
+    /* For all functions, if single-step Txn waiting, return it (sent even if function is stopped) */
+    for (uFunc = pTxnQ->uMinFuncId; uFunc <= pTxnQ->uMaxFuncId; uFunc++)
+    {
+        pSelectedTxn = pTxnQ->aFuncInfo[uFunc].pSingleStep;
+        if (pSelectedTxn != NULL)
+        {
+            pTxnQ->aFuncInfo[uFunc].pSingleStep = NULL;
+            return pSelectedTxn;
+        }
+    }
+
+    /* For all priorities from high to low */
+    for (uPrio = 0; uPrio < MAX_PRIORITY; uPrio++)
+    {
+        /* For all functions */
+        for (uFunc = pTxnQ->uMinFuncId; uFunc <= pTxnQ->uMaxFuncId; uFunc++)
+        {
+            /* If function running and uses this priority */
+            if (pTxnQ->aFuncInfo[uFunc].eState == FUNC_STATE_RUNNING  &&
+                pTxnQ->aFuncInfo[uFunc].uNumPrios > uPrio)
+            {
+                /* Dequeue Txn from current func and priority queue, and if not NULL return it */
+                pSelectedTxn = (TTxnStruct *) que_Dequeue (pTxnQ->aTxnQueues[uFunc][uPrio]);
+                if (pSelectedTxn != NULL)
+                {
+#ifdef TI_DBG
+                    /* If aggregation begins, save the aggregation-queue pointer to ensure continuity */
+                    if (TXN_PARAM_GET_AGGREGATE(pSelectedTxn) == TXN_AGGREGATE_ON) 
+                    {
+                        pTxnQ->pAggregQueue = pTxnQ->aTxnQueues[uFunc][uPrio];
+                    }
+#endif
+                    return pSelectedTxn;
+                }
+            }
+        }
+    }
+
+    /* If no transaction was selected, return NULL */
+    return NULL;
+}
+
+
+void txnQ_ClearQueues (TI_HANDLE hTxnQ, TI_UINT32 uFuncId)
+{
+    TTxnQObj        *pTxnQ = (TTxnQObj*)hTxnQ;
+    TTxnStruct      *pTxn;
+    TI_UINT32        uPrio;
+
+    CONTEXT_ENTER_CRITICAL_SECTION (pTxnQ->hContext);
+
+    pTxnQ->aFuncInfo[uFuncId].pSingleStep = NULL;
+
+    /* For all function priorities */
+    for (uPrio = 0; uPrio < pTxnQ->aFuncInfo[uFuncId].uNumPrios; uPrio++)
+    {
+        while (1) 
+        {
+            /* Dequeue Txn from current priority queue */
+            pTxn = (TTxnStruct *) que_Dequeue (pTxnQ->aTxnQueues[uFuncId][uPrio]);
+
+            /* If NULL Txn (queue empty), exit while loop */
+            if (pTxn == NULL)
+            {
+                break;
+            }
+
+            /* 
+             * Drop on Restart 
+             * do not call fTxnQueueDoneCb (hCbHandle, pTxn) callback 
+             */
+        }
+    }
+
+    /* Clear state - for restart (doesn't call txnQ_Open) */
+    pTxnQ->aFuncInfo[uFuncId].eState = FUNC_STATE_RUNNING;
+
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTxnQ->hContext);
+}
+
+#ifdef TI_DBG
+void txnQ_PrintQueues (TI_HANDLE hTxnQ)
+{
+    TTxnQObj    *pTxnQ   = (TTxnQObj*)hTxnQ;
+
+    WLAN_OS_REPORT(("Print TXN queues\n"));
+    WLAN_OS_REPORT(("================\n"));
+    que_Print(pTxnQ->aTxnQueues[TXN_FUNC_ID_WLAN][TXN_LOW_PRIORITY]);
+    que_Print(pTxnQ->aTxnQueues[TXN_FUNC_ID_WLAN][TXN_HIGH_PRIORITY]);
+}
+#endif /* TI_DBG */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Txn/TxnQueue.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,278 @@
+/*
+ * TxnQueue.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   TxnQueue.h 
+ *  \brief  TxnQueue module API definition                                  
+ *
+ *  \see    TxnQueue.c
+ */
+
+#ifndef __TXN_QUEUE_API_H__
+#define __TXN_QUEUE_API_H__
+
+
+#include "TxnDefs.h"
+#include "BusDrv.h"
+
+
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+
+
+/************************************************************************
+ * Macros
+ ************************************************************************/
+
+
+/************************************************************************
+ * Types
+ ************************************************************************/
+
+
+/************************************************************************
+ * Functions
+ ************************************************************************/
+/** \brief	Create the TxnQ module
+ * 
+ * \param  hOs - Handle to Os Abstraction Layer
+ * \return Handle of the allocated object, NULL if allocation failed 
+ * 
+ * \par Description
+ * Allocate and clear the module's object
+ *
+ * \sa	txnQ_Destroy
+ */ 
+TI_HANDLE   txnQ_Create (TI_HANDLE hOs);
+
+/** \brief	Destroy the module
+ * 
+ * \param  The module's object
+ * \return TI_OK on success or TI_NOK on failure 
+ * 
+ * \par Description
+ * Destroy bus driver and free the module's object
+ *
+ * \sa	txnQ_Create
+ */ 
+TI_STATUS   txnQ_Destroy (TI_HANDLE hTxnQ);
+
+/** \brief	Init module
+ * 
+ * \param  hTxnQ     - The module's object
+ * \param  hOs       - Handle to Os Abstraction Layer
+ * \param  hReport   - Handle to report module
+ * \param  hContext  - Handle to context module
+ * \return void        
+ * 
+ * \par Description
+ *
+ * \sa
+ */ 
+void        txnQ_Init (TI_HANDLE hTxnQ, 
+					   TI_HANDLE hOs, 
+					   TI_HANDLE hReport, 
+					   TI_HANDLE hContext);
+
+/** \brief	Configure bus driver
+ * 
+ * \param  hTxnQ      - The module's object
+ * \param  pBusDrvCfg - A union used for per-bus specific configuration. 
+ * \param  pRxDmaBufLen - The Rx DMA buffer length in bytes (needed as a limit of the Rx aggregation length)
+ * \param  pTxDmaBufLen - The Tx DMA buffer length in bytes (needed as a limit of the Tx aggregation length)
+ * \return TI_OK / TI_NOK
+ * 
+ * \par Description
+ * Called by DrvMain (future - by Chip-Manager).
+ * Configure the bus driver with its connection configuration (such as baud-rate, bus width etc) 
+ * and establish the physical connection. Done once (and not per functional driver startup). 
+ * 
+ * \sa
+ */ 
+TI_STATUS   txnQ_ConnectBus (TI_HANDLE hTxnQ, 
+							 TBusDrvCfg *pBusDrvCfg,
+							 TTxnDoneCb fConnectCb,
+							 TI_HANDLE  hConnectCb, 
+                             TI_UINT32  *pRxDmaBufLen,
+                             TI_UINT32  *pTxDmaBufLen);
+
+/** \brief	Disconnect bus driver
+ * 
+ * \param  hTxnQ      - The module's object
+ * \return TI_OK / TI_NOK
+ * 
+ * \par Description
+ * Called by DrvMain (future - by Chip-Manager).
+ * Disconnect the bus driver.
+ * 
+ * \sa
+ */ 
+TI_STATUS   txnQ_DisconnectBus (TI_HANDLE hTxnQ);
+
+/** \brief	Register functional driver to TxnQ
+ * 
+ * \param  hTxnQ           - The module's object
+ * \param  uFuncId         - The calling functional driver
+ * \param  uNumPrios       - The number of queues/priorities
+ * \param  fTxnQueueDoneCb - The callback to call upon full transaction completion.
+ * \param  hCbHandle       - The callback handle                              
+ * \return TI_OK / TI_NOK
+ * 
+ * \par Description
+ * Called by each functional driver (WLAN, future-BT) that uses the TxnQ.
+ * Save driver's info and create its queues. 
+ * Perform in critical section to prevent preemption from TxnDone.
+ * 
+ * \sa	txnQ_Close
+ */ 
+TI_STATUS   txnQ_Open (TI_HANDLE       hTxnQ, 
+                       TI_UINT32       uFuncId, 
+                       TI_UINT32       uNumPrios, 
+                       TTxnQueueDoneCb fTxnQueueDoneCb,
+                       TI_HANDLE       hCbHandle);
+
+/** \brief	Unregister functional driver from TxnQ
+ * 
+ * \param  hTxnQ      - The module's object
+ * \param  uFuncId    - The calling functional driver
+ * \return void
+ * \sa     txnQ_Open
+ * 
+ * \par Description
+ * Called by registered functional driver that uses the TxnQ to unregister.
+ * Clear the function's data and destroy its queues. 
+ * Perform in critical section to prevent preemption from TxnDone.
+ * 
+ * \sa	txnQ_Open
+ */ 
+void        txnQ_Close (TI_HANDLE  hTxnQ, TI_UINT32 uFuncId);
+
+/** \brief	Restart caller's queues
+ * 
+ * \param  hTxnQ      - The module's object
+ * \param  uFuncId    - The calling functional driver
+ * \return COMPLETE if queues were restarted, PENDING if waiting for TxnDone to restart queues
+ * 
+ * \par Description
+ * Called upon functional driver stop command or upon recovery. 
+ * If no transaction in progress for the calling function, clear its queues (call the CBs). 
+ * If a transaction from this function is in progress, just set state to RESTART and when 
+ * called back upon TxnDone clear the queues.
+ * Perform in critical section to prevent preemption from TxnDone.
+ * \note   
+ * The Restart applies only to the calling function's queues.
+ * 
+ * \sa	txnQ_ClearQueues
+ */ 
+ETxnStatus  txnQ_Restart (TI_HANDLE hTxnQ, TI_UINT32 uFuncId);
+
+/** \brief	Run caller's queues
+ * 
+ * \param  hTxnQ   - The module's object
+ * \param  uFuncId - The calling functional driver
+ * \return void
+ * 
+ * \par Description
+ * Enable TxnQ scheduler to process transactions from the calling function's queues.
+ * Run scheduler to issue transactions as possible.
+ * Run in critical section to protect from preemption by TxnDone.
+ * 
+ * \sa	txnQ_ClearQueues
+ */ 
+void        txnQ_Run (TI_HANDLE hTxnQ, TI_UINT32 uFuncId);
+
+/** \brief	Stop caller's queues
+ * 
+ * \param  hTxnQ   - The module's object
+ * \param  uFuncId - The calling functional driver
+ * \return void
+ * 
+ * \par Description
+ * Disable TxnQ scheduler to process transactions from the calling function's queues.
+ * 
+ * \sa
+ */ 
+void        txnQ_Stop (TI_HANDLE hTxnQ, TI_UINT32 uFuncId);
+
+/** \brief	Issue a new transaction
+ * 
+ * \param  hTxnQ - The module's object
+ * \param  pTxn  - The transaction object 
+ * \return COMPLETE if input pTxn completed in this context, PENDING if not, ERROR if failed
+ * 
+ * \par Description
+ * Called by the functional driver to initiate a new transaction.
+ * In critical section save transaction and call scheduler.
+ * 
+ * \sa
+ */ 
+ETxnStatus  txnQ_Transact (TI_HANDLE hTxnQ, TTxnStruct *pTxn);
+
+/** 
+ * \fn     txnQ_ClearQueues
+ * \brief  Clear the function queues
+ * 
+ * Clear the specified function queues and call its CB for each Txn with status=RECOVERY.
+ * 
+ * \note   Called in critical section.
+ * \param  hTxnQ            - The module's object
+ * \param  uFuncId          - The calling functional driver
+ * \return void
+ * \sa     
+ */ 
+void        txnQ_ClearQueues (TI_HANDLE hTxnQ, TI_UINT32 uFuncId);
+
+
+#ifdef TI_DBG
+/** \brief	Print Txn Queues
+ * 
+ * \param  hTxnQ - The module's object
+ * \return void
+ * 
+ * \par Description
+ * 
+ * \sa
+ */ 
+    void txnQ_PrintQueues (TI_HANDLE hTxnQ);
+#endif
+
+
+
+#endif /*__TXN_QUEUE_API_H__*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/hw/host_platform_omap3430/Symbian/hpa/group/abld.bat	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,15 @@
+@ECHO OFF
+
+REM Bldmake-generated batch file - ABLD.BAT
+REM ** DO NOT EDIT **
+
+perl -S ABLD.PL "\PDD_WiLink6_1\WiLink\platforms\hw\host_platform_omap3430\Symbian\HPA\group\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
+if errorlevel==1 goto CheckPerl
+goto End
+
+:CheckPerl
+perl -v >NUL
+if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
+goto End
+
+:End
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/hw/host_platform_omap3430/Symbian/hpa/group/bld.inf	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,57 @@
+/*
+ * bld.inf
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+/*
+* ============================================================================
+*  Name     : Bld.inf
+*  Part of  : WLAN Networking
+* ============================================================================
+*/
+
+PRJ_PLATFORMS
+	ARMV5
+
+PRJ_EXPORTS
+	
+PRJ_MMPFILES
+
+  wlanhpa.mmp
+				
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/hw/host_platform_omap3430/Symbian/hpa/group/wlanhpa.mmp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,67 @@
+/*
+ * wlanhpa.mmp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 "kernel/kern_ext.mmh"
+#include <platform_paths.hrh>
+
+
+TARGET                  wlanhpa.lib
+TARGETTYPE              klib
+
+MACRO                   ALWAYS_KERNEL
+MACRO			__WAKEUP_3430__
+
+MACRO			WLAN_SDIO
+
+SYSTEMINCLUDE \epoc32\include\omapsw\base\variant\34xx_sdp
+SYSTEMINCLUDE \epoc32\include\omapsw\base\assp\common
+SYSTEMINCLUDE \epoc32\include\omapsw\base\variant\common
+SYSTEMINCLUDE \epoc32\include\omapsw\base\assp\34xx
+
+SYSTEMINCLUDE \epoc32\include\drivers
+SYSTEMINCLUDE \epoc32\include\libc
+
+SYSTEMINCLUDE \sf\os\wlan\wlan_dom\wlan_hpa_api\inc
+SYSTEMINCLUDE \sf\os\wlan\wlan_dom\wlan_osa_api\inc
+
+USERINCLUDE			..\src
+SOURCE				..\src\TIWlanHpa.cpp
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/hw/host_platform_omap3430/Symbian/hpa/src/tiwlanhpa.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,460 @@
+/*
+ * tiwlanhpa.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWlanHpa.cpp 
+ *  \brief  Interface between the sandbox to the BSP of Omap3430
+ *
+ *  \see   
+ */
+
+#include <omap_reg.h>
+
+#include "kernel.h"
+#include "TIWlanHpa.h"
+#include "wlanhpa.h"
+#include "wlanosaext.h"
+
+/* To debug HPA, define some prints here using OSA*/
+#define     TRACE(msg) 
+/*Kern::Printf(msg)*/
+#define     ERROR_TRACE(msg) Kern::Printf(msg);
+
+ 
+extern void Assert( const TInt8*, TInt, TInt );
+
+/** 
+ * \fn     Create
+ * \brief  static creator
+ * 
+ * Create hpa layer object
+ *
+ * \note   
+ * \param aOsaExt osa extension object
+ * \return hpa layer object, NULL upon failure
+ */ 
+WlanHpa* WlanHpa::Create( MWlanOsaExt& aOsaExt, MWlanOsa& aOsa)
+{
+    TRACE(("WlanHpa::Create\n"));
+
+    return new TIWlanHpa(aOsaExt, aOsa);
+}
+
+/** 
+ * \fn     Destroy
+ * \brief  
+ * 
+ * Destroy hpa layer object
+ *
+ * \note   
+ * \param aWlanHpa hpa layer object
+ */ 
+void WlanHpa::Destroy( WlanHpa* aWlanHpa )
+{    
+    if (aWlanHpa)
+    {
+        delete aWlanHpa;
+    }
+}
+
+/** 
+ * \fn     TIWlanHpa
+ * \brief  constructor
+ * 
+ * \note   
+ * \param  aOsaExt 
+ */ 
+TIWlanHpa::TIWlanHpa(MWlanOsaExt& aOsaExt, MWlanOsa& aOsa):
+	WlanHpa( aOsaExt, aOsa),
+	iIrqDfc(InterruptHandlerDfc,(TAny*)this,0)
+{
+    TRACE(("%s\n",__FUNCTION__));
+    TRACE(("construct"));
+    iIrqDfc.SetDfcQ( Kern::DfcQue0() );
+}
+
+/** 
+ * \fn     TIWlanHpa
+ * \brief  destructor
+ * 
+ * \note   
+ */ 
+TIWlanHpa::~TIWlanHpa()
+{
+        TRACE(("%s\n",__FUNCTION__));
+
+}
+ 
+/** 
+ * \fn     TIWlanHpa
+ * \brief  Turns WLAN device power on
+ * 
+ * \note   
+ */ 
+void TIWlanHpa::PowerOnDevice()
+{
+    TRACE(("PowerOnDevice\n")); 
+
+    /* Hook to IRQ line */
+    SetupIrqHw(iConfig.iIsrPolarity);
+	    TRACE(("PowerOnDevice 2\n")); 
+
+    /* Hook to Reset (PM Enable) line */
+    SetupRstHw();
+    TRACE(("PowerOnDevice 3\n")); 
+
+	TOmap::ModifyRegister32(KHwBaseSysCtrlReg +0x0c8,0xFFFF,0x411C);
+
+	TOmap::ModifyRegister32(KHwBaseSysCtrlReg +0xA0C,0xFFFF,0x104);
+
+    /* Activate PM Enable line */
+    ExitReset();
+}
+
+/** 
+ * \fn     TIWlanHpa
+ * \brief  Turns WLAN devices power off
+ * 
+ * \note   
+ */ 
+void TIWlanHpa::PowerOffDevice()
+{
+    TRACE(("%s\n",__FUNCTION__));
+
+    /* Unbind ISR and disable notification */
+    KillInterrupts();
+
+	TOmap::ModifyRegister32(KHwBaseSysCtrlReg +0x0c8,0xFFFF,0x10C);
+
+	TOmap::ModifyRegister32(KHwBaseSysCtrlReg +0xA0C,0xFFFF,0x10C);
+
+    /* Deactivate PM Enable */
+    EnterReset();
+
+    /* Release reset & IRQ pins */
+    GPIO::SetPinMode(RST_GPIO_NUM, GPIO::EDisabled);
+
+    /* cancel any pending interrupts (i.e DFC was scheduled before calling PowerOffDevice() ) */
+    iIrqDfc.Cancel();
+}
+
+/** 
+ * \fn     InterruptServiced
+ * \brief  
+ * 
+ * Called by hpa layer object client when peripheral interrupt
+ * informed by OnInterrupt method has been serviced.
+ * NOTE: on systems implementing level sensitive interrupt handling
+ * host interrupt is enabled at this state
+ *
+ * \note   
+ */     
+void TIWlanHpa::InterruptServiced()
+{
+    Enable();
+}
+
+/** 
+ * \fn     Configure
+ * \brief  configure polarity of IRQ
+ * 
+ * \note   
+ * \param aWlanHpa::TConfig
+ */ 
+void TIWlanHpa::Configure( const WlanHpa::TConfig& aConfig )
+{    
+		TRACE(("Configure"));
+
+    /* Save configuration of polarity, to be used in SetupIrqHw() */
+    iConfig = aConfig;
+}
+
+/** 
+ * \fn     Configure
+ * \brief  configure polarity of IRQ
+ * 
+ * \note   
+ * \param aWlanHpa::TConfig
+ */ 
+void TIWlanHpa::EnableIrq()
+{
+	TRACE(("EnableIrq"));
+
+    Enable();
+}
+
+/** 
+ * \fn     DebugGpioToggle
+ * \brief 
+ * 
+ * \note   
+ * \param 
+ */ 
+TBool TIWlanHpa::DebugGpioToggle( TBool aHigh ){ return 0;}
+/** 
+ * \fn     ExitReset
+ * \brief  Sets WLAN PMEN line.
+ * 
+ * \note   
+ * \param  
+ */ 
+void TIWlanHpa::ExitReset()
+{
+    /* Set GPIO driver output to logic High */
+    GPIO::SetOutputState(RST_GPIO_NUM, GPIO::EHigh);
+}
+
+/** 
+ * \fn     EnterReset
+ * \brief  Clears WLAN PMEN line.
+ * 
+ * \note   
+ * \param  
+ */ 
+void TIWlanHpa::EnterReset()
+{
+    /* Set GPIO driver output to logic Low */
+    GPIO::SetOutputState(RST_GPIO_NUM, GPIO::ELow);
+}
+
+/** 
+ * \fn     Disable
+ * \brief  Disables WLAN interrupt notification.
+ * 
+ * \note   
+ * \param  aOsaExt 
+ */ 
+void TIWlanHpa::Disable()
+{
+    GPIO::DisableInterrupt(IRQ_GPIO_NUM);
+}
+
+/** 
+ * \fn     Enable
+ * \brief  Enables WLAN interrupt notification.
+ * 
+ * \note   
+ * \param  
+ */ 
+void TIWlanHpa::Enable()
+{
+    GPIO::EnableInterrupt(IRQ_GPIO_NUM);
+}
+
+/** 
+ * \fn     SetupIrqHw
+ * \brief  set IRQ line
+ * 
+ * Sets GPIO as input line, binds it to an interrupt. Static function
+ * Isr() is bound to the interrupt service routine. 
+ *
+ * Uses following defines:
+ *
+ *	#define IRQ_GPIO_NUM	61 
+ *	#define IRQ_MOD_NUM		0
+ * 
+ * of which IRQ_GPIO_NUM is the GPIO number and 
+ * IRQ_MOD_NUM is the module number where the corresponding
+ * GPIO belongs to.
+ *
+ * \note   
+ * \param  
+ */ 
+void TIWlanHpa::SetupIrqHw( WlanHpa::TIsrPolarity aPolarity)
+{
+    Kern::Printf("SetupIrqHw %d", IRQ_GPIO_NUM);
+
+   /*--------------------------------------------------------*/
+   /* common code to init the irq pin                        */
+   /*--------------------------------------------------------*/
+    TInt r = GPIO::SetPinMode(IRQ_GPIO_NUM, GPIO::EEnabled);
+    if (r != KErrNone)
+    {
+        ERROR_TRACE(("ERROR:cant grab wlan interrupt pin"))
+        Assert( __FILE__, __LINE__, EFalse );
+    }
+	GPIO::SetPinDirection(IRQ_GPIO_NUM, GPIO::EInput);
+	GPIO::ClearInterrupt(IRQ_GPIO_NUM);
+	GPIO::DisableInterrupt(IRQ_GPIO_NUM);
+	GPIO::DisableWakeup(IRQ_GPIO_NUM);
+
+    r = GPIO::BindInterrupt (IRQ_GPIO_NUM, Isr, this);
+    if (r != KErrNone)
+    {
+        ERROR_TRACE(("ERROR:cant bind wlan interrupt to pin"))
+        Assert( __FILE__, __LINE__, EFalse );
+    }
+
+    /* #warning "IRQ type is EDGE" */
+    if( WlanHpa::EIsrPolarityHigh == aPolarity)
+        /* Configure the Intr on Rising edge sensitive */
+        GPIO::SetInterruptTrigger(IRQ_GPIO_NUM, GPIO::EEdgeRising);
+    else
+        /* Configure the Intr on Falling edge sensitive */
+        GPIO::SetInterruptTrigger(IRQ_GPIO_NUM, GPIO::EEdgeFalling);
+#if 0
+    #warning "IRQ type is LEVEL"
+    if( WlanHpa::EIsrPolarityHigh == aPolarity)
+        /* Configure the Intr on Rising leve sensitive */
+        GPIO::SetInterruptTrigger(IRQ_GPIO_NUM, GPIO::ELevelHigh);
+    else
+        /* Configure the Intr on Falling leve sensitive */
+        GPIO::SetInterruptTrigger(IRQ_GPIO_NUM, GPIO::ELevelLow);
+#endif
+    Disable(); // disable int until required
+}
+	
+/** 
+ * \fn     SetupRstHw
+ * \brief  set reset line.
+ * 
+ * Sets GPIO as output line. Used for controlling the PMEN signal of the WLAN chip.
+ * #define RST_GPIO_NUM	3 
+ * #define RST_MOD_NUM		0
+ *
+ * of which RST_GPIO_NUM is the GPIO number and 
+ * RST_MOD_NUM is the module number where the corresponding
+ * GPIO belongs to.
+ * \note   
+ * \param  
+ */ 
+void TIWlanHpa::SetupRstHw()
+{
+    Kern::Printf("SetupRstHw %d", RST_GPIO_NUM);
+
+    /*--------------------------------------------------------*/
+    /* common code to init the rst pin                        */
+    /*--------------------------------------------------------*/
+    /* Get control of GPIO driver line */
+    TInt r = GPIO::SetPinMode(RST_GPIO_NUM, GPIO::EEnabled);
+    if (r != KErrNone)
+    {
+        ERROR_TRACE(("ERROR:cant grab wlan enable pin"))
+        Assert( __FILE__, __LINE__, EFalse );
+    }
+
+    GPIO::SetPinDirection(RST_GPIO_NUM, GPIO::EOutput);
+
+    EnterReset();
+}
+
+/** 
+ * \fn     Isr
+ * \brief  Interrupt handler function. 
+ *
+ * \note   
+ * \param aPtr HPA object context.
+ * \param aPinHandle is not used. 
+ */ 
+void TIWlanHpa::Isr( TAny* aPtr)
+{
+    TIWlanHpa* p = static_cast<TIWlanHpa*>( aPtr );
+
+       // Ack and Disable the interrupt
+	GPIO::ClearInterrupt(IRQ_GPIO_NUM);
+	GPIO::DisableInterrupt(IRQ_GPIO_NUM);
+	GPIO::DisableWakeup(IRQ_GPIO_NUM);
+
+    p->Disable();
+
+    p->InterruptHandlerStartDfc();
+}
+
+/** 
+ * \fn     InterruptHandlerStartDfc
+ * \brief  Start the DFC queue
+ * 
+ * \note   
+ * \param  
+ */ 
+ 
+void TIWlanHpa::InterruptHandlerStartDfc()
+{
+    iIrqDfc.Add();
+}
+
+/** 
+ * \fn     InterruptHandlerDfc
+ * 
+ * DFC - function called by a DFC to handle the interrupt
+ * call another function to get in the correct class and
+ * therefore don't need me-> all the time
+ * Doesn't always work having me-> for the C software
+ * \note   
+ * \param  
+ */ 
+void TIWlanHpa::InterruptHandlerDfc(TAny* aPtr)
+{
+    TIWlanHpa* me = (TIWlanHpa*)aPtr;
+    me->InterruptHandler();
+}
+
+ /** 
+ * \fn     InterruptHandler
+ * \brief  Call the actual interrupt handling routine and
+ *
+ * \note   
+ * \param  
+ */ 
+void TIWlanHpa::InterruptHandler()
+{
+    OsaExtCb().MutexAcquire();
+    HpaCb().OnInterrupt();
+    OsaExtCb().MutexRelease();
+}
+
+ /** 
+ * \fn     KillInterrupts
+ * \brief  Call the actual interrupt handling routine and
+ *
+ *  Disables interrupts and 
+ *  unbinds the interrupt service routine.
+ *
+ * \note   
+ * \param  
+ */ 
+void TIWlanHpa::KillInterrupts()
+{
+    GPIO::ClearInterrupt(IRQ_GPIO_NUM);
+	GPIO::DisableInterrupt(IRQ_GPIO_NUM);
+	GPIO::DisableWakeup(IRQ_GPIO_NUM);
+	GPIO::UnbindInterrupt(IRQ_GPIO_NUM);
+	GPIO::SetPinMode(IRQ_GPIO_NUM, GPIO::EDisabled);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/hw/host_platform_omap3430/Symbian/hpa/src/tiwlanhpa.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,229 @@
+/*
+ * tiwlanhpa.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWlanHpa.h
+ *  \brief  Interface between the sandbox to the BSP of Omap3430
+ *
+ *  \see   
+ */
+
+#ifndef _TIWLANHPA_
+#define _TIWLANHPA_
+
+#include <silicon_assp.h>
+#include <gpio.h>
+#include <assp.h>
+
+#include "wlanhpa.h"
+
+#ifdef WLAN_SDIO
+#define RST_GPIO_NUM	101
+#define IRQ_GPIO_NUM	162
+#else //WLAN_SPI
+#define RST_GPIO_NUM	3  
+#define IRQ_GPIO_NUM	61 
+#endif //WLAN_SDIO
+
+#define RST_MOD_NUM		0	
+#define IRQ_MOD_NUM		0
+
+#define ASIC_CLASS					TOmap
+#define ASIC_CLASS_PLAT				TOmapPlat	
+
+#define PIN_TO_HANDLE OMAPGPIO_GPINID_TO_PHANDLE
+#define INVALID_HANDLE 				KOmapGpioInvalidHandle
+
+
+class TIWlanHpa : public WlanHpa
+{
+public:
+
+	/**
+	 * Costructor.
+	 */
+	TIWlanHpa(MWlanOsaExt& aOsaExt, MWlanOsa& aOsa);
+
+	/**
+	 * Destructor
+	 */
+	virtual ~TIWlanHpa();
+
+	/**
+	 * Turns WLAN devices power on
+	 */
+	virtual void PowerOnDevice();
+
+	/**
+	 * Turns WLAN devices power off
+	 */
+	virtual void PowerOffDevice();
+
+	/**
+	 * Called by hpa layer object client when peripheral interrupt
+	 * informed by OnInterrupt method has been serviced.
+	 * NOTE: on systems implementing level sensitive interrupt handling
+	 * host interrupt is enabled at this state
+	 */
+	virtual void InterruptServiced();
+
+	    /**
+	 * Configures the HPA layer
+	 */
+	virtual void Configure( const WlanHpa::TConfig& aConfig );  
+
+	/**
+	 * Enables Irq
+	 *
+	 * NOTE: usage limited to bootup sequence only. 
+	 * Untill this call the host side interrupts are disabled
+	 *
+	 */
+	 virtual void EnableIrq();
+	 
+	 /**
+	 * Toggles debug GPIO
+	 * Usage limited to R&D (debug) purpose only
+	 */
+	 virtual TBool DebugGpioToggle( TBool aHigh );
+
+private:
+
+	/*
+	* DFC - function called by a DFC to handle the interrupt
+	* call another function to get in the correct class and
+	* therefore don't need me-> all the time
+	* Doesn't always work having me-> for the C software
+	*/
+	static void InterruptHandlerDfc(TAny *aPtr);
+
+	/**
+	* Start the DFC queue
+	*/
+	void InterruptHandlerStartDfc();
+
+	
+	/*
+	* Call the actual interrupt handling routine and
+	* re-enable the interrupts.
+	*
+	* The interrupt handler is in the third party software
+	* block and performs the necessary functions
+	*/
+	void InterruptHandler();
+
+
+	/**
+	*  Disables interrupts and 
+	*  unbinds the interrupt service routine.
+	*/
+	void KillInterrupts();
+
+	/**
+	* Sets GPIO as input line, binds it to an interrupt. Static function
+	* Isr() is bound to the interrupt service routine. 
+	*
+	* Uses following defines:
+	*
+	*	#define IRQ_GPIO_NUM	9 
+	*	#define IRQ_MOD_NUM		1
+	* 
+	* of which IRQ_GPIO_NUM is the GPIO number and 
+	* IRQ_MOD_NUM is the module number where the corresponding
+	* GPIO belongs to.
+	*/		                   
+	void SetupIrqHw( WlanHpa::TIsrPolarity aPolarity);
+
+	/**
+	* Sets GPIO as output line. Used for controlling the PMEN signal of the WLAN chip.
+	#define RST_GPIO_NUM	10 
+	#define RST_MOD_NUM		1
+
+	* of which RST_GPIO_NUM is the GPIO number and 
+	* RST_MOD_NUM is the module number where the corresponding
+	* GPIO belongs to.
+
+	*/		  
+
+	void SetupRstHw			();
+
+
+	/**
+	* Interrupt handler function. 
+	* Is bound to the ISR and handles continues serving the interrupt.
+	*
+	* \param aPtr HPA object context.
+	* \param aPinHandle is not used. 
+	*/	
+	static void Isr			(TAny* aPtr);
+
+	/**
+	* Clears WLAN PMEN line.
+	*
+	*/
+	void EnterReset();
+
+	/**
+	* Sets WLAN PMEN line.
+	*
+	*/
+	void ExitReset();
+
+	/**
+	* Disables WLAN interrupt notification.
+	*
+	*/
+	void Disable();
+
+	/**
+	* Enables WLAN interrupt notification.
+	*
+	*/
+	void Enable();
+
+private:
+
+	TDfc    		        iIrqDfc;
+	WlanHpa::TConfig		iConfig;
+};
+
+
+
+#endif //_TIWLANHPA_
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/group/omap3430/abld.bat	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,15 @@
+@ECHO OFF
+
+REM Bldmake-generated batch file - ABLD.BAT
+REM ** DO NOT EDIT **
+
+perl -S ABLD.PL "\PDD_WiLink6_1\WiLink\platforms\os\Symbian\WVSS\group\omap3430\\" %1 %2 %3 %4 %5 %6 %7 %8 %9
+if errorlevel==1 goto CheckPerl
+goto End
+
+:CheckPerl
+perl -v >NUL
+if errorlevel==1 echo Is Perl, version 5.003_07 or later, installed?
+goto End
+
+:End
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/group/omap3430/bld.inf	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,58 @@
+/*
+ * bld.inf
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+/*
+* ============================================================================
+*  Name     : Bld.inf
+*  Part of  : WLAN Networking
+* ============================================================================
+*/
+PRJ_PLATFORMS
+	ARMV5
+
+PRJ_EXPORTS
+	
+PRJ_MMPFILES
+	/* In order to avoide "checklib stdc++ --elf|--coff <lib_list>" error in S^3 */
+        ..\..\..\..\..\hw\host_platform_omap3430\Symbian\hpa\group\wlanhpa.mmp
+        platformspecific.mmp
+	
+			
+PRJ_TESTMMPFILES
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/group/omap3430/platformspecific.mmp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,91 @@
+/*
+ * platformspecific.mmp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+// Platform specific definitions. 
+
+MACRO __WAKEUP_2430__
+MACRO ALWAYS_KERNEL
+MACRO _SYMBIAN_
+MACRO DMA_CAPABLE_BUFFERS
+MACRO REPORT_LOG      //for using report mechanism in the legacy way
+MACRO PRINTF_ROLLBACK //for using report mechanism in the legacy way
+MACRO TI_TEST
+MACRO ELP_ENABLED
+MACRO TI_DBG
+MACRO  _DEBUG
+
+MACRO WLAN_SDIO
+MACRO INIT_MESSAGES
+MACRO REPORT_LOG
+
+//MACRO HT_SUPPORT
+//MACRO GEM_SUPPORT
+//MACRO MB_ENABLE
+
+MACRO EDGE_IRQ
+
+
+// To enable plt uncomment the below macro
+//MACRO PLT_TESTER
+
+//MACRO USE_IRQ_ACTIVE_HIGH
+
+//MACRO ENHANCE_PROB_SCAN
+
+MACRO ENHANCED_OPPORTUNISTIC
+
+//MACRO NO_ERROR_INDICATION
+
+// used to keep CPU of OMAP3430 on during Init
+MACRO OMAP3430_CPU_STALL
+
+MACRO NO_SPI_CONFIG
+
+
+MACRO __WAKEUP_3430__
+SYSTEMINCLUDE	\epoc32\include\domain\osextensions
+SYSTEMINCLUDE	\epoc32\include\tiomap3\assp\34xx
+SYSTEMINCLUDE	\epoc32\include\tiomap3\assp\common
+SYSTEMINCLUDE	\epoc32\include\tiomap3\variant\34xx_sdp
+SYSTEMINCLUDE	\epoc32\include\tiomap3\variant\common
+SYSTEMINCLUDE	\epoc32\include\tiomap3\drivers
+
+
+#include "wlanwvss.mmp"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/group/omap3430/twd_c_files.txt	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,44 @@
+SOURCE    ..\..\..\..\..\..\utils\fsm.c 
+SOURCE    ..\..\..\..\..\..\utils\report.c 
+SOURCE    ..\..\..\..\..\..\utils\queue.c 
+SOURCE    ..\..\..\..\..\..\utils\context.c 
+SOURCE    ..\..\..\..\..\..\utils\rate.c
+SOURCE    ..\..\..\..\..\..\utils\timer.c
+SOURCE    ..\..\..\..\..\..\TWD\MacServices\MacServices.c 
+SOURCE    ..\..\..\..\..\..\TWD\MacServices\ScanSrv.c 
+SOURCE    ..\..\..\..\..\..\TWD\MacServices\ScanSrvSM.c 
+SOURCE    ..\..\..\..\..\..\TWD\MacServices\PowerSrv.c 
+SOURCE    ..\..\..\..\..\..\TWD\MacServices\PowerSrvSM.c 
+SOURCE    ..\..\..\..\..\..\TWD\MacServices\MeasurementSrv.c 
+SOURCE    ..\..\..\..\..\..\TWD\MacServices\MeasurementSrvSM.c 
+SOURCE    ..\..\..\..\..\..\TWD\MacServices\measurementSrvDbgPrint.c 
+SOURCE    ..\..\..\..\..\..\TWD\TWDriver\TWDriver.c 
+SOURCE    ..\..\..\..\..\..\TWD\TWDriver\TWDriverTx.c 
+SOURCE    ..\..\..\..\..\..\TWD\TWDriver\TWDriverCtrl.c 
+SOURCE    ..\..\..\..\..\..\TWD\TWDriver\TWDriverRadio.c
+SOURCE    ..\..\..\..\..\..\TWD\Ctrl\CmdQueue.c 
+SOURCE    ..\..\..\..\..\..\TWD\Ctrl\CmdBld.c 
+SOURCE    ..\..\..\..\..\..\TWD\Ctrl\CmdBldCfg.c 
+SOURCE    ..\..\..\..\..\..\TWD\Ctrl\CmdBldCmd.c 
+SOURCE    ..\..\..\..\..\..\TWD\Ctrl\CmdBldItr.c 
+SOURCE    ..\..\..\..\..\..\TWD\Ctrl\CmdBldCfgIE.c 
+SOURCE    ..\..\..\..\..\..\TWD\Ctrl\CmdBldCmdIE.c 
+SOURCE    ..\..\..\..\..\..\TWD\Ctrl\CmdBldItrIE.c 
+SOURCE    ..\..\..\..\..\..\TWD\Data_Service\txHwQueue.c 
+SOURCE    ..\..\..\..\..\..\TWD\Data_Service\txCtrlBlk.c 
+SOURCE    ..\..\..\..\..\..\TWD\Data_Service\RxQueue.c
+SOURCE    ..\..\..\..\..\..\TWD\FW_Transfer\CmdMBox.c 
+SOURCE    ..\..\..\..\..\..\TWD\FW_Transfer\txResult.c 
+SOURCE    ..\..\..\..\..\..\TWD\FW_Transfer\txXfer.c 
+SOURCE    ..\..\..\..\..\..\TWD\FW_Transfer\FwEvent.c 
+SOURCE    ..\..\..\..\..\..\TWD\FW_Transfer\RxXfer.c 
+SOURCE    ..\..\..\..\..\..\TWD\FW_Transfer\eventMbox.c 
+SOURCE    ..\..\..\..\..\..\TWD\FW_Transfer\HwInit.c 
+SOURCE    ..\..\..\..\..\..\TWD\FW_Transfer\fwDebug.c 
+SOURCE    ..\..\..\..\..\..\TWD\TwIf\TwIf.c
+#ifdef WLAN_SDIO
+SOURCE    ..\..\..\..\..\..\Txn\SdioBusDrv.c
+#else
+SOURCE    ..\..\..\..\..\..\Txn\WspiBusDrv.c
+#endif
+SOURCE    ..\..\..\..\..\..\Txn\TxnQueue.c
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/group/omap3430/twd_inc_paths.txt	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,22 @@
+
+// TWD & utils ==> 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\Ctrl 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\Data_Service\Export_Inc 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\FW_Transfer 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\FW_Transfer\Export_Inc 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\Ctrl\Export_Inc 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\MacServices\Export_Inc 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\FirmwareApi 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\MacServices 
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\TWDriver
+SYSTEMINCLUDE    ..\..\..\..\..\..\utils
+SYSTEMINCLUDE    ..\..\..\..\..\..\utils\XCC
+SYSTEMINCLUDE    ..\..\..\..\..\..\platforms\os\common\inc
+SYSTEMINCLUDE    ..\..\..\..\..\..\TWD\TwIf
+SYSTEMINCLUDE    ..\..\..\..\..\..\Txn
+SYSTEMINCLUDE    ..\..\..\..\..\..\platforms\os\Symbian\WVSS\src\sdio
+SYSTEMINCLUDE    \src\cedar\generic\base\e32\drivers\pbus\mmc\sdcard\sdcard3c\sdio
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/group/omap3430/wlanwvss.mmh	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,78 @@
+/*
+ * wlanwvss.mmh
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+// Build system   
+// Base path is platforms\os\Symbian\WVSS\group
+
+	#define WLAN_SDIO
+	SYSTEMINCLUDE	 ..\..\src\external_inc
+	SYSTEMINCLUDE	 ..\..\src\hw
+	SYSTEMINCLUDE	 ..\..\src\os
+	SYSTEMINCLUDE	 ..\..\src\spi
+	SYSTEMINCLUDE	 ..\..\src\wha
+	SYSTEMINCLUDE	 ..\..\src\utils
+	SYSTEMINCLUDE	 ..\..\misc_files
+        SYSTEMINCLUDE	 ..\..\src\sdio
+
+
+	// These files are TWD and utils only (OS independent files)
+	#include "twd_inc_paths.txt"
+	// compile TWD and utils
+	#include "twd_c_files.txt"
+
+	// DDK compilation
+	SOURCEPATH	..\.. 		// Base path is platforms\os\Symbian\WVSS
+	SOURCE		src\os\osapi.cpp
+	SOURCE		src\os\timerclient.cpp
+#ifdef WLAN_SDIO
+	SOURCE      src\sdio\SdioAdapter.cpp
+	SOURCE      src\sdio\SDioClient.cpp
+#else
+	SOURCE		src\spi\WspiAdapter.cpp
+	SOURCE          src\spi\spiclient.cpp
+#endif
+	SOURCE		src\wha\TIWhaAdaptCb.cpp
+	SOURCE		src\wha\TIWha.cpp
+	SOURCE		src\wha\TIWhaCb.cpp
+	SOURCE		src\wha\TIWhaTxRx.cpp
+	SOURCE		src\wha\TIWhaUtils.cpp
+	SOURCE		src\hw\TIWlanHpaCB.cpp
+	SOURCE		src\utils\wlantrace.cpp
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/group/omap3430/wlanwvss.mmp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,108 @@
+/*
+ * wlanwvss.mmp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+// MMP file for TI Wilink
+//
+#include        <omapsw\base\variant\zoom2\variant.mmh>
+#include        "kernel\kern_ext.mmh"
+#include        <platform_paths.hrh>
+
+
+TARGET			        TI_wlanpdd.pdd
+TARGETTYPE              pdd
+
+UID 0x100039d0 0x101F8E54
+VENDORID 0x70000001
+
+OS_LAYER_KERNEL_SYSTEMINCLUDE
+
+STATICLIBRARY           wlanosa.lib
+STATICLIBRARY           wlanosadebug.lib
+STATICLIBRARY           wlanhpa.lib
+LIBRARY                 VariantTarget(kaomap,lib) 
+LIBRARY			VariantTarget(resourcemanager,lib) 
+LIBRARY			VariantTarget(t2gpio,lib) 
+LIBRARY			VariantTarget(gpio,lib)
+
+
+// TI macros
+	MACRO HOST_COMPILE
+	MACRO __BYTE_ORDER_LITTLE_ENDIAN
+	MACRO TNETW1273 	 // used if CHIP is 1273
+	MACRO PLATFORM_SYMBIAN=1	
+	MACRO _USER_MODE 	 // has no meaning, but can't compile without it. 
+	MACRO WSPI
+	macro __WAKEUP_3430__
+	
+
+#include "wlanwvss.mmh"
+
+SYSTEMINCLUDE	\epoc32\include
+SYSTEMINCLUDE	\epoc32\include\libc
+SYSTEMINCLUDE	\epoc32\include\domain\osextensions
+SYSTEMINCLUDE	\epoc32\include\tiomap3\assp\34xx
+SYSTEMINCLUDE	\epoc32\include\tiomap3\assp\common
+SYSTEMINCLUDE	\epoc32\include\tiomap3\variant\34xx_sdp
+SYSTEMINCLUDE	\epoc32\include\tiomap3\variant\common
+SYSTEMINCLUDE	\epoc32\include\tiomap3\drivers
+SYSTEMINCLUDE	\epoc32\include\drivers
+SYSTEMINCLUDE	\epoc32\include\drivers\sdio
+
+SYSTEMINCLUDE \sf\os\wlan\wlan_dom\wlan_hpa_api\inc
+SYSTEMINCLUDE \sf\os\wlan\wlan_dom\wlan_osa_api\inc
+
+SYSTEMINCLUDE       \src\cedar\generic\base\tiomap3\e32\drivers\pbus\mmc\sdcard\sdcard3c\sdio
+SYSTEMINCLUDE       \src\cedar\generic\base\tiomap3\e32\drivers\pbus\mmc\sdcard
+
+//SYSTEMINCLUDE		AsspCommonIncludePath
+
+//library			VariantTarget(kaomap,lib)
+
+#ifdef WLAN_SDIO
+library				epbussdio3.lib
+#endif
+
+CAPABILITY ALL
+
+start wins
+win32_headers
+end
+
+EPOCALLOWDLLDATA
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/misc_files/radio_ini.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,175 @@
+/*
+ * radio_ini.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  radio_ini.h 
+ *  \brief This file is a draft version and it contains the parameters needed for the Radio ini configuration
+ *		   User must fill the TAutoRadioIniParams structure and append it in the aData structure
+ *  \see   
+ */
+
+
+/////////////////////////////////////////////////////////////////////////
+// Database:	IniFileGeneralParam
+// Command:		TEST_CMD_INI_FILE_GENERAL_PARAM
+/////////////////////////////////////////////////////////////////////////
+
+#define MAX_SMART_REFLEX_PARAM 16
+ 
+typedef struct 
+{
+	unsigned char RefClk;                                 
+	unsigned char SettlingTime;                                                                 
+	unsigned char ClockValidOnWakeup;                      
+	unsigned char DC2DCMode;                               
+	unsigned char Single_Dual_Band_Solution;               
+
+	unsigned char	TXBiPFEMAutoDetect;
+	unsigned char	TXBiPFEMManufacturer; 
+    unsigned char   GeneralSettings;
+
+    unsigned char   SRState;
+    char  SRF1[MAX_SMART_REFLEX_PARAM];
+    char  SRF2[MAX_SMART_REFLEX_PARAM];
+    char  SRF3[MAX_SMART_REFLEX_PARAM];
+
+    unsigned char padding[2];
+
+}IniFileGeneralParam;  
+
+typedef enum 
+{		
+	FEM_MANUAL_DETECT_MODE_E,
+	FEM_AUTO_DETECT_MODE_E
+
+}FEM_DETECT_MODE_ENM;
+
+typedef enum 
+{		
+
+	FEM_RFMD_TYPE_E,
+	FEM_TRIQUINT_TYPE_E,
+	NUMBER_OF_FEM_TYPES_E
+
+}FEM_TYPE_ENM;
+
+typedef enum 
+{		
+	REF_CLK_19_2_E,
+	REF_CLK_26_E,
+	REF_CLK_38_4_E,
+	REF_CLK_52_E
+
+}REF_CLK_ENM;
+
+typedef enum 
+{		
+	REF_CLK_NOT_VALID_E,
+	REF_CLK_VALID_AND_STABLE_E
+
+}CLK_VALID_ON_WAKEUP_ENM;
+
+typedef enum 
+{		
+	BT_SPI_IS_NOT_USED_E,
+	MUX_DC2DC_TO_BT_FUNC2_E
+
+}DC2DC_MODE_ENM;
+
+typedef enum 
+{		
+	SINGLE_BAND_SOLUTION_E,
+	DUAL_BAND_SOLUTION_E
+
+}SINGLE_DUAL_BAND_SOLUTION_ENM;
+
+/////////////////////////////////////////////////////////////////////////
+// Database:	IniFileRadioParam
+// Command:		TEST_CMD_INI_FILE_RADIO_PARAM
+/////////////////////////////////////////////////////////////////////////
+
+#define RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE   (15)
+#define NUMBER_OF_SUB_BANDS_IN_5G_BAND_E           (7) 
+#define NUMBER_OF_RATE_GROUPS_E                    (6)
+#define NUMBER_OF_2_4_G_CHANNELS                   (14)
+#define NUMBER_OF_5G_CHANNELS                      (35)
+
+typedef struct 
+{	
+	unsigned char RxTraceInsertionLoss_2_4G;																							
+	unsigned char TXTraceLoss_2_4G;																							
+	char  RxRssiAndProcessCompensation_2_4G[RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE];						
+
+    unsigned char padding;
+    
+}TStatRadioParams;  
+
+typedef struct 
+{
+	// SECTION 1: 2.4G parameters
+	short TXBiPReferencePDvoltage_2_4G;
+	char  TxBiPReferencePower_2_4G;
+	char  TxBiPOffsetdB_2_4G;
+	char  TxPerRatePowerLimits_2_4G_Normal[NUMBER_OF_RATE_GROUPS_E];
+	char  TxPerRatePowerLimits_2_4G_Degraded[NUMBER_OF_RATE_GROUPS_E];
+    char  TxPerRatePowerLimits_2_4G_Extreme[NUMBER_OF_RATE_GROUPS_E];
+	char  TxPerChannelPowerLimits_2_4G_11b[NUMBER_OF_2_4_G_CHANNELS];
+	char  TxPerChannelPowerLimits_2_4G_OFDM[NUMBER_OF_2_4_G_CHANNELS];
+	char  TxPDVsRateOffsets_2_4G[NUMBER_OF_RATE_GROUPS_E];
+	unsigned char TxIbiasTable_2_4G[NUMBER_OF_RATE_GROUPS_E];
+	unsigned char RxFemInsertionLoss_2_4G;
+    unsigned char DegradedLowToNormalThr_2_4G;
+    unsigned char NormalToDegradedHighThr_2_4G;
+    
+    unsigned char padding;
+     
+}TDynRadioParams;  
+
+
+/////////////////////////////////////////////////////////////////////////
+// Addition to: WHA and TRIOSCOPE (not public_radion.h !!!)
+/////////////////////////////////////////////////////////////////////////
+
+typedef struct 
+{
+ IniFileGeneralParam  tGeneralParams;
+ TStatRadioParams	  tStatRadioParams;
+ TDynRadioParams	  tDynRadioParams[NUMBER_OF_FEM_TYPES_E];
+
+}TAutoRadioIniParams;  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/external_inc/InternalCmdCodes.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,227 @@
+/*
+ * InternalCmdCodes.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 __PARAM_MGR_H__
+#define __PARAM_MGR_H__
+
+#include "CmdInterfaceCodes.h"
+#include "TWDriver.h"
+
+/* Following are the parameters numbers. Each module can have 256 parameters */
+typedef enum
+{    
+     /* TWD Control section */
+    TWD_COUNTERS_PARAM                     =           GET_BIT | TWD_MODULE_PARAM | TWD_COUNTERS_PARAM_ID,
+    TWD_LISTEN_INTERVAL_PARAM              = SET_BIT | GET_BIT | TWD_MODULE_PARAM | TWD_LISTEN_INTERVAL_PARAM_ID,
+    TWD_BEACON_INTERVAL_PARAM              =           GET_BIT | TWD_MODULE_PARAM | TWD_BEACON_INTERVAL_PARAM_ID,
+    TWD_TX_POWER_PARAM                     = SET_BIT | GET_BIT | TWD_MODULE_PARAM | TWD_TX_POWER_PARAM_ID,
+    TWD_CLK_RUN_ENABLE_PARAM               = SET_BIT |           TWD_MODULE_PARAM | TWD_CLK_RUN_ENABLE_PARAM_ID,
+    TWD_QUEUES_PARAM                       = SET_BIT |           TWD_MODULE_PARAM | TWD_QUEUES_PARAM_ID, 
+    TWD_TX_RATE_CLASS_PARAM                = SET_BIT | GET_BIT | TWD_MODULE_PARAM | TWD_TX_RATE_CLASS_PARAM_ID,
+    TWD_MAX_TX_MSDU_LIFE_TIME_PARAM        = SET_BIT | GET_BIT | TWD_MODULE_PARAM | TWD_MAX_TX_MSDU_LIFE_TIME_PARAM_ID,
+    TWD_MAX_RX_MSDU_LIFE_TIME_PARAM        = SET_BIT | GET_BIT | TWD_MODULE_PARAM | TWD_MAX_RX_MSDU_LIFE_TIME_PARAM_ID,
+    TWD_RX_TIME_OUT_PARAM                  = SET_BIT |           TWD_MODULE_PARAM | TWD_RX_TIME_OUT_PARAM_ID,
+    TWD_BCN_BRC_OPTIONS_PARAM              =           GET_BIT | TWD_MODULE_PARAM | TWD_BCN_BRC_OPTIONS_PARAM_ID,
+
+    /* Site manager section */
+    SITE_MGR_DESIRED_BSSID_PARAM                    = SET_BIT           | SITE_MGR_MODULE_PARAM | 0x02, 
+    SITE_MGR_DESIRED_SSID_PARAM                     = SET_BIT           | SITE_MGR_MODULE_PARAM | 0x03,
+    SITE_MGR_DESIRED_BSS_TYPE_PARAM                 = SET_BIT           | SITE_MGR_MODULE_PARAM | 0x04,
+    SITE_MGR_DESIRED_MODULATION_TYPE_PARAM          = SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x08,
+    SITE_MGR_DESIRED_BEACON_INTERVAL_PARAM          = SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x09,
+    SITE_MGR_CURRENT_RADIO_TYPE_PARAM               =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x0D,
+
+    SITE_MGR_CURRENT_SSID_PARAM                     =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x0F,
+    SITE_MGR_CURRENT_RATE_PAIR_PARAM                =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x10,
+    SITE_MGR_CURRENT_MODULATION_TYPE_PARAM          =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x11,
+    SITE_MGR_CURRENT_SIGNAL_PARAM                   = SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x12,
+    SITE_MGR_PRIMARY_SITE_PARAM                     =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x15,
+    SITE_MGR_DESIRED_DOT11_MODE_PARAM               = SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x18,
+    SITE_MGR_OPERATIONAL_MODE_PARAM                 =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x19,
+    SITE_MGR_CURRENT_SLOT_TIME_PARAM                =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x1C,
+    SITE_MGR_CURRENT_PREAMBLE_TYPE_PARAM            =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x1D,
+    SITE_MGR_BUILT_IN_TEST_STATUS_PARAM             =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x1E,
+    SITE_MGR_CONFIGURATION_PARAM                        = SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x1F,
+    SITE_MGR_AP_TX_POWER_PARAM                      =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x23,
+    SITE_MGR_DESIRED_TX_RATE_PRCT_SET               = SET_BIT           | SITE_MGR_MODULE_PARAM | 0x26,
+    SITE_MGR_DESIRED_RSSI_THRESHOLD_SET             = SET_BIT           | SITE_MGR_MODULE_PARAM | 0x27,
+
+    SITE_MGR_SITE_ENTRY_BY_INDEX                        =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x28,
+    SITE_MGR_CUR_NUM_OF_SITES                       =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x29,
+    SITE_MGR_CURRENT_TSF_TIME_STAMP                 =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x2A,    
+    SITE_MGR_GET_SELECTED_BSSID_INFO                =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x2B,
+    SITE_MGR_DESIRED_CONS_TX_ERRORS_THREH           = SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x2C,
+    SITE_MGR_SUPPORTED_NETWORK_TYPES                =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x2D,
+    SITE_MGR_CURRENT_BSSID_PARAM                        =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x2F,
+    SITE_MGR_LAST_RX_RATE_PARAM                     =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x30,
+    SITE_MGR_LAST_BEACON_BUF_PARAM                  =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x31,
+    SITE_MGR_CURRENT_BSS_TYPE_PARAM                 =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x33,
+    SITE_MGR_GET_SELECTED_BSSID_INFO_EX             =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x37,    
+    SITE_MGR_RADIO_BAND_PARAM                       =           GET_BIT | SITE_MGR_MODULE_PARAM | 0x39,
+
+    /* MLME section */
+    MLME_BEACON_RECV                                    =           GET_BIT | MLME_SM_MODULE_PARAM  | 0x01,
+
+    /* SME SM section */
+    SME_DESIRED_SSID_PARAM                          = SET_BIT | GET_BIT | SME_MODULE_PARAM   | 0x01,
+    SME_DESIRED_BSSID_PARAM                         = SET_BIT | GET_BIT | SME_MODULE_PARAM   | 0x02,
+
+    SME_DESIRED_BSS_TYPE_PARAM                      = SET_BIT | GET_BIT | SME_MODULE_PARAM   | 0x05,
+    SME_CONNECTION_STATUS_PARAM                     =           GET_BIT | SME_MODULE_PARAM   | 0x06,
+
+    /* Scan concentrator section */
+
+    /* Scan Manager module */
+    
+    /* Connection section */
+    CONN_SELF_TIMEOUT_PARAM                         = SET_BIT | GET_BIT | CONN_MODULE_PARAM | 0x01,
+
+    /* Auth section */
+    AUTH_RESPONSE_TIMEOUT_PARAM                     = SET_BIT | GET_BIT | AUTH_MODULE_PARAM | 0x01,
+    AUTH_COUNTERS_PARAM                             =           GET_BIT | AUTH_MODULE_PARAM | 0x02,
+
+    /* Assoc section */
+    ASSOC_RESPONSE_TIMEOUT_PARAM                        = SET_BIT | GET_BIT | ASSOC_MODULE_PARAM | 0x01,
+    ASSOC_COUNTERS_PARAM                                =           GET_BIT | ASSOC_MODULE_PARAM | 0x02,
+    ASSOC_ASSOCIATION_INFORMATION_PARAM             =           GET_BIT | ASSOC_MODULE_PARAM | 0x03,
+    ASSOC_ASSOCIATION_RESP_PARAM                        =           GET_BIT | ASSOC_MODULE_PARAM | 0x04,
+
+    /* RSN section */
+    RSN_PRIVACY_OPTION_IMPLEMENTED_PARAM            =           GET_BIT | RSN_MODULE_PARAM | 0x01,
+    RSN_KEY_PARAM                                       = SET_BIT | GET_BIT | RSN_MODULE_PARAM | 0x02,
+    RSN_SECURITY_STATE_PARAM                            =           GET_BIT | RSN_MODULE_PARAM | 0x03,
+    RSN_AUTH_ENCR_CAPABILITY                            =           GET_BIT | RSN_MODULE_PARAM | 0x11,
+    RSN_PMKID_LIST                                      = SET_BIT | GET_BIT | RSN_MODULE_PARAM | 0x12,
+    RSN_WPA_PROMOTE_AVAILABLE_OPTIONS               =           GET_BIT | RSN_MODULE_PARAM | 0x13,
+    RSN_WPA_PROMOTE_OPTIONS                         = SET_BIT           | RSN_MODULE_PARAM | 0x14,
+    RSN_PRE_AUTH_STATUS                             =           GET_BIT | RSN_MODULE_PARAM | 0x15,
+    RSN_EAP_TYPE                                        = SET_BIT | GET_BIT | RSN_MODULE_PARAM | 0x16,
+    WPA_801_1X_AKM_EXISTS                               =           GET_BIT | RSN_MODULE_PARAM | 0x17,
+
+    /* RX data section */
+    RX_DATA_COUNTERS_PARAM                          =           GET_BIT | RX_DATA_MODULE_PARAM | 0x01,
+    RX_DATA_EXCLUDE_UNENCRYPTED_PARAM               = SET_BIT | GET_BIT | RX_DATA_MODULE_PARAM | 0x02,
+    RX_DATA_EXCLUDE_BROADCAST_UNENCRYPTED_PARAM = SET_BIT | GET_BIT | RX_DATA_MODULE_PARAM | 0x03,
+     
+    /* TX data section */
+    TX_CTRL_GET_MEDIUM_USAGE_THRESHOLD              = SET_BIT | GET_BIT | TX_CTRL_MODULE_PARAM | 0x04,
+    TX_CTRL_POLL_AP_PACKETS_FROM_AC                     = SET_BIT           | TX_CTRL_MODULE_PARAM | 0x05,
+    TX_CTRL_REPORT_TS_STATISTICS                        =           GET_BIT | TX_CTRL_MODULE_PARAM | 0x06,
+    TX_CTRL_GET_DATA_FRAME_COUNTER                  =           GET_BIT | TX_CTRL_MODULE_PARAM | 0x07,
+    
+    /* CTRL data section */
+    CTRL_DATA_COUNTERS_PARAM                            =           GET_BIT | CTRL_DATA_MODULE_PARAM | 0x01,
+    CTRL_DATA_RATE_CONTROL_ENABLE_PARAM             = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x02,
+    CTRL_DATA_CURRENT_BSSID_PARAM                   =           GET_BIT | CTRL_DATA_MODULE_PARAM | 0x03,
+    CTRL_DATA_CURRENT_SUPPORTED_RATE_MASK_PARAM =           GET_BIT | CTRL_DATA_MODULE_PARAM | 0x05,
+    CTRL_DATA_CURRENT_PREAMBLE_TYPE_PARAM           =           GET_BIT | CTRL_DATA_MODULE_PARAM | 0x06,
+    CTRL_DATA_CURRENT_PROTECTION_STATUS_PARAM       = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x07,
+    CTRL_DATA_CURRENT_IBSS_PROTECTION_PARAM         = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x09,
+    CTRL_DATA_CURRENT_RTS_CTS_STATUS_PARAM          = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x0A,
+    CTRL_DATA_GET_USER_PRIORITY_OF_STREAM           = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x10,
+    CTRL_DATA_SHORT_RETRY_LIMIT_PARAM               = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x11,
+    CTRL_DATA_LONG_RETRY_LIMIT_PARAM                = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x12,
+    CTRL_DATA_CURRENT_RATE_CLASS_CLIENT             = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x13,
+    CTRL_DATA_NEXT_RATE_MASK_FOR_CLIENT             = SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x14,
+    CTRL_DATA_TSRS_PARAM                                = SET_BIT           | CTRL_DATA_MODULE_PARAM | 0x17,
+
+    /* regulatory domain section */
+    REGULATORY_DOMAIN_UPDATE_CHANNEL_VALIDITY           = SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x09,
+    REGULATORY_DOMAIN_CURRENT_TX_ATTENUATION_PARAM      =           GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x0A,
+    REGULATORY_DOMAIN_TEMPORARY_TX_ATTENUATION_PARAM    = SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x0B,
+    REGULATORY_DOMAIN_ALL_SUPPORTED_CHANNELS            =           GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x11,
+    REGULATORY_DOMAIN_IS_DFS_CHANNEL                    =           GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x13,
+    REGULATORY_DOMAIN_DISCONNECT_PARAM                  = SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x14,
+    REGULATORY_DOMAIN_TX_POWER_AFTER_SELECTION_PARAM    = SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x15,
+    REGULATORY_DOMAIN_COUNTRY_PARAM                     = SET_BIT | GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x16,
+    REGULATORY_DOMAIN_POWER_CAPABILITY_PARAM            =           GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x17,
+    REGULATORY_DOMAIN_SET_POWER_CONSTRAINT_PARAM        = SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x18,
+    REGULATORY_DOMAIN_IS_CHANNEL_SUPPORTED              =           GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x19,
+    REGULATORY_DOMAIN_EXTERN_TX_POWER_PREFERRED         = SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x1A,
+    REGULATORY_DOMAIN_SET_CHANNEL_VALIDITY              = SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x1B,
+    REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES             =           GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x1C,
+    REGULATORY_DOMAIN_IS_COUNTRY_FOUND                  =           GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x1D,
+    REGULATORY_DOMAIN_TIME_TO_COUNTRY_EXPIRY            =           GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x1E,
+    /* measurement section */
+     
+#ifdef XCC_MODULE_INCLUDED
+    /* XCC */    
+    XCC_ROGUE_AP_DETECTED                               = SET_BIT           | XCC_MANAGER_MODULE_PARAM | 0x02,
+    XCC_REPORT_ROGUE_APS                                = SET_BIT           | XCC_MANAGER_MODULE_PARAM | 0x03,
+    XCC_AUTH_SUCCESS                                    = SET_BIT           | XCC_MANAGER_MODULE_PARAM | 0x04,
+    XCC_CCKM_REQUEST                                    = SET_BIT           | XCC_MANAGER_MODULE_PARAM | 0x05,
+    XCC_CCKM_RESULT                                 = SET_BIT           | XCC_MANAGER_MODULE_PARAM | 0x06,
+    XCC_ENABLED                                     = SET_BIT | GET_BIT | XCC_MANAGER_MODULE_PARAM | 0x07,
+    XCC_CURRENT_AP_SUPPORTED_VERSION                =           GET_BIT | XCC_MANAGER_MODULE_PARAM | 0x08,
+#endif
+
+    /* Roaming manager */
+    
+    /* Parameters used for DEBUG */
+    ROAMING_MNGR_TRIGGER_EVENT                      = SET_BIT           | ROAMING_MANAGER_MODULE_PARAM | 0x03,
+    ROAMING_MNGR_CONN_STATUS                        = SET_BIT           | ROAMING_MANAGER_MODULE_PARAM | 0x04, 
+#ifdef TI_DBG
+    ROAMING_MNGR_PRINT_STATISTICS                   =           GET_BIT | ROAMING_MANAGER_MODULE_PARAM | 0x05,
+    ROAMING_MNGR_RESET_STATISTICS                   =           GET_BIT | ROAMING_MANAGER_MODULE_PARAM | 0x06,
+    ROAMING_MNGR_PRINT_CURRENT_STATUS               =           GET_BIT | ROAMING_MANAGER_MODULE_PARAM | 0x07,
+    ROAMING_MNGR_PRINT_CANDIDATE_TABLE              =           GET_BIT | ROAMING_MANAGER_MODULE_PARAM | 0x08,
+#endif
+
+    /* Soft Gemini params */
+     
+    /* QOS manager params */
+    QOS_MNGR_SHORT_RETRY_LIMIT_PARAM            	= SET_BIT | GET_BIT | QOS_MANAGER_PARAM | 0x01,
+    QOS_MNGR_LONG_RETRY_LIMIT_PARAM                 = SET_BIT | GET_BIT | QOS_MANAGER_PARAM | 0x02,
+    QOS_PACKET_BURST_ENABLE                         = SET_BIT | GET_BIT | QOS_MANAGER_PARAM | 0x03,
+    QOS_MNGR_SET_SITE_PROTOCOL            			= SET_BIT |           QOS_MANAGER_PARAM | 0x04,
+    QOS_MNGR_SET_802_11_POWER_SAVE_STATUS           = SET_BIT |           QOS_MANAGER_PARAM | 0x05,
+    QOS_MNGR_SET_OPERATIONAL_MODE                   = SET_BIT |           QOS_MANAGER_PARAM | 0x08,
+    QOS_MNGR_CURRENT_PS_MODE                        = SET_BIT | GET_BIT | QOS_MANAGER_PARAM | 0x09,
+    QOS_MNGR_ACTIVE_PROTOCOL                        =           GET_BIT | QOS_MANAGER_PARAM | 0x0A,
+    QOS_GET_RATE_THRESHOLD                          = SET_BIT | GET_BIT | QOS_MANAGER_PARAM | 0x0B,
+    QOS_MNGR_VOICE_RE_NEGOTIATE_TSPEC               = SET_BIT | GET_BIT | QOS_MANAGER_PARAM | 0x0C,
+    QOS_MNGR_RESEND_TSPEC_REQUEST                   = SET_BIT           | QOS_MANAGER_PARAM | 0x0D,
+
+    /* Power Manager params */
+    POWER_MGR_DISABLE_PRIORITY                      = SET_BIT |           POWER_MANAGER_PARAM | 0x02,   
+    POWER_MGR_ENABLE_PRIORITY                       = SET_BIT |           POWER_MANAGER_PARAM | 0x03
+    
+}   EInternalParam;
+
+
+#endif /* __PARAM_MGR_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/external_inc/OsApiDepend.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,128 @@
+/*
+ * OsApiDepend.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:      OsApiDepend.h*/
+/**/
+/* Purpose:     This module defines unified interface to the OS specific*/
+/*              sources and services.*/
+/**/
+/*--------------------------------------------------------------------------*/
+
+#ifndef __OS_API_DEPEND_H__
+#define __OS_API_DEPEND_H__
+
+/** \file  OsApiDepend.h 
+ * \brief Operating System APIs that depend OS\n
+ * This module defines unified interface to the OS, that different between the OSs, the specific sources and services
+ */
+
+#include "tidef.h"
+
+/** \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);
+
+/** \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
+ */
+#define OS_ENTER_CRITICAL_SECTION(OsContext, 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
+ */
+#define OS_LEAVE_CRITICAL_SECTION(OsContext, ProtectContext)
+
+
+/** \brief  OS Schedule Request
+ * 
+ * \param  OsContext    - Handle to the OS object
+ * \return TI_NOK (1) that indicate to the DR to call the CB by himself 
+ * 
+ * \par Description
+ * in Symbian we dont have scheduling support
+ * 
+ * \sa
+ */
+#define OS_REQUEST_SCHEDULE(OsContext) \
+    TI_NOK
+
+/** \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
+ */ 
+ /* Mark that interrupt was serviced */
+#define OS_INTERRUPT_SERVICED(OsContext) \
+	os_InterruptServiced (OsContext)
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/external_inc/TI_IPC_Api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,171 @@
+/*
+ * TI_IPC_Api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/*---------------------------------------------------------------*/
+/**/
+/*  TI IPC header file*/
+/**/
+/*  Author :    Texas Instruments*/
+/**/
+/*  Filename: TI_IPC_Api.h*/
+/**/
+/*  Version  :1.0*/
+/**/
+/*  Last update date : 15/03/2004*/
+/**/
+/*---------------------------------------------------------------*/
+
+#ifndef _TI_IPC_API_H
+#define _TI_IPC_API_H
+
+#include "tidef.h"
+
+
+#define MAX_REGISTERED_MODULES 5
+#define MAX_EVENT_DATA_SIZE 128
+#define MAX_SEND_EVENTS 4
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/*******************Defines*********************/
+
+/* WARNING! DON'T CHANGE THE ORDER OF EVENTS! */
+/* OS EVENTS MUST COME FIRST!*/
+
+enum
+{
+    IPC_EVENT_ASSOCIATED = 0,
+    IPC_EVENT_DISASSOCIATED,
+    IPC_EVENT_LINK_SPEED,
+    IPC_EVENT_AUTH_SUCC,
+    IPC_EVENT_SCAN_COMPLETE,
+    IPC_EVENT_TIMEOUT,
+    IPC_EVENT_CCKM_START,
+    IPC_EVENT_MEDIA_SPECIFIC,
+    IPC_EVENT_MAX_OS_EVENT = IPC_EVENT_MEDIA_SPECIFIC,
+    IPC_EVENT_EAPOL,
+    IPC_EVENT_BOUND,
+    IPC_EVENT_UNBOUND,
+    IPC_EVENT_PREAUTH_EAPOL,
+    IPC_EVENT_RESERVED2,
+    IPC_EVENT_LOW_RSSI,
+    IPC_EVENT_TSPEC_STATUS,
+    IPC_EVENT_TSPEC_RATE_STATUS,
+    IPC_EVENT_MEDIUM_TIME_CROSS,
+    IPC_EVENT_ROAMING_COMPLETE,
+    IPC_EVENT_EAP_AUTH_FAILURE,
+    IPC_EVENT_WPA2_PREAUTHENTICATION,
+    IPC_EVENT_TRAFFIC_INTENSITY_THRESHOLD_CROSSED,
+    IPC_EVENT_GWSI,
+    IPC_EVENT_WPS_SESSION_OVERLAP,
+    IPC_EVENT_RSSI_SNR_TRIGGER_0,
+    IPC_EVENT_RSSI_SNR_TRIGGER_1,
+	IPC_EVENT_LOGGER,
+    IPC_EVENT_NOT_ASSOCIATED,
+    IPC_EVENT_MAX
+};
+
+enum
+{
+    DELIVERY_PUSH =0,
+    DELIVERY_GET_DATA
+};
+
+/************************* IOCTLs Functions *******************************/
+
+TI_HANDLE   IPC_Init(void);
+
+TI_INT32     IPC_DeInit(void);
+
+TI_HANDLE   IPC_DeviceOpen(void* AdapterName); /* get hDevice Handle*/
+
+TI_INT32     IPC_DeviceClose(TI_HANDLE hDevice);
+
+TI_INT32     IPC_DeviceIoControl(TI_HANDLE   hDevice,
+                            TI_UINT32    IoControlCode, 
+                            void*     pInBuffer,
+                            TI_UINT32    InBufferSize,
+                            void*     pOutBuffer,
+                            TI_UINT32    pOutBufferSize,
+                            TI_UINT32*   pBytesReturned);
+
+/************************* Events Functions *******************************/
+
+typedef struct _IPC_EV_DATA * PIPC_EV_DATA;  
+
+typedef TI_INT32 (*TI_EVENT_CALLBACK) (PIPC_EV_DATA  pData);
+
+typedef struct _IPC_EVENT_PARAMS
+{
+    TI_UINT32            uEventType;
+    TI_HANDLE           uEventID;
+    TI_UINT32            uProcessID;
+    TI_UINT32            uDeliveryType;
+    TI_HANDLE           hUserParam;            /* Handle to back reference*/
+    TI_EVENT_CALLBACK   pfEventCallback;
+}IPC_EVENT_PARAMS;
+
+/* EvParams are assumed to be the first field. Any addtions shoild be made 
+    afterwards
+ */
+typedef struct _IPC_EV_DATA
+{
+    IPC_EVENT_PARAMS    EvParams;
+    TI_UINT32            uBufferSize;
+    TI_UINT8             uBuffer[MAX_EVENT_DATA_SIZE];
+}IPC_EV_DATA;
+
+
+/*this function will also enable event and pass all the parameters about it*/
+/* returns unique ID of registered event, to be passed later for unregister*/
+TI_INT32 IPC_RegisterEvent(TI_HANDLE             hDevice,    /* Driver Handle*/
+                          IPC_EVENT_PARAMS*     pEvParams);  /* size of the structure + size of the params*/
+
+TI_INT32 IPC_UnRegisterEvent(TI_HANDLE   hDevice,
+                            IPC_EVENT_PARAMS*   pEvParams); /* returned by IPC_RegisterEvent*/
+
+/***************************************************************************/
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif /*_IPC_UTIL_H*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/external_inc/coreDefaultParams.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1239 @@
+/*
+ * coreDefaultParams.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 _CORE_DEFAULT_PARAMS_H
+#define _CORE_DEFAULT_PARAMS_H
+                  
+#if defined(__ARMCC__) 
+#include "public_infoele.h"
+#endif
+/************************************/
+/*      Min, Max & Default values   */
+/************************************/
+
+/* In this section are defined default, min & max values for parameters, according to the MIB */
+/* This values are used as following:
+        - By the OS abstraction layer in order to fill the init table with the default values
+        if the NVRAM/Registry value for the parameter is invalid
+        - By the core modules in order to perform validity check upon setting a parameter. */
+
+/* This is the max possible string length from INI file */
+#define BEACON_FILTER_STRING_MAX_LEN            300
+
+#define SG_RATES_STRING_MAX_DEF                 100
+/* All rates but 1,2,6,9,22 */
+#define SG_RATES_DEF                            "0,0,1,0,0,1,1,1,0,1,1,1,1"
+
+
+#define SITE_MGR_CHANNEL_MIN                    1
+/* Band A*/
+#define SITE_MGR_CHANNEL_A_MIN                  36
+/* Band B&G*/
+#define SITE_MGR_CHANNEL_B_G_MAX                14
+#define SITE_MGR_CHANNEL_MAX                    201
+#define SITE_MGR_CHANNEL_DEF                    11
+
+#define SITE_MGR_DOT_11_MODE_MIN                DOT11_B_MODE
+#define SITE_MGR_DOT_11_MODE_MAX                DOT11_DUAL_MODE
+#define SITE_MGR_DOT_11_MODE_DEF                DOT11_G_MODE
+
+#define SITE_MGR_BSS_TYPE_DEF                   BSS_INFRASTRUCTURE
+
+#define SITE_MGR_DEF_RATE_SET_MAX_BASIC_DEF     DRV_RATE_2M
+#define SITE_MGR_DEF_RATE_SET_MAX_ACTIVE_DEF    DRV_RATE_11M
+
+#define SITE_MGR_MGMT_FRAME_RATE_MIN            DRV_RATE_1M
+#define SITE_MGR_MGMT_FRAME_RATE_MAX            DRV_RATE_22M
+#define SITE_MGR_MGMT_FRAME_RATE_DEF            DRV_RATE_2M
+
+#define SITE_MGR_MODULATION_TYPE_DEF            DRV_MODULATION_CCK
+
+#define SITE_MGR_BEACON_INTERVAL_MIN            1
+#define SITE_MGR_BEACON_INTERVAL_MAX            65535
+#define SITE_MGR_BEACON_INTERVAL_DEF            200
+
+/* number of events to wake up on -
+    For WakeOnBeacon- Aging interval =  SITE_MGR_NUMBER_OF_EVENTS_BEFORE_AGING * BeaconInterval
+    For WakeOnDtim - Aging interval =  SITE_MGR_NUMBER_OF_EVENTS_BEFORE_AGING * BeaconInterval * DtimPeriod */
+#define SITE_MGR_NUMBER_OF_EVENTS_BEFORE_AGING_MIN  2
+#define SITE_MGR_NUMBER_OF_EVENTS_BEFORE_AGING_MAX  20
+#define SITE_MGR_NUMBER_OF_EVENTS_BEFORE_AGING_DEF  10
+
+#define SITE_MGR_NUMBER_OF_TX_FAILURE_BEFORE_AGING_MIN  3
+#define SITE_MGR_NUMBER_OF_TX_FAILURE_BEFORE_AGING_MAX  100
+#define SITE_MGR_NUMBER_OF_TX_FAILURE_BEFORE_AGING_DEF  6
+
+/* In seconds */
+#define SITE_MGR_ROAMING_STATS_RESET_TIMEOUT_MIN   5
+#define SITE_MGR_ROAMING_STATS_RESET_TIMEOUT_MAX   60
+#define SITE_MGR_ROAMING_STATS_RESET_TIMEOUT_DEF   10
+
+#define SITE_MGR_LNA_BEACON_INT_COUNT_MIN       2   
+#define SITE_MGR_LNA_BEACON_INT_COUNT_MAX       0xFFFF
+#define SITE_MGR_LNA_BEACON_INT_COUNT_DEF       3
+
+#define SITE_MGR_LNA_PD_THRESHOLD_LOW_MIN       0x00    
+#define SITE_MGR_LNA_PD_THRESHOLD_LOW_MAX       0xff    
+#define SITE_MGR_LNA_PD_THRESHOLD_LOW_DEF       0x90    
+
+#define SITE_MGR_LNA_PD_THRESHOLD_HIGH_MIN      0x00    
+#define SITE_MGR_LNA_PD_THRESHOLD_HIGH_MAX      0xff    
+#define SITE_MGR_LNA_PD_THRESHOLD_HIGH_DEF      0xD5    
+
+#define SITE_MGR_LNA_EN_DINAMYC_TX_ALGO_DEF     0   
+#define SITE_MGR_LNA_EN_DINAMYC_TX_ALGO_MAX     1
+#define SITE_MGR_LNA_EN_DINAMYC_TX_ALGO_MIN     0
+
+#define SITE_MGR_PREAMBLE_TYPE_DEF              PREAMBLE_SHORT
+
+#define SITE_MGR_EXTERNAL_MODE_MIN              0
+#define SITE_MGR_EXTERNAL_MODE_MAX              1
+#define SITE_MGR_EXTERNAL_MODE_DEF              0
+
+#define SITE_MGR_PERFORM_BUILD_IN_TEST_RECOVEY_MIN      TI_FALSE
+#define SITE_MGR_PERFORM_BUILD_IN_TEST_RECOVEY_MAX      TI_TRUE
+#define SITE_MGR_PERFORM_BUILD_IN_TEST_RECOVEY_DEF      TI_FALSE
+
+#define SITE_MGR_WiFiAdHoc_MIN                  0
+#define SITE_MGR_WiFiAdHoc_MAX                  1
+#define SITE_MGR_WiFiAdHoc_DEF                  0
+
+#define SITE_MGR_RX_LEVEL_TABLE_SIZE_DEF        44
+
+/* due to the fact we use the site table only to connect we need just 2 entries each table */
+#define MAX_SITES_BG_BAND   2
+#define MAX_SITES_A_BAND    2
+#define NUM_OF_SITE_TABLE   2
+
+/* Beacon broadcast options */
+#define BCN_RX_TIMEOUT_DEF_VALUE 10000
+#define BCN_RX_TIMEOUT_MIN_VALUE 1
+#define BCN_RX_TIMEOUT_MAX_VALUE 65535
+    
+#define BROADCAST_RX_TIMEOUT_DEF_VALUE 20000
+#define BROADCAST_RX_TIMEOUT_MIN_VALUE 1 
+#define BROADCAST_RX_TIMEOUT_MAX_VALUE 65535
+
+#define RX_BROADCAST_IN_PS_DEF_VALUE 1
+#define RX_BROADCAST_IN_PS_MIN_VALUE 0
+#define RX_BROADCAST_IN_PS_MAX_VALUE 1
+
+#define CONSECUTIVE_PS_POLL_FAILURE_DEF 2
+#define CONSECUTIVE_PS_POLL_FAILURE_MIN 1
+#define CONSECUTIVE_PS_POLL_FAILURE_MAX 100
+
+#define PS_POLL_FAILURE_PERIOD_DEF 20
+#define PS_POLL_FAILURE_PERIOD_MIN 0       /* '0' is disabled */
+#define PS_POLL_FAILURE_PERIOD_MAX 60000
+
+/*---------------------------*/
+/*  Classifier parameters    */
+/*---------------------------*/
+
+/* 1 - Dtag, 2 - Port, 3 - IP & port */ 
+#define CLSFR_TYPE_MIN                          1 
+#define CLSFR_TYPE_DEF                      3
+#define CLSFR_TYPE_MAX                      3
+
+/* general values of D-tags */
+#define CLASSIFIER_DTAG_MIN                 0 
+#define CLASSIFIER_DTAG_MAX                 7
+#define CLASSIFIER_DTAG_DEF                 0 
+
+/* general values of code points in 
+the DSCP classification table*/
+#define CLASSIFIER_CODE_POINT_MIN       0 
+#define CLASSIFIER_CODE_POINT_MAX       63
+#define CLASSIFIER_CODE_POINT_DEF       0
+
+/* general values of port numbers */
+#define CLASSIFIER_PORT_MIN                 1 
+#define CLASSIFIER_PORT_MAX                 65535
+#define CLASSIFIER_PORT_DEF                 1024 
+
+/* General values of IP addresses */
+/* TBD according to spec!*/
+#define CLASSIFIER_IPADDRESS_MIN                0x0
+/* MY IP ... TBD according to spec!*/
+#define CLASSIFIER_IPADDRESS_DEF                0x0A030DC4
+/* TBD according to spec!*/
+#define CLASSIFIER_IPADDRESS_MAX                0xFFFFFFFF
+
+/* DSCP (differentiated services code 
+point) classifier parameters  
+--------------------------------*/
+/* number of classifier entries in the 
+   classification table (in case of DSCP classifier) */
+
+#define NUM_OF_CODE_POINTS_MIN              0
+#define NUM_OF_CODE_POINTS_MAX              16
+#define NUM_OF_CODE_POINTS_DEF              0
+
+/* def values of code points in the DSCP classification table*/
+#define DSCP_CLASSIFIER_CODE_POINT_DEF  0x0
+
+/* def values of D-tags in the DSCP classification table*/
+#define DSCP_CLASSIFIER_DTAG_DEF            0
+
+/* Port Classifier parameters 
+--------------------------------*/
+
+/* number of entries in the classification table (in case of destination port classifier) */
+#define NUM_OF_PORT_CLASSIFIERS_MIN         0
+#define NUM_OF_PORT_CLASSIFIERS_MAX         16
+#define NUM_OF_PORT_CLASSIFIERS_DEF         0
+
+/* def values of port numbers in the destination port classification table*/
+#define PORT_CLASSIFIER_PORT_DEF            5000
+
+/* def values of D-tags in the destination port classification table*/
+#define PORT_CLASSIFIER_DTAG_DEF            7
+
+/* IP&Port Classifier parameters 
+--------------------------------*/
+
+/* number of active entries in the 
+IP&Port classification table  */
+#define NUM_OF_IPPORT_CLASSIFIERS_MIN       0
+#define NUM_OF_IPPORT_CLASSIFIERS_MAX       16
+#define NUM_OF_IPPORT_CLASSIFIERS_DEF       0
+
+/* def values of IP addresses in the IP&Port classification table*/
+#define IPPORT_CLASSIFIER_IPADDRESS_DEF 167972292
+
+/* def values of port numbers in the IP&Port classification table*/
+#define IPPORT_CLASSIFIER_PORT_DEF      5004
+
+/* def values of D-tags in the IP&Port classification table*/
+#define IPPORT_CLASSIFIER_DTAG_DEF      7
+
+/* end of classifier parameters */
+
+#define MAX_USER_PRIORITY                       7
+
+
+
+#define  WME_ENABLED_MIN                        TI_FALSE
+#define  WME_ENABLED_MAX                        TI_TRUE
+#define  WME_ENABLED_DEF                        TI_TRUE
+
+#define  QOS_TRAFFIC_ADM_CTRL_ENABLED_MIN       TI_FALSE
+#define  QOS_TRAFFIC_ADM_CTRL_ENABLED_MAX       TI_TRUE 
+#define  QOS_TRAFFIC_ADM_CTRL_ENABLED_DEF       TI_TRUE 
+
+#define  QOS_DESIRED_PS_MODE_MIN            PS_SCHEME_LEGACY
+#define  QOS_DESIRED_PS_MODE_MAX            MAX_PS_SCHEME
+#define  QOS_DESIRED_PS_MODE_DEF            PS_SCHEME_UPSD_TRIGGER
+
+#define  QOS_TAG_ZERO_PRIO_MIN                  TI_FALSE
+#define  QOS_TAG_ZERO_PRIO_MAX                  TI_TRUE
+#define  QOS_TAG_ZERO_PRIO_DEF                  TI_TRUE
+
+
+/* for the AC */
+#define  QOS_TX_OP_CONTINUATION_MIN             0
+#define  QOS_TX_OP_CONTINUATION_MAX             1
+#define  QOS_TX_OP_CONTINUATION_DEF            1
+
+#define  QOS_TX_OP_LIMIT_MIN                   0
+#define  QOS_TX_OP_LIMIT_MAX                   32000     
+#define  QOS_TX_OP_LIMIT_DEF                   0
+
+/* for packet burst in non-qos protocol */
+#define  QOS_PACKET_BURST_ENABLE_MIN             0
+#define  QOS_PACKET_BURST_ENABLE_DEF            0
+#define  QOS_PACKET_BURST_ENABLE_MAX             1
+
+#define  QOS_PACKET_BURST_TXOP_LIMIT_MIN         0
+#define  QOS_PACKET_BURST_TXOP_LIMIT_MAX         1000     
+#define  QOS_PACKET_BURST_TXOP_LIMIT_DEF         93
+
+#define  QOS_RX_TIMEOUT_PS_POLL_MIN                0
+#define  QOS_RX_TIMEOUT_PS_POLL_MAX             200000
+#define  QOS_RX_TIMEOUT_PS_POLL_DEF                15
+
+#define  QOS_RX_TIMEOUT_UPSD_MIN                   0
+#define  QOS_RX_TIMEOUT_UPSD_MAX                200000
+#define  QOS_RX_TIMEOUT_UPSD_DEF                   15
+
+#define  QOS_MSDU_LIFE_TIME_MIN                0
+#define  QOS_MSDU_LIFE_TIME_MAX                1024
+
+#define  QOS_MSDU_LIFE_TIME_BE_MIN              QOS_MSDU_LIFE_TIME_MIN
+#define  QOS_MSDU_LIFE_TIME_BE_MAX              QOS_MSDU_LIFE_TIME_MAX
+#define  QOS_MSDU_LIFE_TIME_BE_DEF              512
+
+#define  QOS_MSDU_LIFE_TIME_BK_MIN              QOS_MSDU_LIFE_TIME_MIN
+#define  QOS_MSDU_LIFE_TIME_BK_MAX              QOS_MSDU_LIFE_TIME_MAX
+#define  QOS_MSDU_LIFE_TIME_BK_DEF              100
+
+#define  QOS_MSDU_LIFE_TIME_VI_MIN              QOS_MSDU_LIFE_TIME_MIN
+#define  QOS_MSDU_LIFE_TIME_VI_MAX              QOS_MSDU_LIFE_TIME_MAX
+#define  QOS_MSDU_LIFE_TIME_VI_DEF              100
+
+#define  QOS_MSDU_LIFE_TIME_VO_MIN              QOS_MSDU_LIFE_TIME_MIN
+#define  QOS_MSDU_LIFE_TIME_VO_MAX              QOS_MSDU_LIFE_TIME_MAX
+#define  QOS_MSDU_LIFE_TIME_VO_DEF              40
+
+#define  QOS_WME_PS_MODE_BE_MIN                 PS_SCHEME_LEGACY
+#define  QOS_WME_PS_MODE_BE_MAX                 MAX_PS_SCHEME
+#define  QOS_WME_PS_MODE_BE_DEF                 PS_SCHEME_LEGACY
+
+#define  QOS_WME_PS_MODE_BK_MIN                 PS_SCHEME_LEGACY
+#define  QOS_WME_PS_MODE_BK_MAX                 MAX_PS_SCHEME
+#define  QOS_WME_PS_MODE_BK_DEF                 PS_SCHEME_LEGACY
+
+#define  QOS_WME_PS_MODE_VI_MIN                 PS_SCHEME_LEGACY
+#define  QOS_WME_PS_MODE_VI_MAX                 MAX_PS_SCHEME
+#define  QOS_WME_PS_MODE_VI_DEF                 PS_SCHEME_LEGACY
+
+#define  QOS_WME_PS_MODE_VO_MIN                 PS_SCHEME_LEGACY
+#define  QOS_WME_PS_MODE_VO_MAX                 MAX_PS_SCHEME
+#define  QOS_WME_PS_MODE_VO_DEF                 PS_SCHEME_LEGACY
+
+
+/* 
+ * new host interface method 
+ * sum of High threshold TxBlocks > 100% of Tx blocks 
+ */
+#define  QOS_TX_BLKS_HIGH_PRCNT_MIN             0
+#define  QOS_TX_BLKS_HIGH_PRCNT_MAX             100
+
+#define  QOS_TX_BLKS_THRESHOLD_BK_DEF           0
+#define  QOS_TX_BLKS_THRESHOLD_BE_DEF           10
+#define  QOS_TX_BLKS_THRESHOLD_VI_DEF           10
+#define  QOS_TX_BLKS_THRESHOLD_VO_DEF           10
+
+#define  QOS_TX_BLKS_THRESHOLD_MIN              0
+#define  QOS_TX_BLKS_THRESHOLD_MAX              200
+
+
+#define  QOS_QID_MIN                           0
+#define  QOS_QID_MAX                           3
+
+#define  QOS_AC_MIN                            QOS_QID_MIN
+#define  QOS_AC_MAX                            QOS_QID_MAX
+
+#define  QOS_AIFS_MIN                          1
+#define  QOS_AIFS_MAX                          15
+
+#define QOS_CWMIN_MIN                          0
+#define QOS_CWMIN_MAX                          15
+
+#define QOS_CWMAX_MIN                          0
+#define QOS_CWMAX_MAX                          15
+
+#define QOS_TIMEOUT_MIN                        0
+#define QOS_TIMEOUT_MAX                        65535
+
+#define QOS_ACK_POLICY_MIN                     0
+#define QOS_ACK_POLICY_MAX                     1
+
+#define QOS_TRAFFIC_TYPE_MIN                   0
+#define QOS_TRAFFIC_TYPE_MAX                   1
+
+#define QOS_SHORT_RETRY_LIMIT_MIN              1
+#define QOS_SHORT_RETRY_LIMIT_MAX              255
+#define QOS_SHORT_RETRY_LIMIT_DEF              10
+
+#define QOS_SHORT_RETRY_LIMIT_BE_MIN            QOS_SHORT_RETRY_LIMIT_MIN
+#define QOS_SHORT_RETRY_LIMIT_BE_MAX            QOS_SHORT_RETRY_LIMIT_MAX
+#define QOS_SHORT_RETRY_LIMIT_BE_DEF            QOS_SHORT_RETRY_LIMIT_DEF
+
+#define QOS_SHORT_RETRY_LIMIT_BK_MIN            QOS_SHORT_RETRY_LIMIT_MIN
+#define QOS_SHORT_RETRY_LIMIT_BK_MAX            QOS_SHORT_RETRY_LIMIT_MAX
+#define QOS_SHORT_RETRY_LIMIT_BK_DEF            QOS_SHORT_RETRY_LIMIT_DEF
+
+#define QOS_SHORT_RETRY_LIMIT_VI_MIN            QOS_SHORT_RETRY_LIMIT_MIN
+#define QOS_SHORT_RETRY_LIMIT_VI_MAX            QOS_SHORT_RETRY_LIMIT_MAX
+#define QOS_SHORT_RETRY_LIMIT_VI_DEF            QOS_SHORT_RETRY_LIMIT_DEF
+
+#define QOS_SHORT_RETRY_LIMIT_VO_MIN            QOS_SHORT_RETRY_LIMIT_MIN
+#define QOS_SHORT_RETRY_LIMIT_VO_MAX            QOS_SHORT_RETRY_LIMIT_MAX
+#define QOS_SHORT_RETRY_LIMIT_VO_DEF            4
+
+
+#define QOS_LONG_RETRY_LIMIT_MIN               1
+#define QOS_LONG_RETRY_LIMIT_MAX               255
+#define QOS_LONG_RETRY_LIMIT_DEF               4
+
+#define QOS_LONG_RETRY_LIMIT_BE_MIN             QOS_LONG_RETRY_LIMIT_MIN
+#define QOS_LONG_RETRY_LIMIT_BE_MAX             QOS_LONG_RETRY_LIMIT_MAX
+#define QOS_LONG_RETRY_LIMIT_BE_DEF             QOS_LONG_RETRY_LIMIT_DEF
+
+#define QOS_LONG_RETRY_LIMIT_BK_MIN             QOS_LONG_RETRY_LIMIT_MIN
+#define QOS_LONG_RETRY_LIMIT_BK_MAX             QOS_LONG_RETRY_LIMIT_MAX
+#define QOS_LONG_RETRY_LIMIT_BK_DEF             QOS_LONG_RETRY_LIMIT_DEF
+
+#define QOS_LONG_RETRY_LIMIT_VI_MIN             QOS_LONG_RETRY_LIMIT_MIN
+#define QOS_LONG_RETRY_LIMIT_VI_MAX             QOS_LONG_RETRY_LIMIT_MAX
+#define QOS_LONG_RETRY_LIMIT_VI_DEF             QOS_LONG_RETRY_LIMIT_DEF
+
+#define QOS_LONG_RETRY_LIMIT_VO_MIN             QOS_LONG_RETRY_LIMIT_MIN
+#define QOS_LONG_RETRY_LIMIT_VO_MAX             QOS_LONG_RETRY_LIMIT_MAX
+#define QOS_LONG_RETRY_LIMIT_VO_DEF             QOS_LONG_RETRY_LIMIT_DEF
+
+#define QOS_QUEUE_0_OVFLOW_POLICY_MIN           DROP_NEW_PACKET
+#define QOS_QUEUE_0_OVFLOW_POLICY_MAX           DROP_OLD_PACKET
+#define QOS_QUEUE_0_OVFLOW_POLICY_DEF           DROP_NEW_PACKET
+
+#define QOS_QUEUE_1_OVFLOW_POLICY_MIN           DROP_NEW_PACKET
+#define QOS_QUEUE_1_OVFLOW_POLICY_MAX           DROP_OLD_PACKET
+#define QOS_QUEUE_1_OVFLOW_POLICY_DEF           DROP_NEW_PACKET
+
+#define QOS_QUEUE_2_OVFLOW_POLICY_MIN           DROP_NEW_PACKET
+#define QOS_QUEUE_2_OVFLOW_POLICY_MAX           DROP_OLD_PACKET
+#define QOS_QUEUE_2_OVFLOW_POLICY_DEF           DROP_NEW_PACKET
+
+#define QOS_QUEUE_3_OVFLOW_POLICY_MIN           DROP_NEW_PACKET
+#define QOS_QUEUE_3_OVFLOW_POLICY_MAX           DROP_OLD_PACKET
+#define QOS_QUEUE_3_OVFLOW_POLICY_DEF           DROP_NEW_PACKET
+
+#define QOS_ACK_POLICY_BE_MIN                   ACK_POLICY_LEGACY
+#define QOS_ACK_POLICY_BE_MAX                   MAX_ACK_POLICY
+#define QOS_ACK_POLICY_BE_DEF                   ACK_POLICY_LEGACY
+
+#define QOS_ACK_POLICY_BK_MIN                   ACK_POLICY_LEGACY
+#define QOS_ACK_POLICY_BK_MAX                   MAX_ACK_POLICY
+#define QOS_ACK_POLICY_BK_DEF                   ACK_POLICY_LEGACY
+
+#define QOS_ACK_POLICY_VI_MIN                   ACK_POLICY_LEGACY
+#define QOS_ACK_POLICY_VI_MAX                   MAX_ACK_POLICY
+#define QOS_ACK_POLICY_VI_DEF                   ACK_POLICY_LEGACY
+
+#define QOS_ACK_POLICY_VO_MIN                   ACK_POLICY_LEGACY
+#define QOS_ACK_POLICY_VO_MAX                   MAX_ACK_POLICY
+#define QOS_ACK_POLICY_VO_DEF                   ACK_POLICY_LEGACY
+
+
+/* MAX_SP_LEN_VALUES
+  00 - all buffered frames 
+  01 - 2
+  10 - 4 
+  11 - 6
+*/
+
+#define QOS_MAX_SP_LEN_MIN                      0
+#define QOS_MAX_SP_LEN_MAX                      3
+/* Means maxSpLen = 2 (changed for SoftGemini requiremnet) */
+#define QOS_MAX_SP_LEN_DEF                      1
+
+
+/*
+ * 802.11n HT settion
+ */
+#define  HT_11N_ENABLED_MIN                         TI_FALSE
+#define  HT_11N_ENABLED_MAX                         TI_TRUE
+#define  HT_11N_ENABLED_DEF                         TI_FALSE
+                                                    
+/* policies: 0 - disable, 1 - initiator, 2 - receiver, 3 -  initiator& receiver. */
+#define  HT_BA_POLICY_MIN                           0    
+#define  HT_BA_POLICY_MAX                           3
+#define  HT_BA_POLICY_DEF                           0
+
+#define  HT_BA_INACTIVITY_TIMEOUT_MIN               1    
+#define  HT_BA_INACTIVITY_TIMEOUT_MAX               0
+#define  HT_BA_INACTIVITY_TIMEOUT_DEF               10000
+
+/*---------------------------
+      ROAMING parameters
+-----------------------------*/
+#define ROAMING_MNGR_ENABLE_MIN             0
+#define ROAMING_MNGR_ENABLE_MAX             1
+#define ROAMING_MNGR_ENABLE_DEF             0
+
+#define ROAMING_MNGR_ENABLE_PERIODIC_SCAN_MIN       0
+#define ROAMING_MNGR_ENABLE_PERIODIC_SCAN_MAX       1
+#define ROAMING_MNGR_ENABLE_PERIODIC_SCAN_DEF       0
+
+#define ROAMING_MNGR_RSSI_GAP_MIN                   0
+#define ROAMING_MNGR_RSSI_GAP_MAX                   50
+#define ROAMING_MNGR_RSSI_GAP_DEF                   10
+
+#define ROAMING_MNGR_PERIODIC_SCAN_TIEMOUT_MIN      1000
+#define ROAMING_MNGR_PERIODIC_SCAN_TIEMOUT_MAX      10000
+#define ROAMING_MNGR_PERIODIC_SCAN_TIEMOUT_DEF      3000
+
+#define ROAMING_MNGR_PERIODIC_SCAN_MIN_CH_MIN       5
+#define ROAMING_MNGR_PERIODIC_SCAN_MIN_CH_MAX       60
+#define ROAMING_MNGR_PERIODIC_SCAN_MIN_CH_DEF       5
+
+#define ROAMING_MNGR_PERIODIC_SCAN_MAX_CH_MIN       5
+#define ROAMING_MNGR_PERIODIC_SCAN_MAX_CH_MAX       60
+#define ROAMING_MNGR_PERIODIC_SCAN_MAX_CH_DEF       20
+
+#define ROAMING_MNGR_PERIODIC_SCAN_ET_MODE_MIN      0
+#define ROAMING_MNGR_PERIODIC_SCAN_ET_MODE_MAX      3
+#define ROAMING_MNGR_PERIODIC_SCAN_ET_MODE_DEF      3
+
+#define ROAMING_MNGR_PERIODIC_SCAN_MAX_NUM_FRAMES_MIN       1
+#define ROAMING_MNGR_PERIODIC_SCAN_MAX_NUM_FRAMES_MAX       30
+#define ROAMING_MNGR_PERIODIC_SCAN_MAX_NUM_FRAMES_DEF       1
+
+#define ROAMING_MNGR_PERIODIC_SCAN_NUM_PROBE_REQ_MIN        1
+#define ROAMING_MNGR_PERIODIC_SCAN_NUM_PROBE_REQ_MAX        10
+#define ROAMING_MNGR_PERIODIC_SCAN_NUM_PROBE_REQ_DEF        2
+
+/*---------------------------
+    Measurement parameters
+-----------------------------*/
+
+/* Packets Per Second threshold */
+#define MEASUREMENT_TRAFFIC_THRSHLD_MIN         1
+#define MEASUREMENT_TRAFFIC_THRSHLD_MAX             1000
+#define MEASUREMENT_TRAFFIC_THRSHLD_DEF             400
+
+/* In ms */
+#define MEASUREMENT_MAX_DUR_NON_SRV_CHANNEL_MIN 1
+#define MEASUREMENT_MAX_DUR_NON_SRV_CHANNEL_MAX             1000
+#define MEASUREMENT_MAX_DUR_NON_SRV_CHANNEL_DEF             300
+
+
+/*---------------------------
+      XCC Manager parameters
+-----------------------------*/
+#define XCC_MNGR_ENABLE_MIN             XCC_MODE_DISABLED
+#define XCC_MNGR_ENABLE_MAX             XCC_MODE_STANDBY
+#define XCC_MNGR_ENABLE_DEF             XCC_MODE_ENABLED
+
+#define XCC_TEST_IGNORE_DEAUTH_0_DEF            1
+#define XCC_TEST_IGNORE_DEAUTH_0_MIN            0
+#define XCC_TEST_IGNORE_DEAUTH_0_MAX            1
+
+#define SITE_MGR_ROAMING_TX_RATE_PERCENTAGE_MIN         30
+#define SITE_MGR_ROAMING_TX_RATE_PERCENTAGE_MAX         75
+#define SITE_MGR_ROAMING_TX_RATE_PERCENTAGE_DEF         40
+
+
+#define SITE_MGR_ROAMING_RSSI_MIN                       0
+#define SITE_MGR_ROAMING_RSSI_MAX                       100
+#define SITE_MGR_ROAMING_RSSI_DEF                       80
+
+#define SITE_MGR_ROAMING_CONS_TX_ERRORS_MIN             1
+#define SITE_MGR_ROAMING_CONS_TX_ERRORS_MAX             200 
+#define SITE_MGR_ROAMING_CONS_TX_ERRORS_DEF             10
+
+/*6 sec*/
+#define SITE_MGR_POSTDISCONNECT_TIMEOUT_DEF     6000
+#define SITE_MGR_POSTDISCONNECT_TIMEOUT_MIN     1000
+#define SITE_MGR_POSTDISCONNECT_TIMEOUT_MAX     10000
+
+/* 1 seconds */                                                                
+#define CONN_SELF_TIMEOUT_MIN                   (1 * 1000)
+/* 1 minute */
+#define CONN_SELF_TIMEOUT_MAX                   (60 * 1000)
+/* 10 seconds */
+#define CONN_SELF_TIMEOUT_DEF                   (10 * 1000)
+
+#define AUTH_RESPONSE_TIMEOUT_MIN               100
+#define AUTH_RESPONSE_TIMEOUT_MAX               5000
+#define AUTH_RESPONSE_TIMEOUT_DEF               500
+
+#define AUTH_MAX_RETRY_COUNT_MIN                1
+#define AUTH_MAX_RETRY_COUNT_MAX                5
+#define AUTH_MAX_RETRY_COUNT_DEF                2
+
+#define ASSOC_RESPONSE_TIMEOUT_MIN              1000
+#define ASSOC_RESPONSE_TIMEOUT_MAX              5000
+#define ASSOC_RESPONSE_TIMEOUT_DEF              2000
+
+#define ASSOC_MAX_RETRY_COUNT_MIN               1
+#define ASSOC_MAX_RETRY_COUNT_MAX               5
+#define ASSOC_MAX_RETRY_COUNT_DEF               2
+
+#define RX_DATA_FILTERS_ENABLED_MIN             TI_FALSE
+#define RX_DATA_FILTERS_ENABLED_MAX             TI_TRUE
+#define RX_DATA_FILTERS_ENABLED_DEF             TI_FALSE
+
+#define RX_DATA_FILTERS_DEFAULT_ACTION_MIN      FILTER_DROP
+#define RX_DATA_FILTERS_DEFAULT_ACTION_MAX      FILTER_FW_HANDLE
+#define RX_DATA_FILTERS_DEFAULT_ACTION_DEF      FILTER_DROP
+
+#define RX_DATA_FILTERS_FILTER_OFFSET_DEF       0
+#define RX_DATA_FILTERS_FILTER_OFFSET_MIN       0
+#define RX_DATA_FILTERS_FILTER_OFFSET_MAX       255
+
+#define RX_DATA_FILTERS_FILTER_MASK_DEF         ""
+#define RX_DATA_FILTERS_FILTER_MASK_LEN_DEF     0
+
+#define RX_DATA_FILTERS_FILTER_PATTERN_DEF      ""
+#define RX_DATA_FILTERS_FILTER_PATTERN_LEN_DEF  0
+
+#define TX_DATA_CREDIT_CALC_TIMOEUT_DEF         100
+#define TX_DATA_CREDIT_CALC_TIMOEUT_MIN         20
+#define TX_DATA_CREDIT_CALC_TIMOEUT_MAX         1000
+
+#define TRAFFIC_ADM_CONTROL_TIMEOUT_MIN         10
+#define TRAFFIC_ADM_CONTROL_TIMEOUT_MAX         10000
+#define TRAFFIC_ADM_CONTROL_TIMEOUT_DEF         5000
+
+/* Traffic intensity threshold - Measured in packets */
+#define CTRL_DATA_TRAFFIC_THRESHOLD_HIGH_MIN    1
+#define CTRL_DATA_TRAFFIC_THRESHOLD_HIGH_MAX    1000
+#define CTRL_DATA_TRAFFIC_THRESHOLD_HIGH_DEF    100
+
+/* Traffic intensity threshold - Measured in packets */
+#define CTRL_DATA_TRAFFIC_THRESHOLD_LOW_MIN     1
+#define CTRL_DATA_TRAFFIC_THRESHOLD_LOW_MAX     1000
+#define CTRL_DATA_TRAFFIC_THRESHOLD_LOW_DEF     25
+
+/* Traffic intensity threshold - Traffic test interval - measured in ms */
+#define CTRL_DATA_TRAFFIC_THRESHOLD_INTERVAL_MIN   50
+#define CTRL_DATA_TRAFFIC_THRESHOLD_INTERVAL_MAX   10000
+#define CTRL_DATA_TRAFFIC_THRESHOLD_INTERVAL_DEF   1000
+
+#define CTRL_DATA_TRAFFIC_THRESHOLD_ENABLED_MIN TI_FALSE
+#define CTRL_DATA_TRAFFIC_THRESHOLD_ENABLED_MAX TI_TRUE
+#define CTRL_DATA_TRAFFIC_THRESHOLD_ENABLED_DEF TI_FALSE
+
+#define TRAFFIC_MONITOR_MIN_INTERVAL_PERCENT_MIN   10
+#define TRAFFIC_MONITOR_MIN_INTERVAL_PERCENT_MAX   90
+#define TRAFFIC_MONITOR_MIN_INTERVAL_PERCENT_DEF   50
+
+#define CTRL_DATA_CONT_TX_THRESHOLD_MIN  2
+#define CTRL_DATA_CONT_TX_THRESHOLD_MAX  256
+#define CTRL_DATA_CONT_TX_THRESHOLD_DEF  30
+
+#define CTRL_DATA_STEP_UP_TX_THRESHOLD_MIN    2
+#define CTRL_DATA_STEP_UP_TX_THRESHOLD_MAX    256
+#define CTRL_DATA_STEP_UP_TX_THRESHOLD_DEF    10
+
+#define CTRL_DATA_FB_SHORT_INTERVAL_MIN         20
+#define CTRL_DATA_FB_SHORT_INTERVAL_MAX         2000
+#define CTRL_DATA_FB_SHORT_INTERVAL_DEF         50
+
+#define CTRL_DATA_FB_LONG_INTERVAL_MIN          100
+#define CTRL_DATA_FB_LONG_INTERVAL_MAX          10000
+#define CTRL_DATA_FB_LONG_INTERVAL_DEF          2000
+
+#define RATE_ADAPTATION_TIMEOUT_MIN             1
+#define RATE_ADAPTATION_TIMEOUT_MAX             3600
+#define RATE_ADAPTATION_TIMEOUT_DEF             300
+
+#define RATE_ADAPT_HIGH_TRSH_AC_VO_MIN          0
+#define RATE_ADAPT_HIGH_TRSH_AC_VO_MAX          54  
+#define RATE_ADAPT_HIGH_TRSH_AC_VO_DEF          0
+
+#define RATE_ADAPT_HIGH_TRSH_AC_VI_MIN          0
+#define RATE_ADAPT_HIGH_TRSH_AC_VI_MAX          54  
+#define RATE_ADAPT_HIGH_TRSH_AC_VI_DEF          0
+
+#define RATE_ADAPT_HIGH_TRSH_AC_BE_MIN          0
+#define RATE_ADAPT_HIGH_TRSH_AC_BE_MAX          54  
+#define RATE_ADAPT_HIGH_TRSH_AC_BE_DEF          0
+
+#define RATE_ADAPT_HIGH_TRSH_AC_BK_MIN          0
+#define RATE_ADAPT_HIGH_TRSH_AC_BK_MAX          54  
+#define RATE_ADAPT_HIGH_TRSH_AC_BK_DEF          0
+
+#define RATE_ADAPT_LOW_TRSH_AC_VO_MIN           0
+#define RATE_ADAPT_LOW_TRSH_AC_VO_MAX           54  
+#define RATE_ADAPT_LOW_TRSH_AC_VO_DEF           0
+
+#define RATE_ADAPT_LOW_TRSH_AC_VI_MIN           0
+#define RATE_ADAPT_LOW_TRSH_AC_VI_MAX           54  
+#define RATE_ADAPT_LOW_TRSH_AC_VI_DEF           0
+
+#define RATE_ADAPT_LOW_TRSH_AC_BE_MIN           0
+#define RATE_ADAPT_LOW_TRSH_AC_BE_MAX           54  
+#define RATE_ADAPT_LOW_TRSH_AC_BE_DEF           0
+
+#define RATE_ADAPT_LOW_TRSH_AC_BK_MIN           0
+#define RATE_ADAPT_LOW_TRSH_AC_BK_MAX           54  
+#define RATE_ADAPT_LOW_TRSH_AC_BK_DEF           0
+
+#define CTRL_DATA_RATE_CONTROL_ENABLE_MIN       TI_FALSE
+#define CTRL_DATA_RATE_CONTROL_ENABLE_MAX       TI_TRUE
+#define CTRL_DATA_RATE_CONTROL_ENABLE_DEF       TI_FALSE
+
+#define CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_MIN 1
+#define CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_MAX 255
+#define CTRL_DATA_RATE_POLICY_USER_SHORT_RETRY_LIMIT_DEF 10
+
+#define CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_MIN 1  
+#define CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_MAX 255
+#define CTRL_DATA_RATE_POLICY_USER_LONG_RETRY_LIMIT_DEF 4  
+
+#define CTRL_DATA_RATE_POLICY_USER_RETRIES_PER_RATE_CCK_DEF		"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1"
+#define CTRL_DATA_RATE_POLICY_USER_RETRIES_PER_RATE_PBCC_DEF	"0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,1"
+#define CTRL_DATA_RATE_POLICY_USER_RETRIES_PER_RATE_OFDM_DEF	"0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,1,1,1"
+#define CTRL_DATA_RATE_POLICY_USER_RETRIES_PER_RATE_OFDMA_DEF	"0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0"
+#define CTRL_DATA_RATE_POLICY_USER_RETRIES_PER_RATE_OFDMN_DEF	"1,1,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,0,1,1,1"
+
+#define CTRL_DATA_RATE_POLICY_SG_SHORT_RETRY_LIMIT_MIN 1
+#define CTRL_DATA_RATE_POLICY_SG_SHORT_RETRY_LIMIT_MAX 255
+#define CTRL_DATA_RATE_POLICY_SG_SHORT_RETRY_LIMIT_DEF 10
+
+#define CTRL_DATA_RATE_POLICY_SG_LONG_RETRY_LIMIT_MIN 1  
+#define CTRL_DATA_RATE_POLICY_SG_LONG_RETRY_LIMIT_MAX 255
+#define CTRL_DATA_RATE_POLICY_SG_LONG_RETRY_LIMIT_DEF 4  
+
+#define CTRL_DATA_RATE_POLICY_SG_RETRIES_PER_RATE_CCK_DEF	"0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,1,1,1"
+#define CTRL_DATA_RATE_POLICY_SG_RETRIES_PER_RATE_PBCC_DEF	"0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,5,0,0,1,1,1"
+#define CTRL_DATA_RATE_POLICY_SG_RETRIES_PER_RATE_OFDM_DEF	"0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,5,1,1,1,1,1"
+#define CTRL_DATA_RATE_POLICY_SG_RETRIES_PER_RATE_OFDMA_DEF	"0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,0,1,1,0,0,0"
+#define CTRL_DATA_RATE_POLICY_SG_RETRIES_PER_RATE_OFDMN_DEF	"1,1,1,1,1,1,1,1,0,0,0,1,0,0,1,0,0,0,1,1,1"
+
+#define CTRL_DATA_RATE_POLICY_RETRIES_PER_RATE_MAX_LEN 100
+
+#define REPORT_SEVERITY_VALUE_MIN               0
+#define REPORT_SEVERITY_VALUE_MAX               0xFF
+/* WLAN_SEVERITY_WARNING | WLAN_SEVERITY_ERROR | WLAN_SEVERITY_FATAL_ERROR | WLAN_SEVERITY_CONSOLE */
+#define REPORT_SEVERITY_VALUE_DEF               0xB8
+
+#define RSN_AUTH_SUITE_MIN                      RSN_AUTH_OPEN
+#define RSN_AUTH_SUITE_MAX                      RSN_AUTH_NONE
+#define RSN_AUTH_SUITE_DEF                      RSN_AUTH_OPEN
+
+#define RSN_DEFAULT_KEY_ID_MIN                  0
+#define RSN_DEFAULT_KEY_ID_MAX                  (DOT11_MAX_DEFAULT_WEP_KEYS - 1)
+#define RSN_DEFAULT_KEY_ID_DEF                  0
+
+/* 1 sec */
+#define RSN_PMKSA_LIFETIME_MIN                  1
+/* 49 days in sec */
+#define RSN_PMKSA_LIFETIME_MAX                  4233600
+/* 1 day in sec */
+#define RSN_PMKSA_LIFETIME_DEF                  86400
+
+#define RSN_WEP_STATUS_MIN                      0
+#define RSN_WEP_STATUS_MAX                      1
+#define RSN_WEP_STATUS_DEF                      0
+
+#define RSN_WEPMIXEDMODE_ENABLED_MIN                    0
+#define RSN_WEPMIXEDMODE_ENABLED_MAX                    1
+#define RSN_WEPMIXEDMODE_ENABLED_DEF                    0
+
+#define RSN_WPAMIXEDMODE_ENABLE_MIN             0
+#define RSN_WPAMIXEDMODE_ENABLE_MAX             1
+#define RSN_WPAMIXEDMODE_ENABLE_DEF             1
+
+#define RSN_PREAUTH_ENABLE_MIN                  0
+#define RSN_PREAUTH_ENABLE_MAX                  1
+#define RSN_PREAUTH_ENABLE_DEF                  1
+
+/* In mSec units */
+#define RSN_PREAUTH_TIMEOUT_MIN                  500
+#define RSN_PREAUTH_TIMEOUT_MAX                  60000
+#define RSN_PREAUTH_TIMEOUT_DEF                 2000
+
+#define  RSN_PMKIDCANDLIST_DELAY_MIN            3000
+#define  RSN_PMKIDCANDLIST_DELAY_MAX            9000
+#define  RSN_PMKIDCANDLIST_DELAY_DEF            4000
+
+
+#define ETHER_MAX_PAYLOAD_SIZE            1500
+
+
+#define RATE_MGMT_INVERSE_CURIOSITY_FACTOR_VOICE        2            /* 1 / (1 << INVERSE_CURIOSITY_FACTOR) */
+#define RATE_MGMT_INVERSE_CURIOSITY_FACTOR_OTHER        2            /* 1 / (1 << INVERSE_CURIOSITY_FACTOR) */
+#define RATE_MGMT_PER_WEIGHT_SHIFT_VOICE                0            /* 2^(-RATE_MGMT_PER_WEIGHT_SHIFT) */
+#define RATE_MGMT_PER_WEIGHT_SHIFT_OTHER                8            /* 2^(-RATE_MGMT_PER_WEIGHT_SHIFT) */
+#define RATE_MGMT_TP_WEIGHT_SHIFT_VOICE                 5            /* 2^(RATE_MGMT_TP_WEIGHT_SHIFT) */
+#define RATE_MGMT_TP_WEIGHT_SHIFT_OTHER                 0            /* 2^(RATE_MGMT_TP_WEIGHT_SHIFT) */
+/* As this value is decreased - Curiosity will have a larger impact */
+#define RATE_MGMT_TX_FAIL_LOW_TH                        4
+#define RATE_MGMT_TX_FAIL_HIGH_TH                       10
+#define RATE_MGMT_RATE_RETRY_SCORE                      4095
+#define RATE_MGMT_PER_ALPHA_SHIFT                       4            /* log2(16) */
+#define RATE_MGMT_PER_ADD_SHIFT                         13           /* log2(PER_ADD) */
+#define RATE_MGMT_PER_ADD (1<<RATE_MGMT_PER_ADD_SHIFT)
+#define RATE_MGMT_PER_BETA1_SHIFT                       10
+#define RATE_MGMT_PER_BETA2_SHIFT                       8
+#define RATE_MGMT_PER_TH1                               7000         /* 25% */
+#define RATE_MGMT_PER_TH2                               4096         /* 50% */
+#define RATE_MGMT_MAX_PER                               8100         /* MUST BE LESS THAN 100% */
+#define RATE_MGMT_RATE_CHECK_UP                         2                     
+#define RATE_MGMT_RATE_CHECK_DOWN                       4
+#define RATE_MGMT_MAX_CURIOSITY                         4095
+#define RATE_MGMT_ALL_PARAMS                            0xff
+
+/* SME Values */
+#define SME_SCAN_RSSI_THRESHOLD_MIN             -100
+#define SME_SCAN_RSSI_THRESHOLD_MAX             0
+#define SME_SCAN_RSSI_THRESHOLD_DEF             "-97"
+#define SME_SCAN_RSSI_THRESHOLD_DEF_NUM         -97
+
+#define SME_SCAN_SNR_THRESHOLD_MIN              -5
+#define SME_SCAN_SNR_THRESHOLD_MAX              20
+#define SME_SCAN_SNR_THRESHOLD_DEF              "0"
+#define SME_SCAN_SNR_THRESHOLD_DEF_NUM          0
+
+#define SME_SCAN_CYCLES_MIN                     0
+#define SME_SCAN_CYCLES_MAX                     100
+#define SME_SCAN_CYCLES_DEF                     50
+
+#define SME_SCAN_MAX_DWELL_MIN                  5     /* in milli-seconds */
+#define SME_SCAN_MAX_DWELL_MAX                  500
+#define SME_SCAN_MAX_DWELL_DEF                  60
+
+#define SME_SCAN_MIN_DWELL_MIN                  5     /* in milli-seconds */
+#define SME_SCAN_MIN_DWELL_MAX                  500
+#define SME_SCAN_MIN_DWELL_DEF                  30
+
+#define SME_SCAN_PROBE_REQ_MIN                  1
+#define SME_SCAN_PROBE_REQ_MAX                  10
+#define SME_SCAN_PROBE_REQ_DEF                  3
+
+#define SME_SCAN_INTERVALS_LIST_VAL_DEF         "0,1000,2000,3000,4000,8000,16000,32000,64000,128000,256000,512000,512000,512000,512000,512000"
+#define SME_SCAN_INTERVALS_LIST_STRING_MAX_SIZE 255
+
+#define SME_SCAN_CHANNELS_LIST_G_VAL_DEF        "1,2,3,4,5,6,7,8,9,10,11,12,13,14"
+#define SME_SCAN_CHANNELS_LIST_G_STRING_MAX_SIZE 255
+
+#define SME_SCAN_CHANNELS_LIST_A_VAL_DEF        "36,40,44,48,52,56,60,64"
+#define SME_SCAN_CHANNELS_LIST_A_STRING_MAX_SIZE 255
+
+/* Scan SRV parameters */
+#define SCAN_SRV_NUMBER_OF_NO_SCAN_COMPLETE_TO_RECOVERY_DEF     3
+#define SCAN_SRV_NUMBER_OF_NO_SCAN_COMPLETE_TO_RECOVERY_MIN     1
+#define SCAN_SRV_NUMBER_OF_NO_SCAN_COMPLETE_TO_RECOVERY_MAX     1000000
+
+#define SCAN_SRV_TRIGGERED_SCAN_TIME_OUT_DEF        50000
+#define SCAN_SRV_TRIGGERED_SCAN_TIME_OUT_MIN        0
+#define SCAN_SRV_TRIGGERED_SCAN_TIME_OUT_MAX        0xffffffff
+
+
+/*
+  EEPROM-less support
+*/
+#define REG_MAC_ADDR_STR_LEN                    17
+#define REG_ARP_IP_ADDR_STR_LEN                 11
+#define REG_MAC_ADDR_PREAMBLE_STR_LEN           9
+
+#define TWD_EEPROMLESS_ENABLE_DEF               1
+#define TWD_EEPROMLESS_ENABLE_MIN               0
+#define TWD_EEPROMLESS_ENABLE_MAX               1
+
+/* Scanning Channel Values */
+#define MAX_CHAN_BITMAP_BYTES                   26
+
+#define MAX_CHANNEL_IN_BAND_2_4                 14
+
+#define SCAN_CONTROL_TABLE_ENTRY_MIN            0x00
+#define SCAN_CONTROL_TABLE_ENTRY_MAX            0xff
+#define SCAN_CONTROL_TABLE_ENTRY_DEF            0xff
+
+/* country code reset time out */
+/* 1 sec   */
+#define REGULATORY_DOMAIN_COUNTRY_TIME_RESET_MIN     1000
+/* 1 day */
+#define REGULATORY_DOMAIN_COUNTRY_TIME_RESET_MAX     86400000
+/* 30 minutes  */
+#define REGULATORY_DOMAIN_COUNTRY_TIME_RESET_DEF     3600000
+
+/* d/h Enabling */
+
+/* 802.11d */
+#define MULTI_REGULATORY_DOMAIN_ENABLED_MIN     TI_FALSE
+#define MULTI_REGULATORY_DOMAIN_ENABLED_MAX     TI_TRUE
+#define MULTI_REGULATORY_DOMAIN_ENABLED_DEF     TI_FALSE
+
+/* 802.11h */
+#define SPECTRUM_MANAGEMENT_ENABLED_MIN         TI_FALSE
+#define SPECTRUM_MANAGEMENT_ENABLED_MAX         TI_TRUE
+#define SPECTRUM_MANAGEMENT_ENABLED_DEF         TI_FALSE
+
+/* Tx Power table (Power level to Dbm)*/
+#define TX_POWER_LEVEL_TABLE_24                 "21,13,10,7"
+#define TX_POWER_LEVEL_TABLE_5                  "20,12,9,6" 
+
+/* Scan concentrator init parameters - number of entries in app scan result table */
+#define SCAN_CNCN_MIN_DURATION_FOR_OS_SCANS_DEF 5
+#define SCAN_CNCN_MIN_DURATION_FOR_OS_SCANS_MIN 0
+#define SCAN_CNCN_MIN_DURATION_FOR_OS_SCANS_MAX 3600
+
+#define SCAN_CNCN_REGULATORY_DOMAIN_PASSIVE_DWELL_TIME_DEF    150
+
+#define SCAN_CNCN_DFS_PASSIVE_DWELL_TIME_DEF    150
+#define SCAN_CNCN_DFS_PASSIVE_DWELL_TIME_MIN    10
+#define SCAN_CNCN_DFS_PASSIVE_DWELL_TIME_MAX    500
+
+/* Current BSS init paramaters - keep alive default interval */
+#define NULL_KL_PERIOD_DEF      10
+#define NULL_KL_PERIOD_MIN      0
+#define NULL_KL_PERIOD_MAX      3600       
+
+/* WSC */
+#define WSC_PARSE_IN_BEACON_DEF 1
+#define WSC_PARSE_IN_BEACON_MIN 0
+#define WSC_PARSE_IN_BEACON_MAX 1
+
+/* Packet Filtering Define */
+#define MIN_NUM_OF_BEACONS_IN_BUFFER 1
+#define DEF_NUM_OF_BEACONS_IN_BUFFER 5
+#define MAX_NUM_OF_BEACONS_IN_BUFFER 10
+
+/* Soft Gemini Enabling */
+#define SOFT_GEMINI_ENABLED_MIN                 SG_ENABLE
+#define SOFT_GEMINI_ENABLED_MAX                 SG_OPPORTUNISTIC_MODE
+#define SOFT_GEMINI_ENABLED_DEF                 SG_DISABLE
+
+#define SOFT_GEMINI_PARAMS_LOAD_RATIO_MIN				1
+#define SOFT_GEMINI_PARAMS_LOAD_RATIO_MAX				100
+#define SOFT_GEMINI_PARAMS_LOAD_RATIO_DEF				50
+
+#define SOFT_GEMINI_PARAMS_AUTO_PS_MODE_MIN				0
+#define SOFT_GEMINI_PARAMS_AUTO_PS_MODE_MAX				1
+#define SOFT_GEMINI_PARAMS_AUTO_PS_MODE_DEF				1
+
+#define SOFT_GEMINI_PARAMS_AUTO_SCAN_PROBE_REQ_MIN		0
+#define SOFT_GEMINI_PARAMS_AUTO_SCAN_PROBE_REQ_MAX		255
+#define SOFT_GEMINI_PARAMS_AUTO_SCAN_PROBE_REQ_DEF		50
+
+#define SOFT_GEMINI_PARAMS_AUTO_SCAN_WINDOW_MIN			0
+#define SOFT_GEMINI_PARAMS_AUTO_SCAN_WINDOW_MAX			255
+#define SOFT_GEMINI_PARAMS_AUTO_SCAN_WINDOW_DEF			50
+
+#define WIFI_WMM_PS_MIN                         0  
+#define WIFI_WMM_PS_MAX                         1
+#define WIFI_WMM_PS_DEF                         0 
+#define SOFT_GEMINI_PARAMS_ALLOW_PA_SD_MIN                  (0)  
+#define SOFT_GEMINI_PARAMS_ALLOW_PA_SD_MAX                  (1)
+#define SOFT_GEMINI_PARAMS_ALLOW_PA_SD_DEF                  (1) 
+
+#define SOFT_GEMINI_PARAMS_TIME_BEFORE_BEACON_MIN           (0)  
+#define SOFT_GEMINI_PARAMS_TIME_BEFORE_BEACON_MAX           (20000)
+#define SOFT_GEMINI_PARAMS_TIME_BEFORE_BEACON_DEF           (6300) 
+
+#define SOFT_GEMINI_PARAMS_HPDM_MAX_GUARD_MIN           (0)  
+#define SOFT_GEMINI_PARAMS_HPDM_MAX_GUARD_MAX           (50000)
+#define SOFT_GEMINI_PARAMS_HPDM_MAX_GUARD_DEF           (1050) 
+
+#define SOFT_GEMINI_PARAMS_TIME_OUT_NEXT_WLAN_MIN           (100)  
+#define SOFT_GEMINI_PARAMS_TIME_OUT_NEXT_WLAN_MAX           (50000)
+#define SOFT_GEMINI_PARAMS_TIME_OUT_NEXT_WLAN_DEF           (2550) 
+
+#define SOFT_GEMINI_PARAMS_AUTO_MODE_NO_CTS_MIN         (0)  
+#define SOFT_GEMINI_PARAMS_AUTO_MODE_NO_CTS_MAX         (1)
+#define SOFT_GEMINI_PARAMS_AUTO_MODE_NO_CTS_DEF         (0) 
+
+#define SOFT_GEMINI_PARAMS_BT_HP_RESPECTED_MIN          (0)  
+#define SOFT_GEMINI_PARAMS_BT_HP_RESPECTED_MAX          (20)
+#define SOFT_GEMINI_PARAMS_BT_HP_RESPECTED_DEF          (3) 
+
+#define SOFT_GEMINI_PARAMS_WLAN_RX_MIN_RATE_MIN         (0)  
+#define SOFT_GEMINI_PARAMS_WLAN_RX_MIN_RATE_MAX         (54)
+#define SOFT_GEMINI_PARAMS_WLAN_RX_MIN_RATE_DEF         (24) 
+
+/* FM Coexistence */
+#define FM_COEX_ENABLE_DEF                             TI_TRUE 
+#define FM_COEX_ENABLE_MIN                             TI_FALSE  
+#define FM_COEX_ENABLE_MAX                             TI_TRUE 
+
+#define FM_COEX_SWALLOW_PERIOD_DEF                     0xFF
+#define FM_COEX_SWALLOW_PERIOD_MIN                     0
+#define FM_COEX_SWALLOW_PERIOD_MAX                     0xFF
+
+#define FM_COEX_N_DIVIDER_FREF_SET1_DEF                0xFF
+#define FM_COEX_N_DIVIDER_FREF_SET1_MIN                0
+#define FM_COEX_N_DIVIDER_FREF_SET1_MAX                0xFF
+
+#define FM_COEX_N_DIVIDER_FREF_SET2_DEF                0xFF                  
+#define FM_COEX_N_DIVIDER_FREF_SET2_MIN                0   
+#define FM_COEX_N_DIVIDER_FREF_SET2_MAX                0xFF
+
+#define FM_COEX_M_DIVIDER_FREF_SET1_DEF                0xFFFF   
+#define FM_COEX_M_DIVIDER_FREF_SET1_MIN                0   
+#define FM_COEX_M_DIVIDER_FREF_SET1_MAX                0xFFFF
+
+#define FM_COEX_M_DIVIDER_FREF_SET2_DEF                0xFFFF 
+#define FM_COEX_M_DIVIDER_FREF_SET2_MIN                0    
+#define FM_COEX_M_DIVIDER_FREF_SET2_MAX                0xFFFF
+
+#define FM_COEX_PLL_STABILIZATION_TIME_DEF             0xFFFFFFFF 
+#define FM_COEX_PLL_STABILIZATION_TIME_MIN             0
+#define FM_COEX_PLL_STABILIZATION_TIME_MAX             0xFFFFFFFF
+
+#define FM_COEX_LDO_STABILIZATION_TIME_DEF             0xFFFF
+#define FM_COEX_LDO_STABILIZATION_TIME_MIN             0
+#define FM_COEX_LDO_STABILIZATION_TIME_MAX             0xFFFF
+
+#define FM_COEX_DISTURBED_BAND_MARGIN_DEF              0xFF
+#define FM_COEX_DISTURBED_BAND_MARGIN_MIN              0
+#define FM_COEX_DISTURBED_BAND_MARGIN_MAX              0xFF
+
+#define FM_COEX_SWALLOW_CLK_DIF_DEF                    0xFF
+#define FM_COEX_SWALLOW_CLK_DIF_MIN                    0
+#define FM_COEX_SWALLOW_CLK_DIF_MAX                    0xFF
+
+
+/* Configurable Scan Rate */
+#define SCAN_RATE_MODE_B_MIN                    DRV_RATE_1M
+#define SCAN_RATE_MODE_B_MAX                    DRV_RATE_11M
+#define SCAN_RATE_MODE_B_DEF                    DRV_RATE_2M
+
+#define SCAN_RATE_MODE_G_MIN                    DRV_RATE_1M
+#define SCAN_RATE_MODE_G_MAX                    DRV_RATE_54M
+#define SCAN_RATE_MODE_G_DEF                    DRV_RATE_2M
+
+#define SCAN_RATE_MODE_A_MIN                    DRV_RATE_6M
+#define SCAN_RATE_MODE_A_MAX                    DRV_RATE_54M
+#define SCAN_RATE_MODE_A_DEF                    DRV_RATE_6M
+
+/* Probe request number during scan */
+#define SCAN_PROBE_REQ_NUMBER_MIN   1
+#define SCAN_PROBE_REQ_NUMBER_MAX   7
+#define SCAN_PROBE_REQ_NUMBER_DEF   3
+
+
+#define ACX_64BITS_WEP_KEY_LENGTH_BYTES         5
+#define ACX_128BITS_WEP_KEY_LENGTH_BYTES        13
+#define ACX_256BITS_WEP_KEY_LENGTH_BYTES        29
+#define ACX_MAX_WEP_KEY_LENGTH_BYTES            29
+
+
+/* Configurable radio parameters */
+#define RADIO_TX_BIP_VOLTAGE_DEF_TABLE                      "ff,02,03,04,05,06,07,08"
+#define RADIO_TX_BIP_POWER_DEF_TABLE                        "f9,0a,0b,0c,0d,0e,0f,10"
+#define RADIO_TX_PER_POWER_LIMITS_2_4_NORMAL_DEF_TABLE      "f1,12,13,14,15,16"
+#define RADIO_TX_PER_POWER_LIMITS_2_4_DEGRADED_DEF_TABLE    "f7,18,19,1a,1b,1c"
+#define RADIO_TX_PER_POWER_LIMITS_5_NORMAL_DEF_TABLE        "fe,ad,be,ef,21,22"
+#define RADIO_TX_PER_POWER_LIMITS_5_DEGRADED_DEF_TABLE      "f3,24,25,26,27,28"
+#define RADIO_TX_PER_POWER_LIMITS_2_4_11B_DEF_TABLE         "f9,2a,2b,2c,2d,2e,2f,30,31,32,33,34,35,36"
+#define RADIO_TX_PER_POWER_LIMITS_2_4_OFDM_DEF_TABLE        "f7,38,39,3a,3b,3c,3d,3e,3f,40,41,42,43,44"
+#define RADIO_TX_PER_POWER_LIMITS_5_OFDM_DEF_TABLE          "f5,46,47,48,49,4a,4b,4c,4d,4e,4f,50,51,52,53,54,55,56,57,58,59,5a,5b,5c,5d,5e,5f,60,61,62,63,64,65,66"
+#define RADIO_TX_PA_GAIN_VS_BIAS_OFFSET_2_4_DEF_TABLE       "f3,54,55,56,57,58"
+#define RADIO_TX_PA_GAIN_VS_BIAS_OFFSET_5_DEF_TABLE         "f9,5a,5b,5c,5d,5e"
+#define RADIO_TX_PD_VS_RATE_OFFSET_2_4_DEF_TABLE            "ff,60,61,62,63,64"
+#define RADIO_TX_PD_VS_RATE_OFFSET_5_DEF_TABLE              "f5,66,67,68,69,6a"
+#define RADIO_TX_BIAS_2_4_DEF_TABLE                         "fb,6c,6d,6e,6f,70"
+#define RADIO_TX_BIAS_5_DEF_TABLE                           "f1,72,73,74,75,76"
+
+#define RADIO_RX_FEM_INSERT_LOSS_2_4_MIN                    0
+#define RADIO_RX_FEM_INSERT_LOSS_2_4_DEF                    247
+#define RADIO_RX_FEM_INSERT_LOSS_2_4_MAX                    255
+
+#define RADIO_RX_FEM_INSERT_LOSS_5_MIN                      0
+#define RADIO_RX_FEM_INSERT_LOSS_5_DEF                      248
+#define RADIO_RX_FEM_INSERT_LOSS_5_MAX                      255
+
+#define RADIO_RX_TRACE_INSERT_LOSS_2_4_MIN                  0
+#define RADIO_RX_TRACE_INSERT_LOSS_2_4_DEF                  249
+#define RADIO_RX_TRACE_INSERT_LOSS_2_4_MAX                  255
+
+#define RADIO_RX_TRACE_INSERT_LOSS_5_MIN                    0
+#define RADIO_RX_TRACE_INSERT_LOSS_5_DEF                    122
+#define RADIO_RX_TRACE_INSERT_LOSS_5_MAX                    255
+
+#define RADIO_RX_RSSI_PROCESS_2_4_DEF_TABLE                 "7a,7b,7c,7d,7e,7f,80,81,82,83,84,85,86,87,88"
+#define RADIO_RX_RSSI_PROCESS_5_DEF_TABLE                   "f9,8a,8b,8c,8d,8e,8f,90,91,92,93,94,95,96,97"
+
+#define RADIO_FREF_CLOCK_SETTING_TIME_MIN    				0
+#define RADIO_FREF_CLOCK_SETTING_TIME_DEF    				5
+#define RADIO_FREF_CLOCK_SETTING_TIME_MAX    				15
+
+#define RADIO_FREF_CLOCK_ENABLED_MIN                        TI_FALSE
+#define RADIO_FREF_CLOCK_ENABLED_MAX                        TI_TRUE
+#define RADIO_FREF_CLOCK_ENABLED_DEF                        TI_FALSE
+
+#define RADIO_FREF_CLOCK_MIN                        		0x2b00	/* 19.2 MHz */
+#define RADIO_FREF_CLOCK_DEF                        		0x2b10	/* 38.4 MHz */
+#define RADIO_FREF_CLOCK_MAX                        		0x2b11	/* 52 MHz */
+
+/*****************************************************************************
+ **         RADIO MODULE REGISTRY DEFINITIONS                       		**
+ *****************************************************************************/
+
+typedef enum
+{
+    RADIO_FREF_19_2		= RADIO_FREF_CLOCK_MIN,
+    RADIO_FREF_26   	= 0x2b01,
+    RADIO_FREF_38_4   	= RADIO_FREF_CLOCK_DEF,
+    RADIO_FREF_52   	= RADIO_FREF_CLOCK_MAX,
+
+    RADIO_FREF_LAST   	= 0xFFFF	/* Dummy, must be last!!!	*/
+
+} Radio_FRefClock_e;
+
+/*****************************************************************************
+ **         POWER MANAGER MODULE REGISTRY DEFINITIONS                       **
+ *****************************************************************************/
+/** \enum PowerMode_e */
+/* MUST be sync with OS_802_11_POWER_PROFILE */
+typedef enum 
+{
+    POWER_MODE_AUTO,        /**< In this mode the power manager module is toggle states
+                             * (ACTIVE, SHORT_DOZE and LONG_DOZE) by its own inner algorithm.
+                             */
+
+    POWER_MODE_ACTIVE,      /**< In this mode there is no power save, the host interface & the radio
+                             * is always active. The TNET is constantly awake. This mode is used,
+                             * for example, when the device is powered from an AC power source,
+                             * and provides maximum throughput and minimal latency.
+                             */
+
+    POWER_MODE_SHORT_DOZE,  /**< In this mode the system is going to ELP state and awakes (by the
+                             * FW) every beacon. The F/W wakes up the host on every Beacon passes
+                             * the Beacon to the driver and returns to ELP Doze as soon as possible.
+                             */
+
+    POWER_MODE_LONG_DOZE,    /**< In this mode the system is going to ELP state and awakes (by the
+                             * FW) every DTIM or listen interval. This mode consumes low power,
+                             * while still waking-up for Beacons once in a while. The system spends
+                             * a lot of time in ELP-Doze, and the F/W rarely wakes up the host.
+                             */
+
+    POWER_MODE_PS_ONLY,     /**< In this mode the system is setting the Ps as ON. 
+                             * the ELP state is changing to SHORT or LONG DOZE (According to last configuration). 
+                             * Auto mode won't be used here.
+                             */
+
+    POWER_MODE_MAX
+}PowerMgr_PowerMode_e;
+
+
+/** \enum PowerMgr_Priority_e */
+typedef enum 
+{
+    POWER_MANAGER_USER_PRIORITY,           /**< indicates the default user priority. */
+    POWER_MANAGER_SG_PRIORITY,             /**< Indicate the Soft Gemini priority */
+    POWER_MANAGER_PS_POLL_FAILURE_PRIORITY,/**< After receiving the PsPoll failure event */
+    POWER_MANAGER_MAX_PRIORITY                                                      
+}PowerMgr_Priority_e;
+
+
+enum PowerMgr_registryDefinitions
+{
+    POWER_MODE_MIN_VALUE = POWER_MODE_AUTO,
+    POWER_MODE_MAX_VALUE = POWER_MODE_LONG_DOZE,
+    POWER_MODE_DEF_VALUE = POWER_MODE_ACTIVE,
+
+    BEACON_RECEIVE_TIME_MIN_VALUE = 10,
+    BEACON_RECEIVE_TIME_MAX_VALUE = 1000,
+    BEACON_RECEIVE_TIME_DEF_VALUE = 50,
+
+    BASE_BAND_WAKE_UP_TIME_MIN_VALUE = 100,      /* in micro seconds */
+    BASE_BAND_WAKE_UP_TIME_MAX_VALUE = 10000,
+    BASE_BAND_WAKE_UP_TIME_DEF_VALUE = 2000,
+
+    PLL_LOCK_TIME_MIN_VALUE = 500,
+    PLL_LOCK_TIME_MAX_VALUE = 20000,
+    PLL_LOCK_TIME_DEF_VALUE = 4000,
+
+    HANGOVER_PERIOD_MIN_VALUE = 5,
+    HANGOVER_PERIOD_MAX_VALUE = 255,
+    HANGOVER_PERIOD_DEF_VALUE = 5,
+
+    BEACON_LISTEN_INTERVAL_MIN_VALUE = 1,
+    BEACON_LISTEN_INTERVAL_MAX_VALUE = 50,
+    BEACON_LISTEN_INTERVAL_DEF_VALUE = 1,
+
+    DTIM_LISTEN_INTERVAL_MIN_VALUE = 1,
+    DTIM_LISTEN_INTERVAL_MAX_VALUE = 50,
+    DTIM_LISTEN_INTERVAL_DEF_VALUE = 1,
+
+    BEACON_FILTERING_MIN_VALUE = 0,
+    BEACON_FILTERING_MAX_VALUE = 30,
+    BEACON_FILTERING_DEF_VALUE = 10,
+
+    N_CONSECUTIVE_BEACONS_MISSED_MIN_VALUE = 0,
+    N_CONSECUTIVE_BEACONS_MISSED_MAX_VALUE = 50,
+    N_CONSECUTIVE_BEACONS_MISSED_DEF_VALUE = 1,
+
+    ENTER_TO_802_11_POWER_SAVE_RETRIES_MIN_VALUE = 0,
+    ENTER_TO_802_11_POWER_SAVE_RETRIES_MAX_VALUE = 50,
+    ENTER_TO_802_11_POWER_SAVE_RETRIES_DEF_VALUE = 5,
+
+    AUTO_POWER_MODE_INTERVAL_MIN_VALUE = 100,
+    AUTO_POWER_MODE_INTERVAL_MAX_VALUE = 30000,
+    AUTO_POWER_MODE_INTERVAL_DEF_VALUE = 1000,
+
+    AUTO_POWER_MODE_ACTIVE_TH_MIN_VALUE = 2,
+    AUTO_POWER_MODE_ACTIVE_TH_MAX_VALUE = 30000,
+    AUTO_POWER_MODE_ACTIVE_TH_DEF_VALUE = 15,
+
+    AUTO_POWER_MODE_DOZE_TH_MIN_VALUE = 1,
+    AUTO_POWER_MODE_DOZE_TH_MAX_VALUE = 30000,
+    AUTO_POWER_MODE_DOZE_TH_DEF_VALUE = 8,
+
+    AUTO_POWER_MODE_DOZE_MODE_MIN_VALUE = POWER_MODE_SHORT_DOZE,
+    AUTO_POWER_MODE_DOZE_MODE_MAX_VALUE = POWER_MODE_LONG_DOZE,
+    AUTO_POWER_MODE_DOZE_MODE_DEF_VALUE = POWER_MODE_LONG_DOZE,
+
+    POWER_MGMNT_MODE_DEF_VALUE = 1,
+    POWER_MGMNT_MODE_MIN_VALUE = 0,
+    POWER_MGMNT_MODE_MAX_VALUE = 1,
+
+    POWER_MGMNT_NEED_TO_SEND_NULL_PACKET_DEF_VALUE = 1,
+    POWER_MGMNT_NEED_TO_SEND_NULL_PACKET_MIN_VALUE = 0,
+    POWER_MGMNT_NEED_TO_SEND_NULL_PACKET_MAX_VALUE = 1,
+
+    /*
+     bit14 - "1" send Prob Request in PBCC
+     bit15 - "1" short preamble, "0" long preammle
+     bit0:bit12  Rates 
+     */
+    POWER_MGMNT_NULL_PACKET_RATE_MOD_DEF_VALUE =  ((1<<DRV_RATE_1M) | (1<<DRV_RATE_2M)),
+    POWER_MGMNT_NULL_PACKET_RATE_MOD_MIN_VALUE = 0,
+    POWER_MGMNT_NULL_PACKET_RATE_MOD_MAX_VALUE = 255 ,
+
+    POWER_MGMNT_NUM_NULL_PACKET_RETRY_DEF_VALUE = 5,
+    POWER_MGMNT_NUM_NULL_PACKET_RETRY_MIN_VALUE = 1,
+    POWER_MGMNT_NUM_NULL_PACKET_RETRY_MAX_VALUE = 255,
+    /*BET*/
+    POWER_MGMNT_BET_ENABLE_MIN = 0,
+    POWER_MGMNT_BET_ENABLE_MAX = 1,
+    POWER_MGMNT_BET_ENABLE_DEF = 1,
+    POWER_MGMNT_BET_DISABLE_THRESHOLD_MIN = 0,
+    POWER_MGMNT_BET_DISABLE_THRESHOLD_MAX = 255,
+    POWER_MGMNT_BET_DISABLE_THRESHOLD_DEF = 12,
+    POWER_MGMNT_BET_MAX_CONSC_MIN = 1,
+    POWER_MGMNT_BET_MAX_CONSC_MAX = 50,
+    POWER_MGMNT_BET_MAX_CONSC_DEF = 8,
+/*--------------- Maximal time between full beacon reception ------------------*/
+    POWER_MGMNT_MAX_FULL_BEACON_MIN = 0,
+    POWER_MGMNT_MAX_FULL_BEACON_MAX = 10000,
+    POWER_MGMNT_MAX_FULL_BEACON_DEF = 1000
+};
+
+/*****************************************************************************
+ **         END POWER MANAGER MODULE REGISTRY DEFINITIONS                   **
+ *****************************************************************************/
+
+
+typedef enum
+{
+    ERP_PROTECTION_NONE       = 0,
+    ERP_PROTECTION_STANDARD   = 1,
+    ERP_PROTECTION_TI_TRICK   = 2
+} erpProtectionType_e;
+
+
+#endif /* _CORE_DEFAULT_PARAMS_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/external_inc/paramout.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,56 @@
+/*
+ * paramout.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:   paramOut.h													*/
+/*    PURPOSE:																*/
+/*																			*/
+/****************************************************************************/
+
+#ifndef __PARAM_OUT_H__
+#define __PARAM_OUT_H__
+
+#include "TWDriver.h"
+#include "InternalCmdCodes.h"
+
+// #include "CmdInterfaceCodes.h"
+
+#endif /* __PARAM_OUT_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/hw/TIWlanHpaCB.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,78 @@
+/*
+ * TIWlanHpaCB.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWlanWhaCB.cpp
+ *  \brief  Handle interrupts arriving from the Hpa
+ *
+ *  \see   
+ */
+#include "external_inc.h"
+#include "TIWlanHpaCB.h"
+#define __FILE_ID__								FILE_ID_137
+
+/** 
+* \fn     TIWlanHpaCB
+* \brief  constructor
+* 
+* \return   
+* \sa     
+*/ 
+TIWlanHpaCB::TIWlanHpaCB ( TI_HANDLE aTWD):
+    hTWD(aTWD)
+{}
+
+/** 
+* \fn     OnInterrupt
+* \brief  
+* 
+* Called in ISR DFC context to signal that peripheral
+* device interrupt has occurred.
+* Note: on systems implementing level sensitive interrupt handling
+* host interrupt is disabled prior calling this method
+*
+* \return   
+* \sa     
+*/ 
+void TIWlanHpaCB::OnInterrupt()
+{
+        TWD_InterruptRequest (hTWD);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/hw/TIWlanHpaCB.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,69 @@
+/*
+ * TIWlanHpaCB.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWlanWhaCB.h 
+ *  \brief  Correlate between TWD to the HPA class (BSP specific class) for interrupt handling
+ *
+ *  \see   
+ */
+
+#ifndef _TIWLANHPACB_
+#define _TIWLANHPACB_
+
+#include "TIWhaDef.h"
+
+class TIWlanHpaCB : public MWlanHpaCb
+{
+public:
+
+	 /* Constructor */
+	TIWlanHpaCB( TI_HANDLE aTWD);
+
+	virtual void OnInterrupt();
+	
+private:
+	TI_HANDLE hTWD;
+};
+
+
+
+#endif //_TIWLANHPACB_
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/os/RxBuf.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,135 @@
+/*
+ * RxBuf.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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))->status) & RX_DESC_LENGTH_LESS_3B) >> 6) - \
+                                 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_UINT8 *)pBuf + sizeof(RxIfDescriptor_t)))
+/**
+ * \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)    *((void*)((TI_UINT8 *)pBuf + sizeof(RxIfDescriptor_t) + 4))
+
+
+/** \brief BUF Allocation
+ * 
+ * \param  hOs		- OS module object handle
+ * \param  len		- Length of allocated WBUF
+ * \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);
+
+
+/** \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
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/os/external_inc.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,56 @@
+/*
+ * external_inc.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 external_inc.h
+ *  \brief used for Symbian specific include files
+ *
+ */
+
+#ifndef _EXTERNAL_INC_
+#define _EXTERNAL_INC_
+
+
+#ifndef _SYMBIAN_
+#include "am_platform_libraries.h"
+#else
+#include <kernel/kernel.h>
+#include <kernel/kern_priv.h>
+#endif
+
+#endif /* _EXTERNAL_INC_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/os/osTIType.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,104 @@
+/*
+ * osTIType.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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
+ *
+ * Copyright (C) 2006 Texas Instruments, Inc.
+ *
+ * Acknowledgements:
+ *   None
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed “as is” WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef __OSTITYPE_H__
+#define __OSTITYPE_H__
+
+
+typedef signed char         TI_INT8;
+typedef unsigned char       TI_UINT8;
+typedef short               TI_INT16;
+typedef unsigned short      TI_UINT16;
+typedef signed int          TI_INT32;
+typedef unsigned int        TI_UINT32;
+typedef long long           TI_INT64;
+typedef unsigned long long  TI_UINT64;
+
+//typedef TI_UINT32           TI_BOOL;
+typedef char                TI_CHAR;
+/*
+typedef TI_INT8;
+typedef TI_UINT8;
+typedef TI_INT16;
+typedef TI_UINT16;
+typedef TI_INT32;
+typedef TI_UINT32;
+typedef TI_INT64;
+typedef TI_UINT64;*/
+
+#ifndef _SYMBIAN_ 
+#define __TI_FILE__ 	__S40_FILE__ 
+#endif
+
+#define TI_CONST64(x)       (x##LL)
+
+#define INLINE 
+
+#ifndef VOID
+#define VOID        void
+#define PVOID       void*
+#endif
+
+#define TI_LIKELY           
+#define TI_UNLIKELY         
+
+
+#endif /* __OSTITYPE_H__*/
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/os/osapi.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,377 @@
+/*
+ * osapi.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  osapi.cpp 
+ *  \brief  Interface between the generic os abstration to symbian OSA
+ *
+ *  \see   
+ */
+
+#include "TIWhaDef.h"
+#include "timerclient.h"
+
+
+extern "C" 
+{
+#include "tidef.h"
+#include "cdebugoutput.h"
+#include "osApi.h"
+#define __FILE_ID__								FILE_ID_138
+
+/****************************************************************************************
+ *						OS Print API					                *       
+ ****************************************************************************************/
+
+/** 
+ * \fn     os_setDebugMode
+ * \brief  not in use
+ * 
+ * \note   
+ * \param  
+ * \return 
+ * \sa     
+ */ 
+void os_setDebugMode (TI_BOOL enable) 
+{
+	
+}
+
+
+/** 
+ * \fn     os_printf
+ * \brief  Print formatted output
+ * 
+ * \note   
+ * \param  format -  Specifies the string, to be printed
+ * \return 
+ * \sa     
+ */ 
+#include <libc/stdarg.h>
+extern "C" {void wlanPrintf(const char* const pPrefix, const char* const pFormat, va_list args);}
+void os_printf (const char *format ,...) 
+{
+	#if _DEBUG
+		VA_LIST args;
+		VA_START(args, format);
+        wlanPrintf("TI_TRC: ", format, args);
+		VA_END(args);
+	#endif
+}
+
+/** 
+ * \fn     os_InterruptServiced
+ * \brief   inform that interrupt was serviced (i.e. enable WLAN IRQ in LEVEL_IRQ)
+ * 
+ * \param  OsContext
+ * \return 
+ * \sa     
+ */ 
+void os_InterruptServiced (TI_HANDLE OsContext)
+{
+    /* Mark that interrupt was serviced */        
+    GET_HPA(OsContext)->InterruptServiced();
+}
+
+/****************************************************************************************
+ *						OS Memory API													*       
+ ****************************************************************************************/
+
+/** 
+ * \fn     os_memoryAlloc
+ * \brief  Allocates resident (nonpaged) system-space memory
+ * 
+ * \note   
+ * \param  OsContext	- os context.
+ * \param Size		- Specifies the size, in bytes, to be allocated
+ * \return Pointer to the allocated memory.
+				NULL if there is insufficient memory available
+ * \sa     
+ */ 
+void *os_memoryAlloc (TI_HANDLE OsContext,TI_UINT32 Size,TI_BOOL MemoryType) 
+{
+#if defined DMA_CAPABLE_BUFFERS
+	MWlanOsa::TOsaMemoryType iOsMemType;
+    if (MemoryType == MemoryNormal) 
+    {
+        iOsMemType = MWlanOsa::ENormalMemory;
+    }
+    else
+    {
+		iOsMemType = MWlanOsa::EInterconnectMemory;
+    }
+	return GET_OSA(OsContext)->Alloc(iOsMemType,Size,0);
+#else
+	MWlanOsa::TOsaMemoryType iOsMemType = MWlanOsa::ENormalMemory;
+	return GET_OSA(OsContext)->Alloc(iOsMemType,Size,0);
+#endif
+
+}
+
+
+/** 
+ * \fn     os_memorySet
+ * \brief  This function fills a block of memory with given value
+ * 
+ * \note   
+ * \param OsContext		- os context.
+ * \param pMemPtr		- Specifies the base address of a block of memory
+ * \param Value			- Specifies the value to set
+ * \param Length		- Specifies the size, in bytes, to copy.
+ * \return 
+ * \sa     
+ */ 
+void os_memorySet (TI_HANDLE OsContext, void *pMemPtr, TI_INT32 Value, TI_UINT32 Length) 
+{
+	MWlanOsa::MemSet(pMemPtr,Value,Length);
+}
+
+
+/** 
+ * \fn     os_memoryZero
+ * \brief  This function fills a block of memory with 0s.
+ * 
+ * \note   
+ * \param OsContext		- os context.
+ * \param pMemPtr		- Specifies the base address of a block of memory
+ * \param Length		- Specifies how many bytes to fill with 0s.
+ * \return 
+ * \sa     
+ */ 
+void os_memoryZero (TI_HANDLE OsContext, void *pMemPtr, TI_UINT32 Length) 
+{
+	MWlanOsa::MemClr(pMemPtr,Length);
+}
+
+
+/** 
+ * \fn     os_memoryCopy
+ * \brief  This function copies a specified number of bytes from one caller-supplied
+				location to another.
+ * 
+ * \note   
+ * \param OsContext		- os context.
+ * \param pDstPtr		- Destination buffer
+ * \param pSrcPtr		- Source buffer
+ * \param Size			- Specifies the size, in bytes, to copy.
+ * \return 
+ * \sa     
+ */ 
+void os_memoryCopy (TI_HANDLE pOsContext, void *pDestination, void *pSource, TI_UINT32 Size)
+{
+	MWlanOsa::MemCpy(pDestination,(const void *)pSource,Size);
+}
+
+
+/** 
+ * \fn     os_memoryFree
+ * \brief  This function releases a block of memory previously allocated with the
+				os_memoryAlloc function.
+ * 
+ * \note   
+ * \param OsContext		- os context.
+ * \param pMemPtr		-	Pointer to the base virtual address of the allocated memory.
+								This address was returned by the os_memoryAlloc function.
+ * \param 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 
+ * \sa     
+ */ 
+void os_memoryFree (TI_HANDLE pOsContext, void *pMemPtr, TI_UINT32 Size) 
+{
+	GET_OSA(pOsContext)->Free(pMemPtr);
+}
+
+/** 
+ * \fn     os_memoryCompare
+ * 
+ * \note   
+ * \return 
+ * \sa     
+ */ 
+TI_INT32 os_memoryCompare (TI_HANDLE OsContext, TI_UINT8* Buf1, TI_UINT8* Buf2, TI_INT32 Count)
+{
+    return (TI_INT32)(MWlanOsa::MemCmp( Buf1, Buf2, Count ));
+    
+}
+
+
+/** 
+ * \fn     os_timeStampMs
+ * \brief  This function returns the number of milliseconds that have elapsed since
+				the system was booted.
+ * 
+ * \note   
+ * \param OsContext		- os context.
+ * \return
+ * \sa     
+ */ 
+TI_INT32 os_timeStampMs (TI_HANDLE OsContext) 
+{
+    TInt64  iTime;
+
+    iTime = MWlanOsa::Time() / 1000;
+
+    /* return only LSB */
+    return ((TUint32*)&iTime)[0];
+}
+
+
+
+
+/** 
+ * \fn     os_StalluSec
+ * \brief  This function make delay in microseconds.
+ * 
+ * \note   
+ * \param OsContext		- os context.
+ * \param uSec			- delay time in microseconds
+ * \return
+ * \sa     
+ */ 
+void os_StalluSec (TI_HANDLE OsContext, TI_UINT32 uSec) 
+{
+	MWlanOsa::BusyWait(uSec);
+}
+
+/*****************************************************************************************
+ *							Timer functions				       *
+ *****************************************************************************************/
+
+/** 
+ * \fn     os_timerCreate
+ * \brief  Create timer client 
+ * 
+ * \param OsContext		- os context.
+ * \param pRoutine			- CB function
+ * \param hFuncHandle		- CB handle
+ *
+ * \note   
+ * \return Timer client handle
+ * \sa     
+ */ 
+TI_HANDLE os_timerCreate (TI_HANDLE OsContext, fTimerFunction pRoutine, TI_HANDLE hFuncHandle)
+{
+    return (TI_HANDLE)(new TimerClient (OsContext, pRoutine, hFuncHandle));
+    
+}
+
+/** 
+ * \fn     os_timerDestroy
+ * \brief  Destroy timer client 
+ * 
+ * \param OsContext		- os context.
+ * \param TimerHandle			- timer client handle
+ * \note   
+ * \return
+ * \sa     
+ */ 
+void os_timerDestroy (TI_HANDLE OsContext, TI_HANDLE TimerHandle)
+{
+    if (TimerHandle) 
+    {
+        delete (TimerClient *)TimerHandle;
+    }
+}
+
+/** 
+ * \fn     os_timerStart
+ * \brief  start timer 
+ * 
+ * \param OsContext		- os context.
+ * \param TimerHandle		- timer client handle
+ * \param DelayMs			
+ *
+ * \note   
+ * \return
+ * \sa     
+ */ 
+void os_timerStart (TI_HANDLE OsContext, TI_HANDLE TimerHandle, TI_UINT32 DelayMs)
+{
+    ((TimerClient *)TimerHandle)->Start(DelayMs);
+}
+
+/** 
+ * \fn     os_timerStop
+ * \brief  stop timer 
+ * 
+ * \param OsContext		- os context.
+ * \param TimerHandle		- timer client handle
+ * \note   
+ * \return
+ * \sa     
+ */ 
+void os_timerStop (TI_HANDLE OsContext, TI_HANDLE TimerHandle)
+{
+    ((TimerClient *)TimerHandle)->Stop();
+}
+
+
+/****************************************************************************************
+ *							Protection services	API										*
+ ****************************************************************************************/
+
+/** 
+ * \fn     os_protectCreate
+ * \brief  
+ * 
+ * \note   
+ * \param OsContext		- os context.
+ * \return A handle of the created mutex/spinlock.
+				TI_HANDLE_INVALID if there is insufficient memory available or problems
+				initializing the mutex
+ * \sa     
+ */ 
+TI_HANDLE os_protectCreate (TI_HANDLE OsContext) { return TI_OK;}
+
+
+/** 
+ * \fn     os_protectDestroy
+ * \brief  the WVSS dose not use protection 
+ * 
+ * \note   
+ * \param OsContext		- os context.
+ * \return 
+ * \sa     
+ */ 
+void os_protectDestroy (TI_HANDLE OsContext, TI_HANDLE ProtectContext) {}
+
+} //extern "C"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/os/pdd_names.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,62 @@
+/*
+ * pdd_names.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/*
+* ============================================================================
+*  Name     : MUmacCb from UmacCb.h
+*  Part of  : wlanldd
+* ============================================================================
+*/
+
+#ifndef PDD_NAMES_H
+#define PDD_NAMES_H
+
+#pragma message("PDD_NAME = wlan.phys")
+
+    _LIT( PDD_NAME, "wlan.phys" );
+
+#define PDD_FILE_NAME_MTUM _L("wlanpdd")
+#define PDD_FILE_NAME_UMAC _L("wlanpddumac")
+
+// copied from NwLoPddNames.h
+#define PDD_NAME _L("wlan.phys")
+#define PDD_FILE_NAME _L("wlanpdd")
+
+
+#endif // PDD_NAMES_H
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/os/spi_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,92 @@
+/*
+ * spi_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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
+ *
+ * Copyright (C) 2006 Texas Instruments, Inc.
+ *
+ * Acknowledgements:
+ *   None
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed “as is” WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#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_ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/os/timerclient.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,125 @@
+/*
+ * timerclient.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 "TIWhaDef.h"
+#include "wlantimer.h"
+#include "timerclient.h"
+#define __FILE_ID__								FILE_ID_139
+
+/* Make sure that while converting Ms to Us we are not exceeding max value of TInt */
+#define MAX_US_TIMEOUT (0x7FFFFFFF)
+#define MAX_MS_TIMEOUT (MAX_US_TIMEOUT / 1000)
+
+/** 
+ * \fn     TimerClient
+ * \brief  Constructor
+ * 
+ * Create a new timer object, icluding creating a timer in OSA
+ * 
+ * \param  hOs - The OS handle
+ */ 
+TimerClient::TimerClient (void* hOs, fTimerFunction pRoutine, TI_HANDLE hFuncHandle) :
+    iWlanOSA (GET_OSA(hOs)),
+    iWlanTimer (iWlanOSA->TimerCreate()),
+    fCb(pRoutine),
+    hCtx(hFuncHandle)
+{}
+
+/** 
+ * \fn     ~TimerClient
+ * \brief  Destructor
+ * 
+ * Destroy Timer
+ * 
+ * \param  
+ */ 
+TimerClient::~TimerClient()
+{
+    if (iWlanTimer && iWlanOSA) 
+    {
+       iWlanOSA->TimerDestroy(iWlanTimer);
+    }
+}
+
+/** 
+ * \fn     OnTimeout
+ * \brief  On Timer expiry
+ * 
+ * Call the registered call back in TWD (timer.c)
+ * 
+ * \param  aCtx - not used
+ */ 
+void TimerClient::OnTimeout(TInt aCtx)
+{
+    fCb(hCtx);
+}
+
+/** 
+ * \fn     Start
+ * \brief  start timer
+ * 
+ * Save parameters and start timer in OSA
+ * 
+ */ 
+void   TimerClient::Start(TI_UINT32 uIntervalMsec)
+{
+    /* Make sure we are not exceeding the maximum value of TInt. */
+    TInt iIntervalUsec = (uIntervalMsec > MAX_MS_TIMEOUT) ? (MAX_US_TIMEOUT) : (uIntervalMsec * 1000);
+
+	if (iIntervalUsec == 0) 
+	{
+		/* we will mark it as 1us to avoid errors. This is actually used to schedule context switch */
+		iIntervalUsec = 1;
+	}
+    /* Wlan Timer expects microseconds */
+    iWlanTimer->Enqueue(*this, 0, iIntervalUsec, TI_FALSE);
+}
+
+/** 
+ * \fn     Stop
+ * \brief  stop timer
+ * 
+ * stop timer
+ * 
+ */ 
+void TimerClient::Stop()
+{
+    iWlanTimer->Dequeue();
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/os/timerclient.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,82 @@
+/*
+ * timerclient.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 _TIMERCLIENT_
+#define _TIMERCLIENT_
+
+#include "external_inc.h"
+#include "wlantimerclient.h"
+#include "wlanosa.h"
+
+extern "C"
+{
+#include "osTIType.h"
+#include "tidef.h"
+#include "timer.h"
+}
+
+
+class TimerClient : public MWlanTimerClient
+{
+public:
+
+	/* Constructor */
+	TimerClient (void* hOs, fTimerFunction pRoutine, TI_HANDLE hFuncHandle);
+
+	/* Destructor */
+	virtual ~TimerClient();
+
+	/* timer callback */
+	virtual void OnTimeout(TInt aCtx);
+
+	void   Start(TI_UINT32 uIntervalMsec);
+	void   Stop();
+
+private:
+	MWlanOsa        *iWlanOSA;
+	MWlanTimer      *iWlanTimer;
+
+	fTimerFunction    fCb;
+	TI_HANDLE       hCtx;
+};
+
+
+
+#endif /* _TIMERCLIENT_ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/sdio/sdioadapter.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,174 @@
+/*
+ * sdioadapter.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   SdioAdapter.c 
+ *  \brief  The SDIO driver adapter. Platform dependent. 
+ * 
+ * An adaptation layer between the lower SDIO driver (in BSP) and the upper SdioBusDrv.
+ * Used for issuing all SDIO transaction types towards the lower SDIO-driver.
+ * Makes the decision whether to use Sync or Async transaction, and reflects it to the caller
+ *     by the return value and calling its callback in case of Async.
+ *  
+ *  \see    SdioAdapter.h, SdioDrv.c & h
+ */
+
+#include "TxnDefs.h"
+extern "C" 
+{
+#include "SdioAdapter.h"
+}
+
+#include "SdioDrv.h"
+#include <stdio.h>
+#include "SDioClient.h"
+
+void* wsdioAdapt_Open(void* hOs)
+{
+	return (void*)SDioClient::Create(); 
+	
+}
+
+void* wSdioAdapt_Close(void* hOs)
+{
+    return KErrNone;
+}
+
+/**
+  * \fn     wsdioAdapt_ConnectBus 
+  * \brief   
+  * 
+  * Initialize HW.
+  * 
+  * \note   
+  * \param  
+  * \return KErrNone if success otherwise error.
+  * \sa     
+  */
+int wsdioAdapt_ConnectBus(TAny*		   hSdio,	 
+						  TAny*        fCbFunc,
+                          TAny*        hCbArg,
+                          unsigned int  uBlkSizeShift,
+                          unsigned int  uSdioThreadPriority)
+{
+	SDioClient* pSdioClient = reinterpret_cast<SDioClient*>(hSdio);
+   
+	pSdioClient->sdioAdapt_ConnectBus(fCbFunc, hCbArg, uBlkSizeShift, uSdioThreadPriority);
+	return KErrNone;
+}
+
+/**
+  * \fn     wsdioAdapt_DisconnectBus 
+  * \brief   
+  * 
+  * DeInitialize HW.
+  * 
+  * \note   
+  * \param  
+  * \return KErrNone if success otherwise error.
+  * \sa     
+  */
+int wsdioAdapt_DisconnectBus (TAny*		   hSdio)
+{
+	SDioClient* pSdioClient = reinterpret_cast<SDioClient*>(hSdio);
+    pSdioClient->sdioAdapt_DisconnectBus();
+	return KErrNone;
+}
+
+/**
+  * \fn     wsdioAdapt_Transact 
+  * \brief   
+  * 
+  * Transaction of multiple bytes.
+  * 
+  * \note   
+  * \param  
+  * \return TXN_STATUS_OK if success, 
+  *         TXN_STATUS_ERROR if error.
+  * \sa     
+  */
+ETxnStatus wsdioAdapt_Transact (TAny*		   hSdio,	
+							    unsigned int  uFuncId,
+                                unsigned int  uHwAddr,
+                                void *        pHostAddr,
+                                unsigned int  uLength,
+                                unsigned int  bDirection,
+                                unsigned int  bBlkMode,
+                                unsigned int  bFixedAddr,
+                                unsigned int  bMore)
+{
+	ETxnStatus iStatus = TXN_STATUS_OK;
+	SDioClient* pSdioClient = reinterpret_cast<SDioClient*>(hSdio);
+    iStatus = pSdioClient->sdioAdapt_Transact(uFuncId, uHwAddr, pHostAddr, uLength, bDirection, bBlkMode, bFixedAddr, bMore );
+
+	if(iStatus == TXN_STATUS_ERROR)
+		return TXN_STATUS_ERROR;
+	else
+		return iStatus;
+}
+         
+/**
+  * \fn     wsdioAdapt_TransactBytes 
+  * \brief   
+  * 
+  * Transaction of bytes.
+  * 
+  * \note   
+  * \param  
+  * \return TXN_STATUS_OK if success, 
+  *         TXN_STATUS_ERROR if error.
+  * \sa     
+  */		 
+ETxnStatus wsdioAdapt_TransactBytes (TAny*		   hSdio,	
+									unsigned int  uFuncId,
+                                    unsigned int  uHwAddr,
+                                    void *        pHostAddr,
+                                    unsigned int  uLength,
+                                    unsigned int  bDirection,
+                                    unsigned int  bMore)
+{
+	int iStatus = TXN_STATUS_OK;
+
+	SDioClient* pSdioClient = reinterpret_cast<SDioClient*>(hSdio);
+	iStatus = pSdioClient->sdioAdapt_TransactBytes(uFuncId, uHwAddr, pHostAddr, uLength, bDirection, bMore);
+
+	if(iStatus == TXN_STATUS_ERROR)
+		return TXN_STATUS_ERROR;
+	else
+		return TXN_STATUS_OK;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/sdio/sdioadapter.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,83 @@
+/*
+ * sdioadapter.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   SdioAdapter.h 
+ *  \brief  SDIO adapter module API definition                                  
+ *
+ *  \see    SdioAdapter.c
+ */
+
+#ifndef __SDIO_ADAPT_API_H__
+#define __SDIO_ADAPT_API_H__
+
+#include "TxnDefs.h"
+#include "e32def.h"
+
+void* wsdioAdapt_Open(void* hOs);
+
+void* wSdioAdapt_Close(void* hOs);
+
+int wsdioAdapt_ConnectBus(TAny*		    hSdio,	 
+						  TAny*         fCbFunc,
+                          TAny*         hCbArg,
+                          unsigned int  uBlkSizeShift,
+                          unsigned int  uSdioThreadPriority);
+
+int wsdioAdapt_DisconnectBus (TAny*		   hSdio);
+
+ETxnStatus wsdioAdapt_Transact (TAny*		  hSdio,	
+							    unsigned int  uFuncId,
+                                unsigned int  uHwAddr,
+                                void *        pHostAddr,
+                                unsigned int  uLength,
+                                unsigned int  bDirection,
+                                unsigned int  bBlkMode,
+                                unsigned int  bFixedAddr,
+                                unsigned int  bMore);
+
+ETxnStatus wsdioAdapt_TransactBytes (TAny*		  hSdio,	
+									unsigned int  uFuncId,
+                                    unsigned int  uHwAddr,
+                                    void *        pHostAddr,
+                                    unsigned int  uLength,
+                                    unsigned int  bDirection,
+                                    unsigned int  bMore);
+
+
+#endif /*__SDIO_ADAPT_API_H__*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/sdio/sdioclient.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,366 @@
+/*
+ * sdioclient.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 "TxnDefs.h"
+#include <stdlib.h>
+#include <regifc.h>
+
+#include "osApi.h"
+#include "wlanosa.h"
+#include "wlanosaext.h"
+
+#include "SDioClient.h"
+#include "sdiodrv.h"
+
+/************************************************************************
+ * Defines
+ ************************************************************************/
+
+/* To debug SdioClient, define some prints here */
+#define     TRACE(msg) 
+#ifndef _SYMBIAN_
+#define     ERROR_TRACE(msg)
+#else
+#define     ERROR_TRACE(msg) Kern::Printf(msg);
+#endif
+
+/* Sync/Async Threshold */
+#ifdef FULL_ASYNC_MODE
+#define SYNC_ASYNC_LENGTH_THRESH	0     /* Use Async for all transactions */
+#else
+#define SYNC_ASYNC_LENGTH_THRESH	360   /* Use Async for transactions longer than this threshold (in bytes) */
+#endif
+
+SDioClient* SDioClient::mSdioClient = NULL;
+
+ /**
+  * \fn     SdioClient::SdioClient 
+  * \brief  Constructor 
+  * 
+  * 
+  * 
+  * \note   
+  * \param  
+  * \return handle to Sdioclient. NULL on failure.
+  * \sa     
+  */
+SDioClient::SDioClient() : WlanSpia(),
+                           iSessionEndCallback(SDioClient::SessionEndCallback, this)
+                           
+{
+    iSocketP = static_cast< DSDIOSocket* >(DPBusSocket::SocketFromId(0));
+    iStackP = static_cast< DSDIOStack* >(iSocketP->Stack(0));
+    iCardP = static_cast< TSDIOCard* >(iStackP->CardP(0));
+
+
+	TRACE(("iSocketP 0x%x  iStackP 0x%x  iCardP 0x%x", iSocketP, iStackP, iCardP))
+
+}
+
+
+SDioClient* SDioClient::Create(MWlanOsaExt &aOsaExt)
+{
+    if (mSdioClient == NULL) {
+        mSdioClient = new SDioClient();
+    }
+
+    mSdioClient->mWlanOsaExt = &aOsaExt;
+    
+    return mSdioClient;
+}
+
+
+SDioClient* SDioClient::Create()
+{
+    if (mSdioClient == NULL) {
+        mSdioClient = new SDioClient();
+    }
+  
+    return mSdioClient;
+}
+
+void SDioClient::Destroy()
+{
+    if (mSdioClient) {
+        delete mSdioClient;
+        mSdioClient = NULL;
+    }
+}
+
+/**
+  * \fn     SdioClient::SessionEndCallback 
+  * \brief   
+  * 
+  * CallBack.
+  * 
+  * \note   
+  * \param  
+  * \return No return value.
+  * \sa     
+  */
+void SDioClient::SessionEndCallback(TAny* ptr)
+{
+    SDioClient *hClient = (SDioClient *)ptr;
+
+    mSdioClient->mWlanOsaExt->MutexAcquire();
+
+    if (hClient->afCbFunc) 
+    {
+        hClient->afCbFunc(hClient->ahCbArg,0);
+    }
+    else
+    {
+        ERROR_TRACE(("SDioClient::SessionEndCallback - NoCallback"))
+    }
+
+    mSdioClient->mWlanOsaExt->MutexRelease();
+}
+
+/**
+  * \fn     SdioClient::sdioAdapt_ConnectBus 
+  * \brief   
+  * 
+  * Initialize HW.
+  * 
+  * \note   
+  * \param  
+  * \return KErrNone if success otherwise error.
+  * \sa     
+  */
+int SDioClient::sdioAdapt_ConnectBus (TAny*        fCbFunc,
+									  TAny*        hCbArg,
+									  unsigned int  uBlkSizeShift,
+									  unsigned int  uSdioThreadPriority)
+{
+        afCbFunc = (TTxnDoneCb1)fCbFunc;
+        ahCbArg = hCbArg;
+
+		iSocketP->PowerUp();
+             
+		TUint32 regValue = 4;
+		TUint8 reply;
+		TUint8 loopCounter = 0;
+		int iStatus = KErrNone;
+		TUint8 aReadDataP;
+
+        iCardP->CommonRegisterInterface()->SetSync();
+
+        do
+		{
+			iStatus = (iCardP->CommonRegisterInterface())->Write8(0x02, regValue, &aReadDataP );
+			if(iStatus != KErrNone)
+			ERROR_TRACE(("SDioClient::sdioAdapt_ConnectBus  Error 1"))
+
+            iStatus = (iCardP->CommonRegisterInterface())->Read8(0x02,&reply);
+			if(iStatus != KErrNone)
+			ERROR_TRACE(("SDioClient::sdioAdapt_ConnectBus  Error 2"))
+            
+            loopCounter++;
+			
+		}while (reply!=regValue && loopCounter < 5);
+
+
+        // Set function number 2
+		(iCardP->CommonRegisterInterface())->SetFunctionNumber(2);
+			
+	return iStatus;
+}
+
+/**
+  * \fn     SdioClient::sdioAdapt_DisconnectBus 
+  * \brief   
+  * 
+  * DeInitialize HW.
+  * 
+  * \note   
+  * \param  
+  * \return KErrNone if success otherwise error.
+  * \sa     
+  */
+int SDioClient::sdioAdapt_DisconnectBus (void)
+{
+	int iStatus = KErrNone;
+	return iStatus;
+}
+
+/**
+  * \fn     SdioClient::sdioAdapt_Transact 
+  * \brief   
+  * 
+  * Transaction of multiple bytes.
+  * 
+  * \note   
+  * \param  
+  * \return TXN_STATUS_COMPLETE if transaction copleted, 
+  *         TXN_STATUS_PENDING  if transaction is pending,
+  *         TXN_STATUS_ERROR if error.
+  * \sa     
+  */
+ETxnStatus SDioClient::sdioAdapt_Transact (unsigned int  uFuncId,
+										   unsigned int  uHwAddr,
+										   void *        pHostAddr,
+										   unsigned int  uLength,
+										   unsigned int  bDirection,
+										   unsigned int  bBlkMode,
+										   unsigned int  bFixedAddr,
+										   unsigned int  bMore)
+{
+	int iStatus = KErrNone;
+	
+	TInt err = KErrNone;
+
+    /* If transction length is below threshold, use Sync methods */
+	if (uLength <= SYNC_ASYNC_LENGTH_THRESH) /* Stating with sunc calls, after this async calls will be enabled*/
+    {
+        iCardP->CommonRegisterInterface()->SetSync();
+        if (bDirection) 
+        {
+			iStatus = (iCardP->CommonRegisterInterface())->ReadMultiple8(uHwAddr, (TUint8*)pHostAddr,(TUint32)uLength, bFixedAddr);
+		}
+        else 
+        {
+            iStatus = (iCardP->CommonRegisterInterface())->WriteMultiple8(uHwAddr, (TUint8*)pHostAddr, (TUint32)uLength, bFixedAddr );
+        }
+		/* If failed return ERROR, if succeeded return COMPLETE */
+        if (iStatus != KErrNone) 
+        {
+            ERROR_TRACE(("SDioClient::sdioAdapt_Transact  Error"))
+			return TXN_STATUS_ERROR;
+        }
+		// Using synchronous interface of SDIO stack. Hence complete the request here.
+		Kern::RequestComplete(iClient, iReqStatus, err);
+    }
+
+	/* If transction length is above threshold, use Async methods */
+    else 
+    {
+            if ((iCardP->CommonRegisterInterface()->SetAsync(iSessionEndCallback)) != TRUE )
+            {
+                ERROR_TRACE(("SDioClient::sdioAdapt_Transact - SetAsync - Fail"))
+            }
+
+        /* Call read or write Async method */
+        if (bDirection) 
+        {            
+			iStatus = (iCardP->CommonRegisterInterface())->ReadMultiple8(uHwAddr, (TUint8*)pHostAddr,(TUint32)uLength, bFixedAddr );
+        }
+        else 
+        {
+			iStatus = (iCardP->CommonRegisterInterface())->WriteMultiple8(uHwAddr, (TUint8*)pHostAddr,(TUint32)uLength, bFixedAddr );
+        }
+
+        /* If failed return ERROR, if succeeded return PENDING */
+        if (iStatus != KErrNone) 
+        {
+            ERROR_TRACE(("SDioClient::sdioAdapt_Transact - ASYNC - ERROR\n"))
+            return TXN_STATUS_ERROR;
+        }
+        return TXN_STATUS_PENDING;
+    }
+    return TXN_STATUS_COMPLETE;
+}
+
+/**
+  * \fn     SdioClient::sdioAdapt_TransactBytes 
+  * \brief   
+  * 
+  * Transaction of bytes.
+  * 
+  * \note   
+  * \param  
+  * \return TXN_STATUS_COMPLETE if transaction copleted, 
+  *         TXN_STATUS_ERROR if error.
+  * \sa     
+  */
+ETxnStatus SDioClient::sdioAdapt_TransactBytes (unsigned int  uFuncId,
+												unsigned int  uHwAddr,
+												void *        pHostAddr,
+												unsigned int  uLength,
+												unsigned int  bDirection,
+												unsigned int  bMore)
+{
+
+    int iStatus = KErrNone;
+	TInt err = KErrNone;
+	/* Call read or write bytes Sync method */
+    if (bDirection) 
+    {
+		iStatus = (iCardP->CommonRegisterInterface())->Read8(uHwAddr, (TUint8*)pHostAddr);
+	}
+    else 
+    {
+        iStatus = (iCardP->CommonRegisterInterface())->Write8(uHwAddr, *((TUint8*)pHostAddr), NULL );
+    }
+
+    /* If failed return ERROR, if succeeded return COMPLETE */
+    if (iStatus != KErrNone) 
+    {
+        ERROR_TRACE(("SDioClient::sdioAdapt_TransactBytes - ERROR\n"))
+		return TXN_STATUS_ERROR;
+    }
+
+	// Using synchronous interface of SDIO stack. Hence complete the request here.
+	Kern::RequestComplete(iClient, iReqStatus, err);
+	
+    return TXN_STATUS_COMPLETE;
+}
+
+
+
+
+/***************************************************************************************/
+/* Create dummy implamantaion for SPIA pure virtual function 
+   Remove all SPIA dependency when SDIOA will be published.
+*/
+
+WlanSpia* WlanSpia::Create( MWlanOsaExt& aOsaExt )
+{
+    return (SDioClient *)SDioClient::Create(aOsaExt);
+}
+
+WlanSpia* WlanSpia::Create()
+{
+    return (SDioClient *)SDioClient::Create();
+}
+
+void WlanSpia::Destroy( WlanSpia* aWlanSpia )
+{
+    SDioClient::Destroy();
+}
+    
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/sdio/sdioclient.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,133 @@
+/*
+ * sdioclient.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 __SDIO_CLIENT_H__
+#define __SDIO_CLIENT_H__
+
+#include "e32def.h"
+
+#include <sdio.h>
+#include <pbusmedia.h>
+
+#include "wlanosa.h"
+#include "wlanosaext.h"
+#include "wlanspia.h"
+
+#define		FULL_ASYNC_MODE
+
+
+typedef void (*TTxnDoneCb1)(void *hCbHandle, TUint32 status);
+
+class SDioClient: public WlanSpia
+{
+
+public:
+
+    static SDioClient* Create(MWlanOsaExt &aOsaExt);
+
+    static SDioClient* Create();
+
+    static void Destroy();
+
+    int sdioAdapt_ConnectBus (TAny*         fCbFunc,
+                              TAny*         hCbArg,
+                              unsigned int  uBlkSizeShift,
+                              unsigned int  uSdioThreadPriority);
+
+    int sdioAdapt_DisconnectBus (void);
+
+    ETxnStatus sdioAdapt_Transact (unsigned int  uFuncId,
+                                   unsigned int  uHwAddr,
+                                   void *        pHostAddr,
+                                   unsigned int  uLength,
+                                   unsigned int  bDirection,
+                                   unsigned int  bBlkMode,
+                                   unsigned int  bFixedAddr,
+                                   unsigned int  bMore);
+
+    ETxnStatus sdioAdapt_TransactBytes (unsigned int  uFuncId,
+                                        unsigned int  uHwAddr,
+                                        void *        pHostAddr,
+                                        unsigned int  uLength,
+                                        unsigned int  bDirection,
+                                        unsigned int  bMore);
+
+    static void SessionEndCallback(TAny *aSelfP);
+
+
+private:
+    void *              hSdioOs;
+    TMMCCallBack        iSessionEndCallback;
+    TRequestStatus*     iReqStatus;
+    DThread*            iClient;
+    DSDIOSocket*        iSocketP;
+    DSDIOStack*         iStackP;
+    TSDIOCard*          iCardP;
+    TTxnDoneCb1         afCbFunc;
+    TAny*               ahCbArg;
+    static SDioClient*  mSdioClient;
+
+protected:
+
+    SDioClient();
+
+    ~SDioClient()
+    {
+    }
+
+    MWlanOsaExt*        mWlanOsaExt;
+
+public:
+
+    /* Create dummy implamantaion for SPIA pure virtual function 
+       Remove all SPIA dependency when SDIOA will be published.
+       */
+    void Configure( const TConfig& aConfig )
+    {
+    }
+    SPIA::TStatus Request( const TRequest& aRequest )
+    {
+        return SPIA::ESuccess;
+    }
+    SPIA::TStatus Cancel( TRequestId aRequestId )
+    {
+        return SPIA::ESuccess;
+    }
+};
+
+#endif //__SDIO_CLIENT_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/sdio/sdiodrv.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,174 @@
+/*
+ * sdiodrv.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 __OMAP2430_SDIODRV_API_H
+#define __OMAP2430_SDIODRV_API_H
+
+
+/* Card Common Control Registers (CCCR) */
+
+#define CCCR_SDIO_REVISION                  0x00
+#define CCCR_SD_SPECIFICATION_REVISION      0x01
+#define CCCR_IO_ENABLE                      0x02
+#define CCCR_IO_READY                       0x03
+#define CCCR_INT_ENABLE                     0x04
+#define CCCR_INT_PENDING                    0x05
+#define CCCR_IO_ABORT                       0x06
+#define CCCR_BUS_INTERFACE_CONTOROL         0x07
+#define CCCR_CARD_CAPABILITY	            0x08
+#define CCCR_COMMON_CIS_POINTER             0x09 /*0x09-0x0B*/
+#define CCCR_BUS_SUSPEND	                0x0c
+#define CCCR_FUNCTION_SELECT	            0x0d
+#define CCCR_EXEC_FLAGS	                    0x0e
+#define CCCR_READY_FLAGS	                0x0f
+#define CCCR_FNO_BLOCK_SIZE	                0x10 /*0x10-0x11*/
+
+/* Pprotocol defined constants */  
+         
+#define SD_IO_GO_IDLE_STATE		  		    0  
+#define SD_IO_SEND_RELATIVE_ADDR	  	    3 
+#define SDIO_CMD5			  			    5
+#define SD_IO_SELECT_CARD		  		    7 
+#define SDIO_CMD52		 	 			    52		
+#define SDIO_CMD53		 	 			    53
+#define SD_IO_SEND_OP_COND		            SDIO_CMD5  
+#define SD_IO_RW_DIRECT			            SDIO_CMD52 
+#define SD_IO_RW_EXTENDED		            SDIO_CMD53 
+#define SDIO_SHIFT(v,n)                     (v<<n)
+#define SDIO_RWFLAG(v)                      (SDIO_SHIFT(v,31))
+#define SDIO_FUNCN(v)                       (SDIO_SHIFT(v,28))
+#define SDIO_RAWFLAG(v)                     (SDIO_SHIFT(v,27))
+#define SDIO_BLKM(v)                        (SDIO_SHIFT(v,27))
+#define SDIO_OPCODE(v)                      (SDIO_SHIFT(v,26))
+#define SDIO_ADDRREG(v)                     (SDIO_SHIFT(v,9))
+
+
+#define VDD_VOLTAGE_WINDOW                  0xffffc0
+
+#define MMC_RSP_NONE	                    (0 << 0)
+#define MMC_RSP_SHORT	                    (1 << 0)
+#define MMC_RSP_LONG	                    (2 << 0)
+#define MMC_RSP_MASK	                    (3 << 0)
+#define MMC_RSP_CRC	                        (1 << 3)
+#define MMC_RSP_BUSY	                    (1 << 4)
+
+#define MMC_RSP_R1	                        (MMC_RSP_SHORT|MMC_RSP_CRC)
+#define MMC_RSP_R1B	                        (MMC_RSP_SHORT|MMC_RSP_CRC|MMC_RSP_BUSY)
+#define MMC_RSP_R2	                        (MMC_RSP_LONG|MMC_RSP_CRC)
+#define MMC_RSP_R3	                        (MMC_RSP_SHORT)
+
+/* HSMMC controller bit definitions
+ * */
+#define OMAP_HSMMC_CMD_NO_RESPONSE          0 << 0
+#define OMAP_HSMMC_CMD_LONG_RESPONSE        1 << 0
+#define OMAP_HSMMC_CMD_SHORT_RESPONSE       2 << 0
+
+#define MMC_RSP_R4                          OMAP_HSMMC_CMD_SHORT_RESPONSE
+#define MMC_RSP_R5                          OMAP_HSMMC_CMD_SHORT_RESPONSE
+#define MMC_RSP_R6                          OMAP_HSMMC_CMD_SHORT_RESPONSE
+
+#define MMC_ERR_NONE	                    0
+#define MMC_ERR_TIMEOUT	                    1
+#define MMC_ERR_BADCRC	                    2
+#define MMC_ERR_FIFO	                    3
+#define MMC_ERR_FAILED	                    4
+#define MMC_ERR_INVALID	                    5
+
+
+/********************************************************************/
+/*	SDIO driver functions prototypes                                */
+/********************************************************************/
+
+//int sdioDrv_CheckHw ();
+
+int sdioDrv_ConnectBus     (void *fCbFunc, void *hCbArg, unsigned int uBlkSizeShift,unsigned int uSdioThreadPriority);
+//int sdioDrv_ConnectBus     (void *fCbFunc, void *hCbArg, unsigned int uBlkSizeShift);
+int sdioDrv_DisconnectBus  (void);
+
+int sdioDrv_ExecuteCmd     (unsigned int uCmd, 
+                            unsigned int uArg, 
+                            unsigned int uRespType,
+                            void *       pResponse, 
+                            unsigned int uLen);
+                           
+int sdioDrv_ReadSync       (unsigned int uFunc, 
+                            unsigned int uHwAddr, 
+                            void *       pData, 
+                            unsigned int uLen, 
+                            unsigned int bFixedAddr,
+                            unsigned int bMore);
+
+int sdioDrv_ReadAsync      (unsigned int uFunc, 
+                            unsigned int uHwAddr, 
+                            void *       pData, 
+                            unsigned int uLen, 
+                            unsigned int bBlkMode,
+                            unsigned int bFixedAddr,
+                            unsigned int bMore);
+
+int sdioDrv_WriteSync      (unsigned int uFunc, 
+                            unsigned int uHwAddr, 
+                            void *       pData, 
+                            unsigned int uLen,
+                            unsigned int bFixedAddr,
+                            unsigned int bMore);
+
+int sdioDrv_WriteAsync     (unsigned int uFunc, 
+                            unsigned int uHwAddr, 
+                            void *       pData, 
+                            unsigned int uLen, 
+                            unsigned int bBlkMode,
+                            unsigned int bFixedAddr,
+                            unsigned int bMore);
+
+int sdioDrv_ReadSyncBytes  (unsigned int  uFunc, 
+                            unsigned int  uHwAddr, 
+                            unsigned char *pData, 
+                            unsigned int  uLen, 
+                            unsigned int  bMore);
+                           
+int sdioDrv_WriteSyncBytes (unsigned int  uFunc, 
+                            unsigned int  uHwAddr, 
+                            unsigned char *pData, 
+                            unsigned int  uLen, 
+                            unsigned int  bMore);
+
+
+
+#endif/* _OMAP2430_SDIODRV_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/utils/cdebugoutput.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,50 @@
+/*
+ * cdebugoutput.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 CDEBUGOUTPUT_H
+#define CDEBUGOUTPUT_H
+#ifdef _SYMBIAN_
+void wlanPrintf(const char* const pPrefix, const char* const pFormat, VA_LIST args);
+#endif
+
+#endif
+// end of file
+ 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/utils/gendebug.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,182 @@
+/*
+ * gendebug.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/*
+* ============================================================================
+*  Name     : gendebug from gendebug.h
+*  Part of  : WLAN Networking
+
+* ============================================================================
+*/
+
+
+#ifndef GENDEBUG_H
+#define GENDEBUG_H
+
+#ifndef __KERNEL_MODE__
+#include <e32svr.h>
+#endif
+
+/** @file gendebug.h
+    @brief Common helper file for debugging. 
+
+    The file contains methods for adding traces and hardcoded breakpoint.
+
+    @page page1 A documentation for general helper module for doing debugging and tracing.
+
+    @subsection subsec1 This subsection describes the usage of hardcoded breakpoints.
+
+    Hardcoded breakpoints are usefull for allowing the execution to stop in right places
+    without bringing the OS down like using general assertions would do. Hardcoded breakpoints
+    must be used together with debugger. The hardcoded breakpoints are used by inserting
+    macro _DBG_MUST_BREAK into source code.
+
+    @note This feature has not been implemented yet.
+
+    @subsection subsec2 This subsection describes the usage of trace utilities.
+
+    Tracing is the most important way of doing HW level debugging (after looking the source of course).
+    Most of times users don't have access to debuggers and doing debugging in the field can be greatly
+    improved if there are great variety of configurable traces available.
+
+    In order to use the macro in kernel space, ALWAYS_KERNEL must be defined in the MMP-file of the module.
+
+    To use static tracing the module using these utilities must have defined DEBUG_LEVEL (this is integer constant) in
+    MMP-file. This constant defines the bit-mask for the set of traces, which are put into code at the compile time. See
+    the macro definitions for details.
+
+    The other way to do tracing is to use run-time tracing, which requires from user to put class member variable iDbgLevel
+    into their class. This variable is used the same way as the static flag by using bit-mask to define enabled traces. See
+    the macro definitions for details.
+*/
+
+
+#if defined(_DEBUG)
+#define _DBG_MUST_BREAK
+#else
+#define _DBG_MUST_BREAK
+#endif
+
+/** Critical trace-level is used when system is about to down very soon because of critical error. 
+    In most cases this trace level can be replaced by using assert with trace but in some cases
+    more information can be provided by using this debug level
+*/
+#define CRIT_LEVEL              0x00000001
+
+/** Serious trace-level is used when something bad and unexpected has happened but system might be
+    able to recover. In another words, software is not going to bring system forcefully down but
+    that's exactly what might happen due to an error.
+*/
+#define SERIOUS_LEVEL           0x00000002
+
+/* Error level is used to trace various errors, which are due to legal errors in normal operation. */
+#define ERROR_LEVEL             0x00000004
+
+/* Warning level is used to trace various warning, which are due to abnormal behaviour. */
+#define WARNING_LEVEL           0x00000008
+
+/* Info level is used to trace all general information. */
+#define INFO_LEVEL              0x00000010
+
+/* User definable trace level. This comment and definition should be replaced by the real usage. */
+#define USER_DEFINED_1          0x000010000
+/* User definable trace level. This comment and definition should be replaced by the real usage. */
+#define USER_DEFINED_2          0x000020000
+/* User definable trace level. This comment and definition should be replaced by the real usage. */
+#define USER_DEFINED_3          0x000040000
+/* User definable trace level. This comment and definition should be replaced by the real usage. */
+#define USER_DEFINED_4          0x000080000
+/* User definable trace level. This comment and definition should be replaced by the real usage. */
+#define USER_DEFINED_5          0x000100000
+/* User definable trace level. This comment and definition should be replaced by the real usage. */
+#define USER_DEFINED_6          0x000200000
+/* User definable trace level. This comment and definition should be replaced by the real usage. */
+#define USER_DEFINED_7          0x000400000
+/* User definable trace level. This comment and definition should be replaced by the real usage. */
+#define USER_DEFINED_8          0x000800000
+
+#define DEVICE_1_MASK           0x0000f000
+#define DEVICE_2_MASK           0x000f0000
+#define DEVICE_3_MASK           0x00f00000
+#define DEVICE_4_MASK           0x0f000000
+
+// Override debug-level definition for your own in MMP file
+#ifndef DEBUG_LEVEL
+#define DEBUG_LEVEL 0x000000FF
+#endif
+
+
+
+#pragma warning(disable : 4127)    // conditional expression is constant
+
+#if defined(_DEBUG) || defined(TRACES)
+
+// Do not directly use this macro
+//lint -emacro({717}, UtilDump)   do while(0)
+//lint -emacro({774}, UtilDump)   conditional expression is constant
+#define UtilDump(PFUNCTION,SRCLEVEL,TRGLEVEL,STRING) \
+        do { \
+            TUint32 _level = (TRGLEVEL); \
+            if (SRCLEVEL & _level) { \
+            PFUNCTION STRING; \
+            } \
+        } while (0)
+
+#ifdef __KERNEL_MODE__
+	#define TraceDump(LEVEL,STRING) UtilDump(Kern::Printf,DEBUG_LEVEL,LEVEL,STRING)
+	#define RTraceDump(LEVEL,STRING) UtilDump(Kern::Printf,iDbgLevel,LEVEL,STRING)
+#else
+	#define TraceDump(LEVEL,STRING) UtilDump(RDebug::Print,DEBUG_LEVEL,LEVEL,STRING)
+	#define RTraceDump(LEVEL,STRING) UtilDump(RDebug::Print,iDbgLevel,LEVEL,STRING)
+#endif
+
+#else  // it is release mode
+//lint -emacro({717}, TraceDump) do while(0)
+#define TraceDump(LEVEL,STRING) do {} while (0)
+//lint -emacro({717}, RTraceDump) do while(0)
+#define RTraceDump(LEVEL,STRING) do {} while (0)
+
+#endif // _DEBUG
+
+
+
+
+#endif // GENDEBUG_H
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/utils/wlantrace.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,473 @@
+/*
+ * wlantrace.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  wlantrace.cpp 
+ *  \brief Handle any event interrupt from the FW
+ *
+ *  \see   
+ */
+
+
+#include <kernel/kernel.h>
+
+#ifdef __cplusplus
+	extern "C" 
+	{
+		#include "CDebugOutput.h"
+	}
+#endif
+
+#include "gendebug.h"
+#define __FILE_ID__								FILE_ID_143
+
+#ifndef LOCAL
+	#define 	LOCAL 	static
+#endif
+
+#if WSTH /* Work station Test Harness */
+	#define OUTPUT(msg) printf msg; printf("\n");
+#else
+	#define OUTPUT(msg) Kern::Printf msg;
+#endif
+
+#define 	TRACE_BUFFER_SIZE 	250
+#define 	MAX_FORMAT_WIDTH 		10 	/* must not be less than 10, which represents a 32 bit value in decimal */
+
+
+TUint gModuleId;
+
+/* order must be the same as that defined in wlanTraceConfig.h */
+const char* const wlanModuleNameStringArray[] = 	{
+																		"wlanResourceManager:",
+																		"wlanSpiManager:",
+																		"wlanPhysicalChannelOmap:",
+																		"wlanIf:",
+																		"wlanControl:",
+																	};
+
+typedef enum
+{
+	uToAFormatDec 	= 10,
+	uToAFormatHex 	= 16
+} utoaFormats;
+
+void Assert( const TInt8* aFile, TInt aLine, TBool aExpression )
+    {
+#ifndef NDEBUG
+
+    if ( !aExpression )
+        {
+        TraceDump( CRIT_LEVEL, (reinterpret_cast<const char*>(aFile)) );
+        TraceDump( CRIT_LEVEL, (("Line: %d"), aLine));
+
+        Kern::Fault(("[WLANPDD] Subsystem programmed fault"), 0);
+        }
+    else
+        {
+        // left intentionally empty
+        }
+
+#endif // NDEBUG
+    }
+
+
+LOCAL TUint32 wlanStrlen(const char* pBuffer)
+{
+	TUint32 	length 	= 0;
+
+	if(pBuffer)
+	{
+		while(*pBuffer++)
+		{
+			length++;
+		}
+	}
+
+	return length;
+}
+
+LOCAL TUint32 wlanStrcpy(char* pDestination, const char* pSource)
+{
+	TUint32 	charactersCopied 	= 0;
+
+	if(pSource && pDestination)
+	{
+		while(*pSource)
+		{
+			*pDestination++ = *pSource++;
+			charactersCopied++;
+		}
+	}
+
+	return charactersCopied;
+}
+
+LOCAL void wlanReverse(char* pStr)
+{
+	TUint32 	start;
+	TUint32 	end;
+	char 		c;
+
+	for(start = 0, end = wlanStrlen(pStr)-1 ; start < end ; start++, end --)
+	{
+		c = *(pStr + start);
+		*(pStr + start) = *(pStr + end);
+		*(pStr + end) = c;
+	}
+}
+
+LOCAL void wlanUtoa(TUint32 n, char* pStr, utoaFormats base, char paddingCharacter, TUint32 width)
+{
+	const char 	uppercaseHexValues[] 	= "0123456789ABCDEF";
+/*	const char 	lowercaseHexValues[] 	= "0123456789abcdef"; never implemented - what is the point.. */
+	TUint32 		i 					= 0;
+
+	do
+	{
+		*(pStr + i++) = uppercaseHexValues[(n % base)];
+		width--; /* may wrap round - but handled by check below */
+	} while ((n /= base) > 0);
+
+	if(width < MAX_FORMAT_WIDTH)
+	{
+		while(width--)
+			*(pStr + i++) = paddingCharacter;
+	}
+		
+	*(pStr + i) = '\0';
+	wlanReverse(pStr);
+}
+
+
+LOCAL bool wlanIsDigit(char character)
+{
+	if(character >= '0' && character <= '9')
+	{
+		return true;
+	}
+	else
+	{
+		return false;
+	}
+}
+
+
+void wlanPrintOutBuffer(char* const pBuffer, const char* const pPrefix, TUint32* bufferLength)
+{
+	*(pBuffer + (*bufferLength)++) = '\0';
+		
+	if(wlanStrlen(pBuffer) > TRACE_BUFFER_SIZE)
+	{
+		OUTPUT(("ERROR:INCREASE TRACE_BUFFER_SIZE - needed %d", *bufferLength))
+	}
+
+#ifdef WSTH
+	printf(pBuffer);
+	printf("\n"); /* STI adds \n normally - but here we have to add it manually */
+#else
+	Kern::Printf(pBuffer);
+#endif
+
+	*bufferLength = 0;
+	*bufferLength += wlanStrcpy((pBuffer + *bufferLength), pPrefix); /* add trace identifier to new line */
+}
+
+
+void wlanPrintf(const char* const pPrefix, const char* pText, VA_LIST args)
+{
+	char 				traceBuffer[TRACE_BUFFER_SIZE];
+	const char* 	pNullString 							= "<NULL>";
+	const char* 	pUnknown 								= "<UPF>"; /* Unknown Print Format */
+	char* 			pString;
+	TUint32 			value;
+	TUint32 			bufferPos 								= 0;
+	TUint32 			error 									= 0;
+	TUint32 			formatWidth;
+	char 				valueBuffer[MAX_FORMAT_WIDTH + 1]; /* for the terminator */
+	char 				paddingChar;
+	
+	if(pText)
+	{
+		bufferPos += wlanStrcpy((traceBuffer + bufferPos), pPrefix); /* add trace identifier to first line */
+		for( ; *pText != '\0' && error == 0 ; pText++)
+		{
+			if (*pText != '%')
+			{
+				if(*pText == '\n')
+				{
+					wlanPrintOutBuffer(traceBuffer, pPrefix, &bufferPos);
+				}
+				else
+				{
+					traceBuffer[bufferPos++] = *pText;
+				}
+				continue;
+			}
+			else
+			{
+				pText++; /* skip % */
+				formatWidth = 0;
+				memset(valueBuffer, 0, MAX_FORMAT_WIDTH); /* reset the width buffer */
+				if(*pText == '0')
+					paddingChar = '0';
+				else
+					paddingChar = ' ';
+
+				while( wlanIsDigit(*pText) || *pText == '.')
+				{
+					if(*pText == '.')
+					{
+						while( wlanIsDigit(*pText) || *pText == '.')
+							pText++;
+						break; /* only deal with leading width - therefore not decimal places - however %f is not supported at time of writting */
+					}
+					else
+					{
+						formatWidth = (formatWidth * 10) + (*pText - '0');
+						pText++;
+					}
+				}
+				if(formatWidth > MAX_FORMAT_WIDTH)
+				{
+					OUTPUT(("ERROR:formatWidth too large - %d", formatWidth))
+					formatWidth = MAX_FORMAT_WIDTH;
+				}
+			}
+			
+			if(*pText == '#')
+			{
+				pText++; /* skip the hash */
+				
+				/* Now look at the formatting character */
+				switch(*pText)
+				{
+					case 'x':
+					case 'X':
+					case 'p':
+						traceBuffer[bufferPos++] = '0';
+						if(*pText == 'p')
+							traceBuffer[bufferPos++] = 'x';
+						else
+							traceBuffer[bufferPos++] = *pText;
+						formatWidth -= 2;
+					break;
+
+					case 'd':
+						/* do nothing - there is no formating needed */
+					break;
+					
+					default:
+						OUTPUT(("ERROR:unknown hash formatting - %c", *pText))
+					break;
+				}
+			}
+			
+			switch (*pText)
+			{
+				case 'd': /* signed */
+					value = va_arg(args, TUint32);
+					if( value & 0x8000000 ) /* MSB 0 = Not signed. MSB 1 = signed*/
+					{
+						/* Signed value */
+						traceBuffer[bufferPos++] = '-'; 
+						/* Ignore MSB which is the sign. Negate and inc by 1 to get the absolute value to be printed. */
+						value = ((~(value & 0x7FFFFFFF) & 0x7FFFFFFF) + 1);
+					}
+					wlanUtoa(value, valueBuffer, uToAFormatDec, paddingChar, formatWidth);
+					bufferPos += wlanStrcpy((traceBuffer + bufferPos), valueBuffer);
+				break;
+				
+				case 'u': /* unsigned */
+					value = va_arg(args, TUint32);
+					wlanUtoa(value, valueBuffer, uToAFormatDec, paddingChar, formatWidth);
+					bufferPos += wlanStrcpy((traceBuffer + bufferPos), valueBuffer);
+				break;
+				
+				case 'X': /* Fall through */
+				case 'x':
+				case 'p':
+					value = va_arg(args, TUint32);
+					wlanUtoa(value, valueBuffer, uToAFormatHex, paddingChar, formatWidth);
+					bufferPos += wlanStrcpy((traceBuffer + bufferPos), valueBuffer);
+				break;
+				
+				case 'c':
+					traceBuffer[bufferPos++] = va_arg(args, int); /* all params are 32 bit - hence int */
+				break;
+				
+				case 's':
+					pString = va_arg(args, char *);
+					if(pString == NULL)
+					{
+						pString = (char*)pNullString;
+					}
+					bufferPos += wlanStrcpy((traceBuffer + bufferPos), pString);
+				break;
+				
+				default:
+					OUTPUT(("ERROR:unknown formating char found - %c", *pText))
+					bufferPos += wlanStrcpy((traceBuffer + bufferPos), pUnknown);
+					/* Break the loop: If we dont know the size of a given argument, we
+						cant know when subsequent arguments start so well have to bail out */
+					error = 1;
+				break;
+			}
+		}
+
+		if( bufferPos > wlanStrlen(pPrefix) )
+		{
+			wlanPrintOutBuffer(traceBuffer, pPrefix, &bufferPos);
+		}
+		
+	}
+}
+
+
+#define WLAN_BYTES_PER_LINE 	32
+void wlanTraceData(TUint moduleId, const char* const pString, const TUint8* const pData, TUint dataLength)
+{
+
+	const char* 	pPrefix = wlanModuleNameStringArray[moduleId];
+	TUint 			writeCounter 	= 0;
+	TUint 			readCounter 	= 0;
+	TUint 			numberOfLines 	= 0;
+	char 				line[WLAN_BYTES_PER_LINE*3+2]; /* 'XX ' = 3 bytes per input byte +2 for safety */
+	char 				character;
+
+	Kern::Printf("%s%s - length 0x%X (%d)", pPrefix, pString, dataLength, dataLength);
+
+	if(dataLength == 0 || !pData)
+	{
+		Kern::Printf("%s:zero length", pPrefix);
+	}
+	else
+	{
+		while(readCounter < dataLength)
+		{
+			character = (char)((pData[readCounter] >> 4) & 0x0f);
+			character = (char)(character + ((character < 0x0a) ? 0x30 : 0x37) );
+			line[writeCounter++] = character;
+
+			character = (char)(pData[readCounter] & 0x0f);
+			character = (char)(character + ( (character < 0x0a) ? 0x30 : 0x37) );
+			line[writeCounter++] = character;
+			line[writeCounter++] = ' ';
+
+			if(writeCounter == WLAN_BYTES_PER_LINE*3 /*&& readCounter < dataLength*/)
+			{
+				line[--writeCounter] = '\0';
+				Kern::Printf("%s[%3d]%s", pPrefix, WLAN_BYTES_PER_LINE*numberOfLines, line);
+				numberOfLines++;
+				writeCounter = 0;
+			}
+			readCounter++;
+		}
+
+		if(writeCounter)
+		{
+			line[--writeCounter] = '\0';
+			Kern::Printf("%s[%3d]%s", pPrefix, WLAN_BYTES_PER_LINE*numberOfLines, line);
+		}
+	}
+}
+
+void wlanTraceAscii(TUint moduleId, const char* const pString, const TUint8* pBuffer, TUint length)
+{
+	char* pAscii = (char*)Kern::Alloc(length + 1);
+	TUint i = 0;
+	while(i < length)
+	{
+		pAscii[i++] = *pBuffer++;
+	}
+	pAscii[length] = '\0';
+	Kern::Printf("%s%s - '%s'", wlanModuleNameStringArray[moduleId], pString, pAscii);
+	Kern::Free(pAscii);
+}
+
+void wlanTrace(const char* const pFormat, ...)
+{
+	VA_LIST args;
+	VA_START(args, pFormat);
+	wlanPrintf(wlanModuleNameStringArray[gModuleId], pFormat, args);
+	VA_END(args);
+}
+
+void wlanTraceLine(TUint moduleId, ... /* pFunction, line */)
+{
+	VA_LIST args;
+	VA_START(args, moduleId);
+	wlanPrintf(wlanModuleNameStringArray[moduleId], "%s - line %d", args);
+	VA_END(args);
+}
+
+void wlanTraceEnterFn(TUint moduleId, ... /* pFunction */)
+{
+	VA_LIST args;
+	VA_START(args, moduleId);
+	wlanPrintf(wlanModuleNameStringArray[moduleId], ":%s+", args);
+	VA_END(args);
+}
+
+void wlanTraceExitFn(TUint moduleId, ... /* pFunction */)
+{
+	VA_LIST args;
+	VA_START(args, moduleId);
+	wlanPrintf(wlanModuleNameStringArray[moduleId], ":%s-", args);
+	VA_END(args);
+}
+
+void wlanTraceProcess(TUint moduleId, ... /* pFunction, thread */)
+{
+	VA_LIST args;
+	VA_START(args, moduleId);
+	wlanPrintf(wlanModuleNameStringArray[moduleId], "%s - Thread = 0x%08x", args);
+	VA_END(args);
+}
+
+
+
+/*void Assert( const signed char* aFile, int aLine, int aExpression )
+    {
+
+    }
+
+#endif */ /*_DEBUG */
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/utils/wlantrace.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,173 @@
+/*
+ * wlantrace.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+	void wlanTrace(const char* const pFormat, ...);
+	void wlanTraceLine(TUint moduleId, ...);
+	void wlanTraceEnterFn(TUint moduleId, ...);
+	void wlanTraceExitFn(TUint moduleId, ...);
+	void wlanTraceProcess(TUint moduleId, ...);
+	void wlanTraceModuleSet(TUint moduleId);
+	void wlanTraceData(TUint moduleId, const char* const pString, const TUint8* const pData, TUint dataLength);
+	void wlanTraceAscii(TUint moduleId, const char* const pString, const TUint8* pBuffer, TUint length);
+	extern TUint gModuleId;
+
+//wlanTraceEnterFn(MODULE_ID, __FUNCTION__);
+//wlanTraceExitFn(MODULE_ID, __FUNCTION__);
+
+
+/* per file basis */
+#if defined(WLAN_TRACE_ENABLED) && (WLAN_TRACE_ENABLED==TRACE_ENABLED)
+
+	#define TRACE(msg) 									{ gModuleId = MODULE_ID; wlanTrace msg; }
+	#define LINE_TRACE() 								wlanTraceLine(MODULE_ID, __FUNCTION__, __LINE__);
+	#define ENTER_FN() 									
+	#define EXIT_FN() 									
+	#define DATA_TRACE(string, data, length) 		wlanTraceData(MODULE_ID, string, (TUint8*)data, length);
+	#define ASCII_TRACE(string, data, length) 	wlanTraceAscii(MODULE_ID, string, (TUint8*)data, length);
+#else
+	#ifndef WLAN_TRACE_ENABLED
+		#error "WLAN_TRACE_ENABLED not defined"
+	#endif
+	
+	#define TRACE(msg) 		;
+	#define LINE_TRACE()
+	#define ENTER_FN()
+	#define EXIT_FN()
+	#define DATA_TRACE(string, data, length)
+	#define ASCII_TRACE(string, data, length)
+#endif
+
+/* globally enabled - not per file */
+#ifndef IRQ_TRACE_ENABLED
+	#error "IRQ_TRACE_ENABLED not defined"
+#else
+	#if (IRQ_TRACE_ENABLED==TRACE_ENABLED)
+		#define IRQ_TRACE(msg) 		{ gModuleId = MODULE_ID; wlanTrace msg; }
+		#define ENTER_IRQ_FN()		wlanTraceEnterFn(MODULE_ID, __FUNCTION__);
+		#define EXIT_IRQ_FN()		wlanTraceExitFn(MODULE_ID, __FUNCTION__);
+	#else
+		#define IRQ_TRACE(msg) 		;
+		#define ENTER_IRQ_FN()
+		#define EXIT_IRQ_FN()
+	#endif
+#endif
+
+#ifndef MEMORY_TRACE_ENABLED
+	#error "MEMORY_TRACE_ENABLED not defined"
+#else
+	#if (MEMORY_TRACE_ENABLED==TRACE_ENABLED)
+		#define MEMORY_TRACE(msg) 		{ gModuleId = MODULE_ID; wlanTrace msg; }
+		#define ENTER_MEMORY_FN()		wlanTraceEnterFn(MODULE_ID, __FUNCTION__);
+		#define EXIT_MEMORY_FN()		wlanTraceExitFn(MODULE_ID, __FUNCTION__);
+	#else
+		#define MEMORY_TRACE(msg) 		;
+		#define ENTER_MEMORY_FN()
+		#define EXIT_MEMORY_FN()
+	#endif
+#endif
+
+#ifndef TIMER_TRACE_ENABLED
+	#error "TIMER_TRACE_ENABLED not defined"
+#else
+	#if (TIMER_TRACE_ENABLED==TRACE_ENABLED)
+		#define TIMER_TRACE(msg) 		{ gModuleId = MODULE_ID; wlanTrace msg; }
+		#define ENTER_TIMER_FN()		wlanTraceEnterFn(MODULE_ID, __FUNCTION__);
+		#define EXIT_TIMER_FN()			wlanTraceExitFn(MODULE_ID, __FUNCTION__);
+	#else
+		#define TIMER_TRACE(msg) 		;
+		#define ENTER_TIMER_FN()
+		#define EXIT_TIMER_FN()
+	#endif
+#endif
+
+#ifndef ERROR_TRACE_ENABLED
+	#error "ERROR_TRACE_ENABLED not defined"
+#else
+	#if (ERROR_TRACE_ENABLED==TRACE_ENABLED)
+		#define ERROR_TRACE(msg) 		{ gModuleId = MODULE_ID; wlanTrace msg; }
+	#else
+		#define ERROR_TRACE(msg) 		;
+	#endif
+#endif
+
+#ifndef PROCESS_TRACE_ENABLED
+	#error "PROCESS_TRACE_ENABLED not defined"
+#else
+	#if (PROCESS_TRACE_ENABLED==TRACE_ENABLED)
+		#define PROCESS_TRACE() 	wlanTraceProcess(MODULE_ID, __FUNCTION__, (TUint32)NKern::CurrentThread() );
+	#else
+		#define PROCESS_TRACE()
+	#endif
+#endif
+
+#ifndef SPI_DATA_TRACE_ENABLED
+	#error "SPI_DATA_TRACE_ENABLED not defined"
+#else
+	#if (SPI_DATA_TRACE_ENABLED==TRACE_ENABLED)
+		#define SPI_DATA_TRACE(string, data, length) 	wlanTraceData(MODULE_ID, string, (TUint8*)data, length);
+	#else
+		#define SPI_DATA_TRACE(string, data, length)
+	#endif
+#endif
+
+#ifndef PACKET_DATA_TRACE_ENABLED
+	#error "PACKET_DATA_TRACE_ENABLED not defined"
+#else
+	#if (PACKET_DATA_TRACE_ENABLED==TRACE_ENABLED)
+		#define PACKET_TRACE(string, data, length) 	wlanTraceData(MODULE_ID, string, (TUint8*)data, length);
+	#else
+		#define PACKET_TRACE(string, data, length)
+	#endif
+#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/utils/wlantraceconfig.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,99 @@
+/*
+ * wlantraceconfig.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+/* order matches that in CDebugOutput.cpp */
+#define WLAN_MODULE_ID_WLAN_OSA			 			0
+#define WLAN_MODULE_ID_SPI_CLIENT 				1
+#define WLAN_MODULE_ID_WLAN_WHA				 		2
+#define WLAN_MODULE_ID_SPIA	 					3
+#define WLAN_MODULE_ID_CONTROL 					4
+#define WLAN_MODULE_ID_WLAN_HPA                  5
+
+
+#define TRACE_ENABLED 	1
+#define TRACE_DISABLED 	2
+
+
+#ifdef _DEBUG
+	/* UDEB */
+	/* enable all TI trace - check MACROs in wlanpdd.mmh */
+	#if defined(REPORT_LOG) && defined(TI_DBG)
+		#define WLAN_TI_TRACE_ENABLED 			TRACE_ENABLED
+	#else
+		#define WLAN_TI_TRACE_ENABLED 			TRACE_DISABLED //trace is disabled because it is not enabled in wlanpdd.mmh
+	#endif
+
+	/* file specific */
+	#define WLAN_OSA				 			TRACE_DISABLED
+	#define WLAN_SPI_CLIENT 					TRACE_DISABLED
+	#define WLAN_WHA				 			TRACE_DISABLED
+	#define WLAN_SPIA 							TRACE_DISABLED
+	#define WLAN_CONTROL 						TRACE_DISABLED
+    #define WLAN_HPA 						    TRACE_DISABLED
+	
+	/* action specific */
+	#define PROCESS_TRACE_ENABLED 			TRACE_DISABLED
+	#define IRQ_TRACE_ENABLED 				TRACE_DISABLED
+	#define PACKET_DATA_TRACE_ENABLED 		TRACE_DISABLED
+	#define SPI_DATA_TRACE_ENABLED 			TRACE_DISABLED
+	#define TIMER_TRACE_ENABLED 				TRACE_DISABLED
+	#define MEMORY_TRACE_ENABLED 				TRACE_DISABLED
+
+	/* should always be enabled - to show any errors */
+	#define ERROR_TRACE_ENABLED 				TRACE_ENABLED
+
+#else
+	/* UREL */
+	/* Must be disbled in urel build - will not compile if it is not!!! */
+	#define WLAN_TI_TRACE_ENABLED 			TRACE_DISABLED
+	#define WLAN_OSA				 			TRACE_DISABLED
+	#define WLAN_SPI_CLIENT 					TRACE_DISABLED
+    #define WLAN_WHA 							TRACE_DISABLED
+    #define WLAN_SPIA 							TRACE_DISABLED
+	#define WLAN_CONTROL 						TRACE_DISABLED
+    #define WLAN_HPA 						    TRACE_DISABLED
+
+	#define PROCESS_TRACE_ENABLED 			TRACE_DISABLED
+	#define IRQ_TRACE_ENABLED 					TRACE_DISABLED
+	#define PACKET_DATA_TRACE_ENABLED 		TRACE_DISABLED
+	#define SPI_DATA_TRACE_ENABLED 			TRACE_DISABLED
+	#define TIMER_TRACE_ENABLED 				TRACE_DISABLED
+	#define MEMORY_TRACE_ENABLED 				TRACE_DISABLED
+	#define ERROR_TRACE_ENABLED 				TRACE_DISABLED
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWha.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,4387 @@
+/*
+ * TIWha.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWha.cpp 
+ *  \brief  Interface between the Symbian to the WVSS WLAN WL6.1 Driver
+ *
+ *  \see   
+*/
+
+#include "TIWha.h"
+#include "TIWhaAdaptCb.h"
+#include "wlanhwbusaccesslayer.h"
+#ifdef GEM_SUPPORT
+#include "TIWhaGemDef.h"
+#endif /* GEM_SUPPORT */
+
+/* The fw that we are using in case it isn't contained in aData */
+#include "wilink6_firmware.h"
+
+#ifdef WLAN_SDIO
+#include "SdioClient.h"
+#endif //WLAN_SDIO
+
+
+const TInt KWlanDriverMajorVersion = 1;
+const TInt KWlanDriverMinorVersion = 0;
+const TInt KWlanDriverBuildVersion = 0;
+const TUint KWlanUnitsAllowedMask = 0x0000000F;
+
+
+/*******************************************************************************
+ * stuff for C file linking.                                                   *
+ *******************************************************************************/
+
+extern "C" 
+{
+#include "tidef.h"
+#include "report.h"
+#include "timer.h"
+#include "TWDriver.h"
+#include "version.h"
+#include "osApi.h"
+#include "context.h"
+#include "public_commands.h"
+//#include "public_radio.h"
+#include "TxnQueue.h"
+#include "BusDrv.h"
+#define __FILE_ID__								FILE_ID_144
+}
+
+#define MAX_NUM_OF_TX_QUEUES	4 
+#define TX_TOTAL_OFFSET_BEFORE_DATA (WSPI_PAD_LEN_WRITE + TX_DESCRIPTOR_SIZE)
+
+/* Stalling the CPU of OAMP3430 for 2Ms */
+#define STALL_ON_CPU 2000
+
+/* In case of a KFailed we use the Assert() function as indicated in the spec, but return KSuccess */
+#define ASSERT_MI2(hrep,mib,exp,file,func,line)              \
+        if ((exp) != WHA::KSuccess) {                             \
+            TRACE2(hrep, REPORT_SEVERITY_ERROR ,  " failed, mib=%d, file=, line=%d\n", mib, line);    \
+            MWlanOsa::Assert( (const TInt8 *)file, line, EFalse ); \
+            return WHA::KSuccess;                                  \
+        }
+        
+#define ASSERT_MIB(hrep,mib,exp)                             \
+        ASSERT_MI2(hrep,mib,exp, __FUNCTION__,__FUNCTION__,__LINE__)
+
+
+#define ASSERT_ER2(hrep,fmsg,par,line)             \
+        TRACE1(hrep, REPORT_SEVERITY_ERROR,  fmsg, par);    \
+        //MWlanOsa::Assert( (const TInt8 *)file, line, EFalse ); 
+
+#define ASSERT_ERR(hrep,fmsg,par)                            \
+        ASSERT_ER2(hrep,fmsg,par,__LINE__)
+
+
+#define FREF_CLK_FREQ_MASK      0x7
+
+
+/************************************************************************************/
+
+/** 
+* \fn     Create
+* \brief  static create
+* 
+* Just call constructor 
+*
+* \note   
+* return   handle to TIWha class. 
+* \sa     
+*/ 
+WHA::Wha* WHA::Wha::Create(MWlanOsa& aOsa, WlanHpa& aHpa, const SHwBusAccessLayer& aTransPortLayer)
+{
+    return new TIWha (aOsa, aHpa, *(aTransPortLayer.iSpia));
+}
+
+
+/** 
+* \fn     Destroy
+* \brief  static destroy
+* 
+* Just call destructor 
+*
+* \note   
+* \sa     
+*/ 
+void WHA::Wha::Destroy(Wha* aWha)
+{
+    delete aWha;
+}
+
+/** 
+* \fn     TIWha
+* \brief  Constructor
+* 
+* This method is the default constructor,all modules mamory alocation 
+* and software configuration (not sending any thing via BUS to the firmware)
+* 
+* \note   
+* return   handle to TIWha class. 
+* \sa     
+*/ 
+TIWha::TIWha(MWlanOsa& aOsa, WlanHpa& aHpa, WlanSpia& aSpia)
+: Wha(aOsa, aHpa, aSpia) /* Construct the base class */  
+{
+    /* Before initializing the report module, we should use the WLAN_OS_REPORT macro */
+    WLAN_INIT_REPORT (("TIWha constructor ++\n"));
+    WLAN_INIT_REPORT(("Driver Version  : %s\n", SW_VERSION_STR));
+
+    /* tOsContext (hOS is made of MWlanOsa and WlanSpia */
+    iTwdCtrl.tOsContext.hOsa = &aOsa;
+    iTwdCtrl.tOsContext.hSpia = &aSpia;
+    iTwdCtrl.tOsContext.hHpa = &aHpa;
+
+    /* Nullify handles to mark that it wasn't created yet */
+    iTwdCtrl.hTWD = NULL;
+    iTwdCtrl.hReport = NULL;
+    iTwdCtrl.hReport = NULL;
+    iTwdCtrl.hContext = NULL;
+    iTiWlanHpaCb = NULL;    
+    /* indicate that no error indication was called */
+    bErrorIndication = TI_FALSE;
+
+    bConnectionTimerRunning = TI_FALSE;
+    /* indicate that TIWha::Release() should be called directly if we have error indication */
+    bCallRelease = TI_TRUE;
+	bFreeDriver	 = TI_FALSE;
+	bRxMemFailTimerRunning = TI_FALSE;
+    uRxMemFailCount = 0;
+
+    bFailureIndication = TI_FALSE;
+
+	/* Initilaize Timer handle */
+	readDot11StationIdMibTmr = NULL;
+
+    /* Set the join flag to false */
+    bJoined = 0;
+    
+    iConnectionCounter = 0;
+
+    #ifdef HT_SUPPORT
+	    /* Reset the BA Vectors */
+	    iTxBlockAckUsageLast = 0;
+        iRxBlockAckUsageLast = 0;
+    #endif
+
+    
+    pFailureDfcClient = new TIFailureDfcClient(*iTwdCtrl.tOsContext.hOsa);
+    if (pFailureDfcClient == NULL)
+    {
+        WLAN_OS_REPORT (("ERROR: CreateDriver TIFailureDfcClient failure\n"));        
+    }
+
+    pConnectDfcClient = new TIConnectDfcClient(*iTwdCtrl.tOsContext.hOsa);
+    if (pConnectDfcClient == NULL)
+    {
+        WLAN_OS_REPORT (("ERROR: CreateDriver TIConnectDfcClient failure\n"));        
+    }
+    
+    WLAN_INIT_REPORT (("TIWha constructor -- \n"));
+}
+
+
+TIWha::TIWha() 
+: Wha (*iTwdCtrl.tOsContext.hOsa,*iTwdCtrl.tOsContext.hHpa,*iTwdCtrl.tOsContext.hSpia)
+{
+    iVersion = TVersion( KWlanDriverMajorVersion, 
+        KWlanDriverMinorVersion,KWlanDriverBuildVersion );
+    iUnitsMask = KWlanUnitsAllowedMask;
+    bDriverCreated = TI_TRUE;
+/* Nullify handles to mark that it wasn't created yet */
+    iTwdCtrl.hTWD = NULL;
+    iTwdCtrl.hReport = NULL;
+    iTwdCtrl.hReport = NULL;
+    iTwdCtrl.hContext = NULL;
+    iTiWlanHpaCb = NULL; 
+    /* indicate that no error indication was called */
+    bErrorIndication = TI_FALSE;
+
+    bConnectionTimerRunning = TI_FALSE;
+    /* indicate that TIWha::Release() should be called directly if we have error indication */
+    bCallRelease = TI_TRUE;
+	bFreeDriver	 = TI_FALSE;
+	bRxMemFailTimerRunning = TI_FALSE;
+    uRxMemFailCount = 0;
+
+    bFailureIndication = TI_FALSE;
+
+	/* Initilaize Timer handle */
+	readDot11StationIdMibTmr = NULL;
+
+    /* Set the join flag to false */
+    bJoined = 0;
+    
+    iConnectionCounter = 0;
+
+    #ifdef HT_SUPPORT
+	    /* Reset the BA Vectors */
+	    iTxBlockAckUsageLast = 0;
+        iRxBlockAckUsageLast = 0;
+    #endif
+
+    WLAN_INIT_REPORT (("TIWha constructor -- \n"));
+}
+
+
+/** 
+* \fn     CreateDriver
+* \brief  Create driver modules
+* 
+* Create 'report', 'context', 'TWD', 'HpaCb'
+*
+* \note   In case of failure, The modules will be released later in DestroyDriver();
+* \sa     
+*/ 
+TI_STATUS TIWha::CreateDriver()
+{
+    WLAN_INIT_REPORT (("CreateDriver ++\n"));
+    
+
+    /* Create utils and TWD */
+    iTwdCtrl.hReport  = report_Create ((TI_HANDLE)&iTwdCtrl.tOsContext);
+    if (iTwdCtrl.hReport == NULL)
+    {
+        WLAN_OS_REPORT (("ERROR: CreateDriver report_Create failure\n"));
+        return TI_NOK;
+    }
+    InitReportParamTable ();    
+    report_SetDefaults (iTwdCtrl.hReport, &(iTwdCtrl.report_init));
+    
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT,  "CreateDriver");
+
+    /* Create context module */
+    iTwdCtrl.hContext       = context_Create ((TI_HANDLE)&iTwdCtrl.tOsContext);
+    if (iTwdCtrl.hContext == NULL)
+    {
+        WLAN_OS_REPORT (("ERROR:CreateDriver context_Create failure\n"));
+        return TI_NOK;
+    }
+
+    /* Create Timer module */
+    iTwdCtrl.hTimer = tmr_Create ((TI_HANDLE)&iTwdCtrl.tOsContext);
+    if (iTwdCtrl.hTimer == NULL)
+    {
+        WLAN_OS_REPORT (("ERROR:CreateDriver tmr_Create failure\n"));
+        return TI_NOK;
+    }
+
+    /* Create TxnQ */
+    iTwdCtrl.hTxnQ = txnQ_Create ((TI_HANDLE)&iTwdCtrl.tOsContext);
+    if (iTwdCtrl.hTxnQ == NULL)
+    {
+        WLAN_OS_REPORT (("ERROR:CreateDriver txnQ_Create failure\n"));
+        return TI_NOK;
+    }
+
+    /* Create TWD */
+    iTwdCtrl.hTWD = TWD_Create ((TI_HANDLE)&iTwdCtrl.tOsContext);
+    if (iTwdCtrl.hTWD == NULL)
+    {
+        WLAN_OS_REPORT (("ERROR:CreateDriver TWD_Create failure\n"));
+        return TI_NOK;
+    }
+
+    /* Create HpaCb */
+    iTiWlanHpaCb = new TIWlanHpaCB (iTwdCtrl.hTWD);
+    if (iTiWlanHpaCb == NULL)
+    {
+        WLAN_OS_REPORT (("ERROR:CreateDriver new TIWlanHpaCB failure\n"));
+        return TI_NOK;
+    }
+
+    return TI_OK;
+}
+
+/** 
+* \fn     DestroyDriver
+* \brief  destroy driver modules
+* 
+* Destroy 'report', 'context', 'TWD', 'HpaCb' only if it is not NULL
+*
+* \sa     
+*/ 
+void TIWha::DestroyDriver()
+{
+    WLAN_OS_REPORT(("DestroyDriver\n"));
+
+    /* Delete TWD and utils */
+    if (iTwdCtrl.hTWD != NULL)
+    {
+        TWD_Destroy (iTwdCtrl.hTWD);
+        /* Avoid future destroy of TWD */
+        iTwdCtrl.hTWD = NULL;
+    }
+
+	if (iTwdCtrl.hTxnQ)
+	{
+		txnQ_Destroy(iTwdCtrl.hTxnQ);
+		iTwdCtrl.hTxnQ = NULL;
+	}
+
+    if (iTwdCtrl.hContext != NULL)
+    {
+        context_Destroy (iTwdCtrl.hContext);
+        /* Avoid future destroy of context */
+        iTwdCtrl.hContext = NULL;
+    }
+    if (iTwdCtrl.hTimer != NULL)
+    {
+        tmr_Destroy (iTwdCtrl.hTimer);
+        /* Avoid future destroy of timer */
+        iTwdCtrl.hTimer = NULL;
+    }
+    if (iTiWlanHpaCb != NULL)
+    {
+        delete iTiWlanHpaCb;
+        /* Avoid future destroy of HpaCb */
+        iTiWlanHpaCb = NULL;    
+    }
+    if (iTwdCtrl.hReport != NULL)
+    {
+        report_Unload (iTwdCtrl.hReport);
+        /* Avoid future destroy of report */
+        iTwdCtrl.hReport = NULL;
+    }
+	
+    if (readDot11StationIdMibTmr != NULL)
+    {
+        os_timerDestroy(0,readDot11StationIdMibTmr);
+        readDot11StationIdMibTmr = NULL;
+    }    
+
+    if (hConnectionTimer != NULL)
+    {
+        os_timerDestroy(0,hConnectionTimer);
+        hConnectionTimer = NULL;
+    }
+
+    if (hInitializeTimer != NULL) 
+    {
+        os_timerDestroy(0,hInitializeTimer);
+        hInitializeTimer = NULL;
+    }
+
+    if (hRxMemFailTimer != NULL)
+    {
+        os_timerDestroy(0,hRxMemFailTimer);
+        hRxMemFailTimer = NULL;
+    }
+
+}
+
+/** 
+* \fn     ~TIWha
+* \brief  destructor
+* 
+* 
+* \note   Release is called here if it was not called from UMAC
+* \param  
+* \return   
+* \sa     
+*/ 
+TIWha::~TIWha()
+{  
+    /* Delete iFailureDfcClient */
+    if (pFailureDfcClient != NULL)
+    {        
+        /* Either succeeds or has no effect */
+        pFailureDfcClient->pFailureDfc->Dequeue();
+        /* Osa owns this. Will be deleted there. */
+        pFailureDfcClient->pFailureDfc = NULL;
+        
+        delete pFailureDfcClient;        
+    }
+    
+    /* Delete iConnectDfcClient */
+    if (pConnectDfcClient != NULL)
+    {        
+        /* Either succeeds or has no effect */
+        pConnectDfcClient->pConnectDfc->Dequeue();
+        /* Osa owns this. Will be deleted there. */
+        pConnectDfcClient->pConnectDfc = NULL;
+
+        delete pConnectDfcClient;        
+    }
+    
+    WLAN_INIT_REPORT(("~TIWha\n"));   
+}
+
+/** 
+* \fn     Initialize
+* \brief  Initialize the WLAN driver (memory allocation and modules software init. )
+*
+* \note   
+* Downloads the firmware code to the WLAN device.
+* /param aData - firmware data
+* /param aLength - length of the data in bytes
+* /return  
+*/
+void TIWha::Initialize(const void* aData, TUint32 aLength)
+{
+    iData = aData;
+    iLength = aLength;
+
+    WLAN_INIT_REPORT (("Initialize ++ \n"));
+    #ifdef TI_TEST
+	    iQueueId = WHA::ELegacy;
+    #endif /* TI_TEST*/
+
+    /* configure HPA polarity according to CHIP configuration */
+    #ifdef USE_IRQ_ACTIVE_HIGH
+        WlanHpa::TConfig tConfig = {WlanHpa::EIsrPolarityHigh};
+    #else
+        WlanHpa::TConfig tConfig = {WlanHpa::EIsrPolarityLow};
+    #endif
+
+    iRxPacketsAllocated = 0;
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT,  " IRQ is ");
+
+    /* if we were called from failure indication then we don't reconfigure the HPA */
+    if (bFailureIndication == TI_FALSE )
+    {
+        ((WlanHpa*)iTwdCtrl.tOsContext.hHpa)->Configure(tConfig);
+    }    
+
+
+    /* Power up the chip */
+    ((WlanHpa*)iTwdCtrl.tOsContext.hHpa)->PowerOnDevice();
+#ifdef WLAN_SDIO
+    os_StalluSec ((TI_HANDLE)&iTwdCtrl.tOsContext, 200000 );
+#endif
+
+    /* Create all modules */
+    if ( CreateDriver() != TI_OK)
+    {
+        WLAN_OS_REPORT (("Error on CreateDriver() \n"));
+        InitResponse (WHA::KFailed);        
+    }
+
+    /* Attach our client to HPA */
+    ((WlanHpa*)iTwdCtrl.tOsContext.hHpa)->Attach(*iTiWlanHpaCb);
+    /* Configure the context module */
+    context_Init (iTwdCtrl.hContext, (TI_HANDLE)&iTwdCtrl.tOsContext,iTwdCtrl.hReport);
+
+    /* Initialize timer module */
+    tmr_Init (iTwdCtrl.hTimer, (TI_HANDLE)&iTwdCtrl.tOsContext, iTwdCtrl.hReport, iTwdCtrl.hContext);
+
+    hInitializeTimer = os_timerCreate(&iTwdCtrl.tOsContext,(fTimerFunction)TIWhaAdaptCB::InitializeAfterTimer,this);
+
+#ifndef WLAN_SDIO
+    /* Wait some time for the HW to complete initialization */
+    os_timerStart (&iTwdCtrl.tOsContext,hInitializeTimer,200);
+#else
+    InitializeAfterTimer();
+#endif
+}
+
+
+ /** 
+ * \fn     InitializeAfterTimer
+ * \brief  start second part of initialization after timer expired
+ *          
+ * \note    
+ * \param  
+ * \return  
+ * \sa      
+ */ 
+void TIWha::InitializeAfterTimer()
+{
+    TI_STATUS status;
+    TUint8* data = (TUint8*)iData;
+    TUint8* pRadio;
+
+    TUint32 nvsLength = 0;
+    TUint32 radioLength = 0;
+
+    /* Create a connection timer that will be triggered after Join command */
+    hConnectionTimer = os_timerCreate(&iTwdCtrl.tOsContext,(fTimerFunction)TIWhaAdaptCB::ConnectionTimeOut,this); 
+    if (hConnectionTimer == NULL)
+    {
+ 	WLAN_OS_REPORT(("Error Failed to create hConnectionTimer"));
+    }
+
+    /* Create a timer for losing context for Station ID Mib */
+    readDot11StationIdMibTmr = os_timerCreate(&iTwdCtrl.tOsContext,(fTimerFunction)TIWhaAdaptCB::ReadDot11StationIdCb,this); 
+    if (readDot11StationIdMibTmr == NULL)
+    {
+        WLAN_OS_REPORT(("Error Faild to create readDot11StationIdMibTmr"));
+    }
+    	
+    /* Create a timer in case RequestForBuffer fails */
+    hRxMemFailTimer = os_timerCreate(&iTwdCtrl.tOsContext,(fTimerFunction)TIWhaAdaptCB::RxMemFailTimerCb,this); 
+    if (hRxMemFailTimer == NULL)
+    {
+        WLAN_OS_REPORT(("Error Faild to create hRxMemFailTimer"));
+    }
+
+    /* enable timer operation */    
+    tmr_UpdateDriverState (iTwdCtrl.hTimer, TI_TRUE);
+    
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT,  "init TWD");
+    /*init the txnq */
+    
+    txnQ_Init (iTwdCtrl.hTxnQ,
+               (TI_HANDLE)&iTwdCtrl.tOsContext,
+    	  iTwdCtrl.hReport,
+               iTwdCtrl.hContext);
+
+	/* Next section retrieves the pointer and Lenght of NVS & FW accordingly in th eaData Buf */
+
+    /* 
+    aData structue :
+    ____________________________________________________________________________________________
+    |         |               |            |              |          |                          |
+    |NVS Len  | NVS File      |  Radio Len | Radio File   | FW Len   |  FW File                 |
+    |4 Bytes  | WiLink6_nvs.h | 4 Bytes    | radio_ini.h  | 4 Bytes  |  WiLink6_firmware.h      |
+    |_________|_______________|____________|______________|__________|__________________________|
+
+    */
+	
+    #ifdef _SYMBIAN_  
+    	nvsLength = *reinterpret_cast<const TUint32*>(&data[0]); 
+    	radioLength = *reinterpret_cast<const TUint32*>(&data[sizeof(TUint32) + nvsLength]);            
+    	TUint32 fwLength = *reinterpret_cast<const TUint32*>(&data[sizeof(TUint32) + nvsLength + sizeof(TUint32) + radioLength]);
+        
+        /* in case no fw in aData, use wilink6_firmware */
+        if (fwLength == 0 )
+        {
+            WLAN_OS_REPORT(("TIWha::Initialize:: Taking default fw"));	
+            iFwFile.pBuffer = (TI_UINT8*)wilink6_firmware;
+        }
+        else
+        {
+            WLAN_OS_REPORT(("TIWha::Initialize::received fw from LDD, fwLength : %d", fwLength ));  
+            /* Update first FW Pointer to be the one residing in the firmware array from the fw1273_chip.h */            
+            iFwFile.pBuffer = data + 3*sizeof(TUint32) + nvsLength + radioLength;
+        }
+    
+    	/* Retrieve NVS pointer & Lenght */
+        ipNVSbuf = data + sizeof(TUint32);
+        iNVSlength = nvsLength;
+    
+        /* Copy the content of NVS Buffer for saving the MAC Address and Burst Read to be retrieved back when NVS 
+        Array is received back from the FW */
+        os_memoryCopy(iTwdCtrl.tOsContext.hOsa,iNvsStart,ipNVSbuf,24);
+    
+        /* FEM Auto Detection */
+        /* Retrieve Radio pointer  */
+        pRadio =  data + sizeof(TUint32) + nvsLength + sizeof(TUint32);
+    
+        /* save Radio params*/    
+        os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iAutoRadioParams.tGeneralParams, pRadio, GENERAL_RADIO_PARAM_LEN);    
+        os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iAutoRadioParams.tStatRadioParams, (TUint8*)(pRadio + STATIC_RADIO_PARAM_OFFSET), STATIC_RADIO_PARAM_LEN);
+        os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iAutoRadioParams.tDynRadioParams[0], (TUint8*)(pRadio + FEM0_DYNAMIC_RADIO_PARAM_OFFSET), DYNAMIC_RADIO_PARAM_LEN);
+        os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iAutoRadioParams.tDynRadioParams[1], (TUint8*)(pRadio + FEM1_DYNAMIC_RADIO_PARAM_OFFSET), DYNAMIC_RADIO_PARAM_LEN);
+            
+    #else   /* Other OS */
+		/* Retrieve FW pointer  */
+		iFwFile.pBuffer = (TI_UINT8*)wilink6_firmware;
+
+        /*saving  NVS pointer */
+        ipNVSbuf = (uint8*)aData;
+        /* Set NVS length */
+        iNVSlength = aLength;
+  
+      	/* Copy the content of NVS Buffer frir saving the MACF Address and Burst Read to be retrieved back when NVS 
+        Array is receuved back from the FW */
+        os_memoryCopy(iTwdCtrl.tOsContext.hOsa,iNvsStart,ipNVSbuf,24);
+
+        /* FEM Auto Detection fill radio params */
+        /*FillRadioData();*/
+
+    #endif
+    
+    #if TI_DBG
+        WLAN_OS_REPORT(("TIWha::Initialize::nvsLength : %d", nvsLength ));
+        WLAN_OS_REPORT(("TIWha::Initialize::radioLength : %d", radioLength ));  
+    #endif
+   
+    WLAN_OS_REPORT((" in Initialize calling txnQ_ConnectBus "));
+    /* Configure the bus - in WSPI configuration is done internaly */
+    /* This will download the FW image into part with DMA of 512 bytes each time */    
+    BusDrvCfg.tSdioCfg.uBlkSizeShift = SDIO_BLK_SIZE_SHIFT_DEF;
+    status = txnQ_ConnectBus (iTwdCtrl.hTxnQ, &BusDrvCfg,(TTxnDoneCb)TIWhaAdaptCB::ConnectBus,this,NULL,NULL);
+
+    /* If the bus connect is sync, then we should lose the context and call the CB */
+    if (status == TI_OK) 
+    {        
+        /* Register ConnectDfcClient to handle the connect bus CB from a different context */
+        pConnectDfcClient->pConnectDfc->Enqueue(*pConnectDfcClient ,(TInt)this);        
+    }    
+    #ifdef OMAP3430_CPU_STALL
+	    /* Add a stall to make sure that CPU is not going idle while initializing */
+        os_StalluSec ((TI_HANDLE)&iTwdCtrl.tOsContext, STALL_ON_CPU );
+    #endif
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT,  "TIWha::Initialize --");
+}
+
+/** 
+* \fn     Configure
+* \brief  Configures the WLAN device after firmware download and basic 
+*                 chip init has taken place
+* \note   
+* Method configures the WLAN device after the WHA layer has send the 
+* EInitializeResponse event. Only after calling this method, 
+* WLAN device is ready for use. 
+* Note: the memory supplied by the command is valid to point the 
+* corresponding command response event is send
+*
+* 
+* /param aData firmware - data. The content is vendor specific.
+* /param aWhaSettings - output data that holds the capabilities 
+* of the WLAN vendor specific solution. 
+* \return   
+* \sa  
+*/
+void TIWha::Configure(  const WHA::SConfigureData&    aData,
+							WHA::SSettings&               aWhaSettings) 
+{                                             
+    TFwInfo             *tChipVer;
+    TI_UINT8            *pMac;  
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT,  "WHA-Configure +");
+
+    /* Enable interrupts on HPA */
+    ((WlanHpa*)iTwdCtrl.tOsContext.hHpa)->EnableIrq();
+    
+    TWD_EnableInterrupts (iTwdCtrl.hTWD);
+
+    /* Call the function to fill all the parameters in the NWSA Settings */
+    FillNWSASettings (&aWhaSettings);
+
+    /* Retrieve FW information from TWD */
+    tChipVer= TWD_GetFWInfo (iTwdCtrl.hTWD);
+    pMac = (TI_UINT8 *)tChipVer->macAddress;
+
+    /* Update driver's MAC address */
+    MAC_COPY (iTwdCtrl.pMacAddr, tChipVer->macAddress);
+
+    /*
+     *  Exit from init mode should be before smeSM starts. this enable us to send
+     *  command to the MboxQueue(that store the command) while the interrupts are masked.
+     *  the interrupt would be enable at the end of the init process.
+     */
+    TWD_ExitFromInitMode (iTwdCtrl.hTWD);
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, " TIWha::Configure : Before Config HW");
+    if (TWD_ConfigFw (iTwdCtrl.hTWD) != TI_OK)
+    {
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, " TIWha:: TWD_ConfigFw returned error");        
+        ConfigFwCb( WHA::KFailed);
+        return;
+    }
+    
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, "EXIT FROM INIT\n");
+
+    /* Print the driver and firmware version and the mac address */
+    WLAN_OS_REPORT(("\n"));
+    WLAN_OS_REPORT(("--------------------------------------------------------------------\n"));
+    WLAN_OS_REPORT(("Driver Version  : %s\n", SW_VERSION_STR));
+    WLAN_OS_REPORT(("Firmware Version: %s\n", tChipVer->fwVer));
+    WLAN_OS_REPORT(("Station ID      : %02X-%02X-%02X-%02X-%02X-%02X\n",
+    				pMac[0], pMac[1], pMac[2], pMac[3], pMac[4], pMac[5]));
+    WLAN_OS_REPORT(("--------------------------------------------------------------------\n"));
+    WLAN_OS_REPORT(("\n"));
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, "WHA-Configure --");
+}                                             
+
+
+/** 
+* \fn     Release
+* \brief  Destroy TWD and utils
+* \note   
+*           Any symbian classes (sandbox) will be deleted in the destructor
+* 
+* /param aSynchronous - not used
+* \return KSuccess  
+* \sa  
+*/
+WHA::TStatus TIWha::Release( TBool aSynchronous )
+{
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, "\n");
+    
+    /* Power off chip */
+    ((WlanHpa*)iTwdCtrl.tOsContext.hHpa)->PowerOffDevice();
+    
+    /* Delete all modules */
+    DestroyDriver();
+    
+    return WHA::KSuccess;
+}
+
+/**
+* Note: The WLAN host driver does not issue this command while measure
+* or 802.11 power management mode transition process is in progress.
+* This method commands the WLAN device to start scanning in order to 
+* determine the characteristics of the available BSSs and IBSSs to which 
+* it may later to elect to join. 
+* When the WLAN device receives this command, 
+* it goes into a scanning mode. 
+* The WHA layer sends the EScanCommandResponse event to inform the 
+* WLAN host driver that the WLAN vendor specific 
+* solution has accepted the command. 
+* For each command there will be both EScanCommandResponse and 
+* EScanComplete event regardless the fact if the scan did start or not.
+* If the WLAN device is able to start the scanning process, all beacons
+* and Probe response frames are sent to the WLAN host driver. 
+* When the scanning has completed, the WHA layer sends the EScanComplete
+* event to inform the WLAN host driver that the scan process has 
+* completed in the WLAN device. 
+* Note: while this command is in progress it disables the current Rx 
+* frame filtering settings for the duration of the scan. 
+* This means that only beacon and probe response frames are forwarded to
+* the WLAN host driver (unless doing a split scan) in depended of the 
+* current configuration related to Rx frame handling. 
+* Note: scanning must be supported by the WLAN vendor specific solution 
+* both in infrastructure and IBSS mode. 
+* Although frames can be lost in IBSS mode due to scanning, 
+* support for it is required.
+*
+* 
+* /param aMaxTransmitRate - specifies the transmission rate of the 
+* probe request in case of a active scan 
+* Note: just a single rate is selected not multiple as rate fallback 
+* is not to be used during the scan process
+* /param aBand - selects the used frequency band. 
+* Only 1 band is scanned at a time 
+* and 1 bit is used to select the band to be scanned
+* /param aNumOfChannels - number of channels provided in the command
+* /param aChannels - specifies the scanned channels
+* /param aScanType - specifies the scan type:
+* 0 foreground scan
+* 1 background scan
+* 2 forced background scan
+* /param aNumOfProbeRequests - number of probe requests (per SSID)
+* sent to one (1) channel. 
+* Zero (0) means that none is send, 
+* which means that a passive scan is to be done.  
+* Value greater than zero (0) means that an active scan is to be done
+* /param aSplitScan - ETrue if a split scan method is to be used. 
+* EFalse if not
+* /param aNumOfSSID - number of SSID provided in the scan command 
+* (this is zero (0) in broadcast scan)
+* /param aSsid - Array of the SSID to be probed in scan
+*/
+#ifdef PLT_TESTER
+TTestCmd tTest;
+#endif /* PLT_TESTER */
+void TIWha::Scan(   WHA::TRate                  aMaxTransmitRate, 
+						WHA::TBand                  aBand,
+						TUint8                      aNumOfChannels,
+						const WHA::SChannels*   aChannels, 
+						WHA::TScanType               aScanType,
+						TUint8                      aNumOfProbeRequests,
+						TBool                       aSplitScan,
+						TUint8                      aNumOfSSID,
+						const WHA::SSSID*       aSsid)
+{
+    E80211PsMode             PS_mode;
+    TBool                    bEnterPS;				 /* whether to enter PS */
+    TBool                    bScanOnDriverModeError; /* Forced background option */
+    
+    
+#ifdef PLT_TESTER
+//OpenAllReports();
+WLAN_OS_REPORT(("**************************************\n"));
+WLAN_OS_REPORT(("PLT_TESTER\n"));
+WLAN_OS_REPORT(("**************************************\n"));
+
+	iRealPlt = 0;
+
+	os_printf("************ PLT Test os_printf working ***************\n");
+	PltSm(NULL);
+
+
+return;
+#endif /* PLT_TESTER */
+
+
+
+
+    TRACE4(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TIWha::Scan: aMaxTransmitRate %d aBand %d aNumOfChannels %d aScanType 0x%x\n",        aMaxTransmitRate, aBand, aNumOfChannels, aScanType);
+
+    TRACE4(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TIWha::Scan: aNumOfProbeRequests %d aSplitScan %d aNumOfSSID %d aSsid.Len %d\n",        aNumOfProbeRequests, aSplitScan, aNumOfSSID, aSsid->iSSIDLength);
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "[WLANPDD] WHA-Scan +");
+    
+    /* 
+     * Configure Scan type:
+     * (aNumOfProbeRequests > 0) ==> Active scan. (TI_TRUE == aSplitScan) ==> Triggered scan 
+     */ 
+    iTwdCtrl.iScanParams.scanType = 
+    (aNumOfProbeRequests > 0) ? 
+            ((TI_TRUE == aSplitScan) ? SCAN_TYPE_TRIGGERED_ACTIVE : SCAN_TYPE_NORMAL_ACTIVE) :
+            ((TI_TRUE == aSplitScan) ? SCAN_TYPE_TRIGGERED_PASSIVE : SCAN_TYPE_NORMAL_PASSIVE);
+            
+    /* 
+     * On "split scan" defines the access category for which the Fw waits before scanning the next channel
+     * The default value is any AC. Note: ScanSrv configures TimeOut
+     */ 
+    iTwdCtrl.iScanParams.Tid  = AC_ANY_TID;
+
+    /* Band */
+    iTwdCtrl.iScanParams.band = 
+    (aBand == WHA::KBand2dot4GHzMask) ? RADIO_BAND_2_4_GHZ : RADIO_BAND_5_0_GHZ;
+
+    /* Probe requests */
+#ifdef ENHANCE_PROB_SCAN
+    if (aNumOfProbeRequests) {
+        iTwdCtrl.iScanParams.probeReqNumber   = aNumOfProbeRequests * PB_FACTOR_FOR_SG;
+    }
+#else
+    iTwdCtrl.iScanParams.probeReqNumber   = aNumOfProbeRequests; 
+#endif
+    iTwdCtrl.iScanParams.probeRequestRate = (ERateMask)TIWhaUtils::WhaToMaskRate (aMaxTransmitRate);
+
+    /***************** Channels ******************/
+    iTwdCtrl.iScanParams.numOfChannels    = aNumOfChannels;
+                    
+    for (int i = 0; i < aNumOfChannels; i++)
+    {
+    	for (int j = 0; j < MAC_ADDR_LEN; j++ )
+    	{
+    		(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.bssId[j] = 0xFF;
+    	}
+    	(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.channel = aChannels[i].iChannel;
+#ifdef ENHANCE_PROB_SCAN
+        if (aNumOfProbeRequests) {
+            (iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.maxChannelDwellTime = CONVERT_TU_2_MICRO(aChannels[i].iMaxChannelTime * MAX_TIME_FACTOR_FOR_SG);
+            (iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.minChannelDwellTime = CONVERT_TU_2_MICRO(aChannels[i].iMinChannelTime * MIN_TIME_FACTOR_FOR_SG);
+        }
+        else {
+    	(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.maxChannelDwellTime = CONVERT_TU_2_MICRO(aChannels[i].iMaxChannelTime);
+    	(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.minChannelDwellTime = CONVERT_TU_2_MICRO(aChannels[i].iMinChannelTime);
+        }
+#else
+    	(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.maxChannelDwellTime = CONVERT_TU_2_MICRO(aChannels[i].iMaxChannelTime);
+    	(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.minChannelDwellTime = CONVERT_TU_2_MICRO(aChannels[i].iMinChannelTime);
+#endif
+    	(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.earlyTerminationEvent = SCAN_ET_COND_DISABLE;
+    	(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.ETMaxNumOfAPframes = 0;
+    	(iTwdCtrl.iScanParams.channelEntry[i]).normalChannelEntry.txPowerDbm = DBM2DBMDIV10(aChannels[i].iTxPowerLevel);
+      }
+
+    /* Mix the channel to increase scan result and avoid collisions */
+    if (aNumOfChannels > 4) {
+        int Channelscan = 0;
+        int Channel = 0;
+        int k = 0;
+        while (k < aNumOfChannels/2) {
+            (iTwdCtrl.iScanParams.channelEntry[Channel]).normalChannelEntry.channel = aChannels[Channelscan].iChannel;
+            Channel++;
+            Channelscan += aNumOfChannels/2;
+            if (aNumOfChannels - Channelscan <= 0) {
+                k++;
+                Channelscan = k;
+            }
+        }
+    }
+
+    /* Set SSID if present. This replaces the Template Frame configuration */
+    if ( aNumOfSSID )
+    {
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TIWha::Scan: aSsid.Len %d\n", aSsid->iSSIDLength);
+
+        iTwdCtrl.iScanParams.desiredSsid.len = aSsid->iSSIDLength;
+        os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                       (void *)iTwdCtrl.iScanParams.desiredSsid.str, 
+                       (void *)aSsid->iSSID, 
+                       aSsid->iSSIDLength);
+    }      
+    else
+    {
+        iTwdCtrl.iScanParams.desiredSsid.len = 0;  
+    }
+
+    /* PS on scan */
+    switch (aScanType)
+    {
+    case  WHA::EFgScan:
+    	bEnterPS = TI_FALSE;
+    	/* Internal TI mode - means "don't care" for the Power save */
+    	PS_mode = POWER_SAVE_KEEP_CURRENT;
+    	bScanOnDriverModeError = TI_FALSE;
+    	break;
+
+    case  WHA::EBgScan:
+    	bEnterPS = TI_TRUE;
+    	PS_mode = POWER_SAVE_ON;
+    	bScanOnDriverModeError = TI_FALSE;
+    	break;
+
+    case  WHA::EForcedBgScan:
+    	bEnterPS = TI_TRUE;
+    	PS_mode = POWER_SAVE_ON;
+    	bScanOnDriverModeError = TI_TRUE;
+    	break;
+
+    default:
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "TIWha::Scan aScanType 0x%x:\n",aScanType);
+        /* Use some defaults */
+    	bEnterPS = TI_FALSE;
+    	PS_mode = POWER_SAVE_KEEP_CURRENT;
+    	bScanOnDriverModeError = TI_FALSE;
+    }
+
+	/* Replace the Receive Packet while Scan to all scan resault sent to
+	LDD befor scan complete event sent */
+	TWD_RegisterCb (iTwdCtrl.hTWD,
+					TWD_EVENT_RX_RECEIVE_PACKET, 
+					(TTwdCB *)TIWhaAdaptCB::ReceivePacketWhileScan, 
+					this);
+	/* Set the Scan result count at the beginning of the scan to large value to continue sending resault
+	till the scan complete arrive from FW and set the correct scan result */
+	aScanResultCount = 0xFFFF;
+	/* Initiate the Sent resault to Zero */
+	SentScanResult = 0;
+
+    /* Perform Scan */
+    TI_STATUS status = TWD_Scan (iTwdCtrl.hTWD,
+                                                                    &iTwdCtrl.iScanParams, 
+                                                                    SCAN_RESULT_TAG_APPLICATION_ONE_SHOT, 
+                                                                    TI_FALSE,
+                                                                    bEnterPS,
+                                                                    bScanOnDriverModeError, 
+                                                                    PS_mode,
+                                                                    TI_TRUE, 
+                                                                    (TCmdResponseCb)TIWhaAdaptCB::ScanResponse,
+                                                                    this);
+
+    if (status != TI_OK)
+    {
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "TIWha::Scan returned status = 0x%x:\n", status);
+    }
+}
+
+/** 
+* \fn     StopScan
+* \brief  stop scan 
+* \note   
+*           Any symbian classes (sandbox) will be deleted in the destructor
+* 
+* /param aSynchronous - not used
+* \return KSuccess  
+* \sa  
+*/
+void TIWha::StopScan()
+{    
+    TI_STATUS    status;
+
+    status = TWD_StopScan (iTwdCtrl.hTWD,
+                                                    SCAN_RESULT_TAG_APPLICATION_ONE_SHOT,
+                                                    TI_FALSE,
+                                                    (TCmdResponseCb)TIWhaAdaptCB::StopScanResponse,
+                                                    this);
+
+    if (status != TI_OK)
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Stop scan failure, status=%d\n", status)
+    }
+}
+
+/** 
+* \fn     Join
+* \brief  Join a BSS/IBSS
+*          
+* \note   
+* \return   
+* \sa     
+*/ 
+void TIWha::Join(
+					WHA::TOperationMode aMode,
+					const WHA::TMacAddress& aBSSID,
+					const WHA::SSSID& aSSID, 
+					WHA::TBand aBand,
+					WHA::TChannelNumber aChannel,
+					TUint32 aBeaconInterval,
+					WHA::TRate aBasicRateSet,
+					TUint16 aAtimWindow,
+					WHA::TPreamble aPreambleType,
+					TBool aProbeForJoin )
+{    
+    TJoinBss         joinBssParams;
+    TI_STATUS        status;
+
+#ifdef HT_SUPPORT
+	/* Svae the join MAC address for BA use */
+	os_memoryCopy(&iTwdCtrl.tOsContext,iJoinedMacAddress,(void*)(aBSSID.iMacAddress),aBSSID.KMacAddressLength);
+    /* If re-join remove first all BA sessions */
+    if (bJoined) {
+        TWD_CloseAllBaSessions(iTwdCtrl.hTWD);
+    }
+#endif /* HT_SUPPORT */
+
+    WLAN_OS_REPORT(("TWD_JoinBss : bssType = %d beaconInterval = %d channel = %d\n",aMode, (TUint16)aBeaconInterval, aChannel));
+    WLAN_OS_REPORT(("BSSID = %x-%x-%x-%x-%x-%x\n",aBSSID.iMacAddress[0],aBSSID.iMacAddress[1],aBSSID.iMacAddress[2],aBSSID.iMacAddress[3],aBSSID.iMacAddress[4],aBSSID.iMacAddress[5]));
+        
+    /* If we are in PS mode, wake up from ELP and exit 802.11 PS mode */ 
+    if ( TWD_GetPsStatus (iTwdCtrl.hTWD) )
+    {
+        /* Configure H/W to awake */ 
+        SleepMode (WHA::KAwakeMode, TI_FALSE);
+
+        /* Exit 802.11 PS mode with dummy callbacks */
+        TWD_SetPsMode (iTwdCtrl.hTWD, 
+                                        POWER_SAVE_OFF, 
+                                        TI_FALSE, 
+                                        this, 
+                                        (TPowerSaveCompleteCb)TIWhaAdaptCB::SetPsModeCompleteDummy, 
+                                        (TPowerSaveResponseCb)TIWhaAdaptCB::SetPsModeResponseDummy);
+    }
+         
+    /*
+     * Save BSS info parameters
+     */
+    joinBssParams.bssType = (ScanBssType_e)aMode;
+    /* Save bss type for tx packets */
+    iTwdCtrl.bssType = aMode;
+    joinBssParams.pBSSID = (TUint8 *)aBSSID.iMacAddress;
+    joinBssParams.pSSID = (TUint8 *)aSSID.iSSID;
+    joinBssParams.ssidLength = aSSID.iSSIDLength;
+    joinBssParams.beaconInterval = aBeaconInterval;
+    joinBssParams.channel = aChannel;
+#ifndef HT_SUPPORT
+    joinBssParams.basicRateSet = TIWhaUtils::WhaToMaskRate (aBasicRateSet);
+#else
+	joinBssParams.basicRateSet = TIWhaUtils::HTWhaToMaskRate(aBasicRateSet,iMcsRates);
+#endif /* HT_SUPPORT */
+	
+    joinBssParams.txSessionCount = 0; /* currently not used - we always use session '0' */
+    /*
+     * ATIM window of IBSS
+     * Note that when ATIM window is zero the
+     * initiated IBSS does not support power-save   
+     * Note that PS on IBSS is not supported.
+     */
+        
+    /*
+     * DTIM - Temporary value till the Fw will find the right value from the first beacon 
+     */
+     joinBssParams.dtimInterval = TIWha_DEFAULT_DTIM_PERIOD;
+
+    /* 
+     * Band value is determined out of the channel
+     */
+    if (aBand == WHA::KBand2dot4GHzMask)
+    {
+        joinBssParams.radioBand = RADIO_BAND_2_4_GHZ;
+    }   
+    else if (aBand == WHA::KBand5GHzMask)
+    {
+        joinBssParams.radioBand = RADIO_BAND_5_0_GHZ;
+    }   
+    else
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Invalid band=%d\n", aBand)
+    }
+            
+   
+    /* Set preamble MIB. The generic command response will be stopped in TIWhaAdaptCB::CommandResponse */
+    if (aPreambleType == WHA::ELongPreamble)
+    {
+        TWD_CfgPreamble (iTwdCtrl.hTWD, PREAMBLE_LONG  );
+    }
+    else
+    {
+        TWD_CfgPreamble (iTwdCtrl.hTWD, PREAMBLE_SHORT  );
+    }
+
+     
+	/* 
+	 * Reset both group and pairwise keys to WEP in order to avoid 
+	 * a scenario which only group or pairwise are actually configured in WEP
+	 */
+	iTwdCtrl.ePairwiseKeyMode = TWD_CIPHER_WEP;
+	iTwdCtrl.eGroupKeyMode	= TWD_CIPHER_WEP;
+
+    /*
+     * Set new Tx fail low threshold so that FW fall back will start faster
+     * The reason is that at first we start in 54Mbps and we need to drop faster if the AP is far away.
+     * This will change after few seconds with the hConnectionTimer
+     */
+    SetTxFailLowThreshold (TIWHA_TX_FAIL_LOW_TH_FOR_CONNECTION);
+    if (bConnectionTimerRunning)
+    {
+        /* Other join started and ended soon, so just stop the timer before setting it again */
+        os_timerStop(&iTwdCtrl.tOsContext, hConnectionTimer);
+    }
+    bConnectionTimerRunning = TI_TRUE;
+    os_timerStart (&iTwdCtrl.tOsContext, hConnectionTimer, uConnectionApproxTimeMs);
+
+    
+    status = TWD_CmdJoinBss (iTwdCtrl.hTWD, &joinBssParams);
+
+    if (status != TI_OK)
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Start join failure, status=%d\n", status)
+    }
+
+    /* set the join flag to true */
+    bJoined = 1;
+
+    #ifdef HT_SUPPORT	
+	    /* Reset the BA Vectors */
+	    iTxBlockAckUsageLast = 0;
+        iRxBlockAckUsageLast = 0;
+    #endif
+}
+
+/** 
+* \fn     SetPsMode
+* \brief  SetPsMode 
+*          
+* \note   
+* \return   
+* \sa     
+*/ 
+void TIWha::SetPsMode( WHA::TPsMode aPsMode )
+{    
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+    TI_STATUS   status;
+    E80211PsMode ePsMode; /* TWD parameter for power save on/off */
+    
+    if (aPsMode == WHA::KPsDisable)
+    {
+        ePsMode = POWER_SAVE_OFF;
+
+        /* Configure H/W to awake, don't wait for a response */ 
+        SleepMode (WHA::KAwakeMode, FALSE);
+    }
+    else
+    {
+        ePsMode = POWER_SAVE_ON;
+    }
+
+    /* Set 802.11 PS mode */
+    status = TWD_SetPsMode (iTwdCtrl.hTWD,
+                                            ePsMode,
+                                            TI_TRUE,
+                                            this,
+                                            (TPowerSaveCompleteCb)TIWhaAdaptCB::SetPsModeComplete,
+                                            (TPowerSaveResponseCb)TIWhaAdaptCB::SetPsModeResponse);
+
+    /* Convert status */
+    switch (status)
+    {
+        case TI_OK:
+        case POWER_SAVE_802_11_PENDING:
+            TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION,  ": aPsMode 0x%x, status = %d (OK or PENDING)\n", aPsMode, status);
+        break;
+        
+        case POWER_SAVE_802_11_SUCCESS:
+        case POWER_SAVE_802_11_IS_CURRENT:
+            TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, ": aPsMode 0x%x, status = %d (IS_CURRENT || SUCCESS)\n", aPsMode, status);
+            
+        /* This case will never return a response, that's why we don't 'break' this case */ 
+
+        default:
+            ASSERT_ERR (iTwdCtrl.hReport, "Set PS mode failure, mode=%d", aPsMode)
+    }
+}
+
+/** 
+* \fn     SetBssParameters
+* \brief  Set AID 
+*          
+* \note   
+* \return   
+* \sa     
+*/ 
+void TIWha::SetBssParameters(
+								TUint8 aDTIM, 
+								TUint16 aAID )
+{    
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+    
+    TTwdParamInfo    tTwdParam;
+    TI_STATUS        status;
+
+    /* Set AID */
+    tTwdParam.paramType = TWD_AID_PARAM_ID;
+    tTwdParam.content.halCtrlAid  = aAID;
+    status = TWD_SetParam (iTwdCtrl.hTWD, &tTwdParam);
+
+    /* DTIM is calculated in the Fw now, this is a change from WiLink 4.0.4 */
+    
+    if (status != TI_OK) 
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Set BSS parameters failure, status=%d\n", status)
+    }
+
+    /* Send Station connect Signaling to FW for COEX and 11N purpose */
+    TWD_CmdSetStaState(iTwdCtrl.hTWD,1,NULL,NULL);
+
+}
+
+/** 
+* \fn     Measure
+* \brief  Not supported in Symbian
+*          
+* \note   
+* \return   
+* \sa     
+*/ 
+void TIWha::Measure(
+					   WHA::TPowerLevel aTxPowerLevel,
+					   WHA::TBand aBand,
+					   WHA::TChannelNumber aChannel,
+					   TUint8 aActivationDelay,
+					   TUint8 aMeasurementOffset,
+					   TUint8 aNumberOfMeasurementTypes,
+					   const WHA::SParameterSet* aParameterSet )
+{    
+        ASSERT_ERR (iTwdCtrl.hReport, "%s not supported\n", __FUNCTION__)
+}
+
+/** 
+* \fn     StopMeasure
+* \brief  Not supported in Symbian
+*          
+* \note   
+* \return   
+* \sa     
+*/ 
+void TIWha::StopMeasure()
+{    
+        ASSERT_ERR (iTwdCtrl.hReport, "%s not supported\n", __FUNCTION__)
+}
+
+/** 
+* \fn     ReadMib
+* \brief  ReadMib
+*  
+* 
+* \note   
+* \param aMib - ENUM according to wha_types.h in LDD  
+* \return   
+* \sa     
+*/ 
+void TIWha::ReadMib( WHA::TMib aMib ) 
+{
+    void       *pCb    = (void*)iTwdCtrl.readMIBBuf;
+    TMib  *pMibBuf   = (TMib *)pCb;
+    WHA::TMib        prevMib;
+    TI_STATUS   status = TI_OK;
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "ReadMIB: aMib %x:\n",aMib);
+
+    prevMib = iTwdCtrl.currentReadMibID;
+    iTwdCtrl.currentReadMibID = aMib;
+   
+    switch (aMib)
+    {
+    case WHA::KMibDot11StationId:
+        /* 
+         * open a timer since we can't send read mib results in one context
+         */
+        os_timerStart(&iTwdCtrl.tOsContext,readDot11StationIdMibTmr,0);
+       
+        return;
+        
+    case WHA::KMibStatisticsTable:
+        /* 
+         * Retrieve required information from the device 
+         */
+        pMibBuf->aMib = MIB_statisticsTable;
+
+        status = TWD_ReadMib (iTwdCtrl.hTWD, 
+                              this, 
+                              (void *)TIWhaAdaptCB::ReadMIBResponse, 
+                              pCb); 
+        break; 
+
+    case WHA::KMibCountersTable:
+        /* 
+         * Retrieve required information from the device.
+         */
+        pMibBuf->aMib = MIB_countersTable;
+        status = TWD_ReadMib (iTwdCtrl.hTWD, 
+                              this, 
+                              (void *)TIWhaAdaptCB::ReadMIBResponse, 
+                              pCb);
+        break;
+        
+#if 0 /* Used for debug in WiLink 4.0.4 */ 
+    case EMIBBtCoexistenceProfile:
+        /* 
+         * DEBUG ONLY:
+         */
+        paramInfo.paramType = TWD_SG_CONFIG_PARAM_ID;
+        paramInfo.content.interogateCmdCBParams.pCb = (TI_UINT8*)pCb;
+        paramInfo.content.interogateCmdCBParams.hCb = (TI_HANDLE)this;
+       paramInfo.content.interogateCmdCBParams.fCb = (void *)TIWhaAdaptCB::ReadMIBResponse;
+         
+        status = TWD_GetParam (iTwdCtrl.hTWD, &paramInfo);
+        break;
+
+    case EMIBVersion:
+        /* 
+         * Retrieve firmware revision 
+         */
+        paramInfo.paramType = TWD_REVISION_PARAM_ID;
+        paramInfo.content.interogateCmdCBParams.pCb = (TI_UINT8*)pCb;
+        paramInfo.content.interogateCmdCBParams.hCb = (TI_HANDLE)this;
+        paramInfo.content.interogateCmdCBParams.fCb = (void *)TIWhaAdaptCB::ReadMIBResponse;
+         
+        status = TWD_GetParam (iTwdCtrl.hTWD, &paramInfo);
+        break;
+#endif
+
+    default:
+        iTwdCtrl.currentReadMibID = prevMib;
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, ": aMib %x: Not supported\n",aMib);
+    }
+
+    if (status != TI_OK) 
+    {
+        TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, ": aMib %x: status = %d\n",aMib,status);
+    }
+}        
+
+/** 
+* \fn     WriteMib
+* \brief  WriteMib
+*  
+* 
+* \note   
+* \param aMib - ENUM according to wha_types.h in LDD  
+* \param aLength - size of aData
+* \param aData - pointer to general data  
+* \param aMore - not used 
+* \return   
+* \sa     
+*/ 
+WHA::TStatus TIWha::WriteMib(
+								WHA::TMib aMib,
+								TUint16 aLength,
+								const void* aData,
+								TBool aMore  )
+{    
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " Mib = 0x%x\n",aMib);
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "WriteMIB - aMib = %d, aData\n", aMib);
+    
+    switch (aMib)
+    {    
+    case WHA::KMibDot11MaxReceiveLifetime:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD set command
+         */     
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+                                Dot11MaxReceiveLifeTime (aData))
+        break;
+        
+    case WHA::KMibDot11SlotTime:
+        /* 
+         * Converts the WriteMIB back to the correlated whal command 
+         * and activate the WHAL Set command
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+                                SetSlotTime (aData))
+        break;
+        
+    case WHA::KMibDot11GroupAddressesTable:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD Set command
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            SetDot11GroupAddrTable (aData))
+            
+        break;
+
+    case WHA::KMibDot11WepDefaultKeyId:
+        /* 
+         * Set the default Key Id
+         */
+ 
+        /*
+         * NOTE: Setting default key will cause the securityMode to change into WEP
+         */
+        ASSERT_MIB(iTwdCtrl.hReport, aMib,
+            SetDefaultKeyID (aData))
+        break;
+        
+    case WHA::KMibDot11CurrentTxPowerLevel:
+        
+        /*
+         * NOTE: no assert here. This function may return:
+         *       KSuccess - if the same value is already configured
+         *       KPending - if operation has succeeded
+         *       KFailed - UnKnown error
+         */
+        return SetCurrentTxPowerLevel ( aData);
+
+    case WHA::KMibDot11RTSThreshold:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD Set command
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            Dot11RTSThreshold (aData))
+        break;
+
+    case WHA::KMibCtsToSelf:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD Set command
+         */     
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            CtsToSelf (aData))
+        break;
+
+    case WHA::KMibArpIpAddressTable:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD Set command
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            SetArpIpAddrTable (aData))
+        break;
+
+    case WHA::KMibTemplateFrame:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD Set command
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+                                SetTemplateFrame (aData))
+        break;
+
+    case WHA::KMibRxFilter:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD Set command
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+                                SetRxFilter (aData)) 
+        break;
+
+    case WHA::KMibBeaconFilterIeTable:
+        /*      
+         * Converts the beacon filter IE table configuration 
+         * to TWD parameters and sets specific configuration
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            SetBeaconFilterIETable (aData))
+        break;
+
+    case WHA::KMibBeaconFilterEnable:
+        /*      
+         * Converts beacon filtering configuration 
+         * to TWD parameters and sets specific configuration 
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            SetBeaconFilterEnable ( aData))
+        break;
+
+    case WHA::KMibSleepMode:
+        /* 
+         * Set user sleep mode
+         */     
+        iTwdCtrl.sleepMode = *(WHA::TSleepMode *)aData;
+
+        /* If we are in 802.11 PS mode then we should enter new sleepMode (otherwise we just save it) */
+        if (TWD_GetPsStatus (iTwdCtrl.hTWD))
+        {
+            /*
+             * NOTE: no assert here. This function may return:
+             *       KSuccess - if the same value is already configured
+             *       KPending - if operation has succeeded
+             */
+            return SleepMode ( iTwdCtrl.sleepMode, TI_TRUE);
+        }
+
+        else
+        {
+            return WHA::KSuccess;
+        }
+                
+    case WHA::KMibWlanWakeUpInterval:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD Set command
+         */     
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            WakeUpConditions ( aData))
+                                             
+        break;
+        
+    case WHA::KMibBeaconLostCount:
+        /* 
+         * Configure the amount of consecutive beacons that can be lost 
+         * before the WLAN device should report BSSLost indication to the 
+         * WLAN host driver.
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            SetBeaconLostCount (aData))
+        break;
+
+    case WHA::KMibRcpiThreshold:
+        /*  
+         * Configure the threshold value for RCPI indication to the WLAN  
+         * host driver. RcpiIndication event is triggered when the RCPI goes 
+         * below or over the threshold.
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            SetRcpiThreshold (aData))
+        break;
+       
+            
+    case WHA::KMibTxRatePolicy:
+        /* 
+         * Converts the WriteMIB back to the correlated TWD command 
+         * and activate the TWD Set command
+         */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            TxRatePolicy ( aLength, aData))
+        break;
+        
+/*  SG Mibs should be integrated to Symbian */
+	case 0x110F: /* Should be KMibbtCoexistenceMode */
+
+        /* Call the TWD with the specific mode of Bt */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            btCoexistenceMode ( aLength, aData))
+        break;
+        
+	case 0x1110: /* should be KMibbtCoexistenceProfile */
+
+        /* Call the TWD with the parameters of Bt */
+        ASSERT_MIB (iTwdCtrl.hReport, aMib,
+            btCoexistenceProfile ( aLength, aData))
+        break;
+
+#ifdef HT_SUPPORT
+		case WHA::KMibHtCapabilities:
+			/* send the HT Capabilties to FW */
+            SetHTCapabilities ((WHA::ShtCapabilities*)aData);
+			break;
+
+		case WHA::KMibHtBssOperation:
+			/* send the HT Information to FW */
+            SetHTInformation ((WHA::ShtBssOperation*)aData);
+			break;
+
+		case WHA::KMibHtBlockAckConfigure:
+			/* BA Initiator and Receiver to FW */
+            if (ConfigureBA ((WHA::ShtBlockAckConfigure*)aData) == TI_NOK)
+			{
+				/* Return success for not stuck the LDD */
+				/* This value return when ConfigureBA do nothing */
+			     return WHA::KSuccess; 
+			}
+			break;		
+#endif /* HT_SUPPORT */
+
+        case WHA::KMibTxAutoRatePolicy:
+			/* Set the supported rates */
+			TxAutoRatePolicy((WHA::StxAutoRatePolicy*)aData);
+			break;
+
+
+	#ifdef TI_TEST
+		case EMIBPltTest:
+
+		    #ifdef PLT_TESTER
+			    iRealPlt = 1;
+		    #endif
+            os_printf("EMIBPltTest");
+			PltTester(aData);
+			break;
+
+        /*  FW statistics */ 
+        case TWD_FW_PRINT_STATISTICS:
+        	TWD_ItrStatistics (iTwdCtrl.hTWD, (void*)TIWhaAdaptCB::StatisticsReadResponse, this, &(((TTwd *)(iTwdCtrl.hTWD))->acxStatistic));           
+            break;
+
+        /*  Get AVR RSSI */ 
+        case AVR_RSSI:
+            TWD_ItrRSSI (iTwdCtrl.hTWD, (void*)TIWhaAdaptCB::AvrRssiReadResponse, this, &roamingStatistics);           
+            break;    
+        
+    	case QOS_CHANGE_QEUEU: /* change output Queue */ 
+            ChangeQueue(aData);
+    		break;    
+    
+    	case SET_POWER_LEVEL: // KMibDot11PowerSavePowerLevel
+    		SetPowerSavePowerLevel((void *)aData);
+	#endif /* TI_TEST */
+
+    default:
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, ": aMib %x: Not supported\n",aMib);
+        return WHA::KSuccess; 
+
+    } /* End switch */
+
+    /* Indicate that the WriteMIB will return a Response in a different context */
+    return WHA::KPending; 
+}
+
+
+/** 
+* \fn     SetSlotTime
+* 
+* \param aData - TSlotTime
+* \return KSuccess or KFailed  
+* \sa     
+*/ 
+WHA::TStatus TIWha::SetSlotTime (const void *aData) 
+{
+    ESlotTime      slot  = PHY_SLOT_TIME_LONG;
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "WRITE_MIB,TIWha::, slot time = 0x%x\n", *((WHA::TSlotTime *)aData));
+
+    switch (*((WHA::TSlotTime *)aData))
+    {   
+        case WHA::KSlotTime9:
+            slot = PHY_SLOT_TIME_SHORT;
+            break;
+        case WHA::KSlotTime20:
+            slot = PHY_SLOT_TIME_LONG;
+            break;
+        default:
+            TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "TIWha:: recieving slot time = %d !!!\n",*((WHA::TSlotTime *)aData));
+    }
+
+    return (TWD_CfgSlotTime (iTwdCtrl.hTWD, slot) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     Dot11MaxReceiveLifeTime
+* 
+* \param aData - TUint32*
+* \return KSuccess or KFailed  
+* \sa     
+*/ 
+WHA::TStatus TIWha::Dot11MaxReceiveLifeTime (const void *aData) 
+{
+    TMib  Mib;
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TIWha::Dot11MaxReceiveLifeTime *aData= 0x%x\n",         *(TUint32 *)(aData));
+
+    Mib.aMib = MIB_dot11MaxReceiveLifetime;
+    Mib.aData.MaxReceiveLifeTime = *(TUint32 *)(aData);
+
+    return (TWD_WriteMib (iTwdCtrl.hTWD, &Mib) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetRxFilter
+*  
+* 
+* \note   - Always filter BSSID
+* \param aData - not used
+* \return   
+* \sa     
+*/ 
+WHA::TStatus TIWha::SetRxFilter (const void *aData)
+{
+    TMib Mib;
+    
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "SetRxFilter,*aData= 0x%x\n",*(TUint8 *)aData);
+
+    Mib.aMib = MIB_rxFilter;
+    /* 
+     * Note that we ignore the requested configuration, since any other configuration is 
+     * causing a crash in the LDD. This is agreed with Palau
+     */
+    Mib.aData.RxFilter = MIB_RX_FILTER_BSSID_SET;
+    
+    return (TWD_WriteMib (iTwdCtrl.hTWD, &Mib) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetCurrentTxPowerLevel
+*  
+* 
+* \note   - 
+* \param aData -TPowerLevel (Power level in dbm)
+* \return   
+*           KSuccess - if the same value is already configured
+*           KPending - if operation has succeeded
+*           KFailed - UnKnown error
+* \sa     
+*/ 
+WHA::TStatus TIWha::SetCurrentTxPowerLevel (const void *aData)
+{
+    TTwdParamInfo    param;
+
+    /* Activates the TWD_SetParam function */
+    param.paramType = TWD_TX_POWER_PARAM_ID;
+    param.content.halCtrlTxPowerDbm = DBM2DBMDIV10((*((WHA::TPowerLevel *) aData)));
+    
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "SetCurrentTxPowerLevel, Dbm = %d Power DBm*10 = %d \n",        *((WHA::TPowerLevel *) aData), param.content.halCtrlTxPowerDbm);
+
+    TI_STATUS status = TWD_SetParam (iTwdCtrl.hTWD, &param);
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION,  "SetCurrentTxPowerLevel, status = %d \n",status);
+    
+    switch (status)
+    {
+        case TI_OK:                             return WHA::KPending;
+        case PARAM_ALREADY_CONFIGURED: return WHA::KSuccess;
+        default: 
+            TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR , "SetCurrentTxPowerLevel, returned status  = %d Power DBm*10 = %d \n",                status, param.content.halCtrlTxPowerDbm);
+        return WHA::KFailed;
+
+    }
+}
+
+/** 
+* \fn     SetTemplateFrame
+*  
+* 
+* \note   - 
+* \param aData - StemplateFrame defined in wha_mib.h inside the LDD
+* \return   
+* \sa     
+*/ 
+WHA::TStatus TIWha::SetTemplateFrame (const void *aData)
+{
+    TMib    Mib;
+    WHA::StemplateFrame* pMIBTemplateFrame = (WHA::StemplateFrame *)aData;
+
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "SetTemplateFrame aLength= %d,aRate= %d aType = %d\n",        pMIBTemplateFrame->iLength, pMIBTemplateFrame->iInitialTransmitRate, pMIBTemplateFrame->iFrameType);
+    
+    Mib.aMib = MIB_templateFrame;
+    Mib.aData.TemplateFrame.FrameType = TIWhaUtils::WhaToTwdFrameType(pMIBTemplateFrame->iFrameType);
+    Mib.aData.TemplateFrame.Rate = (TI_UINT32)TIWhaUtils::WhaToTwdRate (pMIBTemplateFrame->iInitialTransmitRate);
+    Mib.aData.TemplateFrame.Length = pMIBTemplateFrame->iLength;
+
+    os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                   (void *)Mib.aData.TemplateFrame.Data, 
+                   (void *)pMIBTemplateFrame->iTemplateData, 
+                   pMIBTemplateFrame->iLength);
+        
+    return (TWD_WriteMib (iTwdCtrl.hTWD, &Mib) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetDot11GroupAddrTable
+* 
+* \param aData - *Sdot11GroupAddressesTable
+* \return KSuccess or KFailed  
+* \sa     
+*/ 
+WHA::TStatus TIWha::SetDot11GroupAddrTable (const void *aData)           
+{
+    WHA::Sdot11GroupAddressesTable *pTable = (WHA::Sdot11GroupAddressesTable *)aData;
+    TMib Mib;
+    int i;
+
+    if (NULL == aData) 
+    {
+        return WHA::KFailed;
+    } 
+
+
+/*    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION,  TIWLANWHA_MODULE_LOG, MSG_2159,  Mib.aMib, *(TUint32 *)(aData));*/
+
+    Mib.aMib = MIB_dot11GroupAddressesTable;
+    Mib.aData.GroupAddressTable.bFilteringEnable = pTable->iEnable;
+    Mib.aData.GroupAddressTable.nNumberOfAddresses = pTable->iNumOfAddrs;
+
+    for (i = 0; i < Mib.aData.GroupAddressTable.nNumberOfAddresses; i++)
+    {
+        os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                       (void *)Mib.aData.GroupAddressTable.aGroupTable[i], 
+                       (void *)((TI_UINT8*)pTable->iAddrData + i*MAC_ADDR_LEN), 
+                       MAC_ADDR_LEN);
+    }
+
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION,  "SetDot11GroupAddrTable -Enabled=%d-num=%d\n" ,                            Mib.aData.GroupAddressTable.bFilteringEnable,                            Mib.aData.GroupAddressTable.nNumberOfAddresses);
+
+    return (TWD_WriteMib (iTwdCtrl.hTWD, &Mib) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetDefaultKeyID
+* 
+* \param aData - *Sdot11WepDefaultKeyId
+* \return KSuccess or KFailed  
+* \sa     
+*/ 
+WHA::TStatus TIWha::SetDefaultKeyID (const void *aData) 
+{
+    TTwdParamInfo  param;
+
+  //  TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION,  TIWLANWHA_MODULE_LOG, MSG_2161,((WHA::Sdot11WepDefaultKeyId*)aData)->iDot11WepDefaultKeyId);
+
+    /* Set security mode to WEP */
+    param.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID;
+    param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_WEP;
+    TWD_SetParam (iTwdCtrl.hTWD, &param);
+
+    param.paramType = TWD_RSN_DEFAULT_KEY_ID_PARAM_ID;
+    param.content.configureCmdCBParams.pCb = (void*)aData;
+    param.content.configureCmdCBParams.fCb = NULL;
+    param.content.configureCmdCBParams.hCb = NULL;
+
+    return (TWD_SetParam (iTwdCtrl.hTWD, &param) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     Dot11RTSThreshold
+* 
+* \param aData - *Sdot11RTSThreshold
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::Dot11RTSThreshold (const void *aData)
+{
+    TTwdParamInfo  param;
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "Dot11RTSThreshold ,*aData= 0x%x\n",((WHA::Sdot11RTSThreshold*)aData)->iDot11RTSThreshold);
+
+    param.paramType = TWD_RTS_THRESHOLD_PARAM_ID;
+    param.content.halCtrlRtsThreshold = ((WHA::Sdot11RTSThreshold*)aData)->iDot11RTSThreshold;
+
+    return (TWD_SetParam (iTwdCtrl.hTWD, &param) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     CtsToSelf
+* 
+* \param aData - *SctsToSelf
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::CtsToSelf (const void *aData)
+{
+    TMib Mib;
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "CtsToSelf, *aData= 0x%x\n",        ((WHA::SctsToSelf *)aData)->iCtsToSelf);
+
+    if (NULL == aData) 
+    {
+        return PARAM_VALUE_NOT_VALID;
+    }
+    
+    Mib.aMib = MIB_ctsToSelf;
+    Mib.aData.CTSToSelfEnable = (TI_UINT32)((WHA::SctsToSelf *)aData)->iCtsToSelf;
+
+    return (TWD_WriteMib (iTwdCtrl.hTWD, &Mib) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetArpIpAddrTable
+* 
+* \param aData - *SarpIpAddressTable
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::SetArpIpAddrTable (const void *aData)
+{   
+    TMib   Mib;
+	WHA::SarpIpAddressTable *pTable = (WHA::SarpIpAddressTable *)aData;
+
+    if (NULL == aData) 
+    {
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    Mib.aMib = MIB_arpIpAddressesTable;
+    Mib.aData.ArpIpAddressesTable.FilteringEnable = pTable->iEnable;
+    
+    os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+        Mib.aData.ArpIpAddressesTable.addr, 
+        (void*)&pTable->iIpV4Addr, 
+        sizeof(pTable->iIpV4Addr));
+
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "SetarpIpAddressesTable,*aData= 0x%x addr = 0x%x\n",        pTable->iIpV4Addr, *(TI_UINT32*)Mib.aData.ArpIpAddressesTable.addr);
+
+    return (TWD_WriteMib (iTwdCtrl.hTWD, &Mib) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetBeaconFilterIETable
+* 
+* \param aData - *SbeaconFilterIeTable
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::SetBeaconFilterIETable (const void *aData)
+{
+	WHA::SbeaconFilterIeTable *pTable = (WHA::SbeaconFilterIeTable *)aData;
+    TMib Mib;
+
+    if (NULL == aData) 
+    {
+        return WHA::KFailed;
+    }
+
+    Mib.aMib = MIB_beaconFilterIETable;
+    Mib.aData.BeaconFilter.iNumberOfIEs =  pTable->iNumofElems;
+
+    os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                   (void *)Mib.aData.BeaconFilter.iIETable, 
+                   (void *)pTable->iIeTable, 
+                   sizeof(Mib.aData.BeaconFilter.iIETable));
+    
+    return (TWD_WriteMib (iTwdCtrl.hTWD, &Mib) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetBeaconFilterEnable
+* 
+* \param aData - *SbeaconFilterEnable
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::SetBeaconFilterEnable (const void *aData)
+{
+	WHA::SbeaconFilterEnable *pEnable = (WHA::SbeaconFilterEnable *)aData;
+
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "SetBeaconFilterEnable, *beaconFilterEnable Data= 0x%x 0x%x\n",        pEnable->iEnable, pEnable->iCount);
+
+    return (TWD_CfgBeaconFilterOpt (iTwdCtrl.hTWD, pEnable->iEnable, 
+                                    (TI_UINT8)pEnable->iCount) == TI_OK) ? WHA::KSuccess : WHA::KFailed; 
+}
+
+/** 
+* \fn     SleepMode
+* 
+* \param aSleepMode - TSleepMode
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::SleepMode (
+							   const WHA::TSleepMode&       aSleepMode,        /* aSleepMode */
+    TBool       bResponse)          /* whether Response required */   
+{
+    EPowerPolicy powerPolicy;
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "SleepMode = %d\n",aSleepMode);
+
+    /* Save response request flag in the context */
+    iTwdCtrl.bResponse = bResponse;
+
+    switch (aSleepMode)
+    {
+		case WHA::KAwakeMode:
+            powerPolicy = POWERAUTHO_POLICY_AWAKE;
+            break;
+        case WHA::KPowerDownMode:
+            powerPolicy = POWERAUTHO_POLICY_ELP;
+            break;
+        case WHA::KLowPowerMode:
+            powerPolicy = POWERAUTHO_POLICY_ELP;
+            break;
+        default:
+            TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "Unknown SleepMode %d, setting to AWAKE\n",aSleepMode);
+            powerPolicy = POWERAUTHO_POLICY_AWAKE;
+    }
+
+/* Currently No support for ELP -- Remove comment when ELP will be added */
+    //#ifndef ELP_ENABLED
+        /* Disabling Low Power (ELP) mode */
+        powerPolicy = POWERAUTHO_POLICY_AWAKE;
+    //#endif
+
+    /* Call the power authentication module to set the new power policy */
+    return (TWD_CfgSleepAuth (iTwdCtrl.hTWD, powerPolicy) == TI_OK) ? WHA::KPending : WHA::KSuccess;        
+}
+
+/** 
+* \fn     WakeUpConditions
+* 
+* \param aData - *SwlanWakeUpInterval
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::WakeUpConditions (const void *aData)
+{
+    WHA::SwlanWakeUpInterval *pWakeUp = (WHA::SwlanWakeUpInterval *)aData;
+    TPowerMgmtConfig     PowerMgmtConfig;
+
+    PowerMgmtConfig.listenInterval = pWakeUp->iListenInterval;
+    PowerMgmtConfig.tnetWakeupOn = (ETnetWakeOn)pWakeUp->iMode;
+
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "WakeUpConditions ,listenInterval = 0x%x ,iWakeUpMode = 0x%x  \n", PowerMgmtConfig.listenInterval, PowerMgmtConfig.tnetWakeupOn);
+
+    return (TWD_CfgWakeUpCondition (iTwdCtrl.hTWD, &PowerMgmtConfig) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetBeaconLostCount
+* 
+* \param aData - *SbeaconLostCount
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::SetBeaconLostCount (const void  *aData)
+{
+    TRroamingTriggerParams roamingTriggerCmd;
+
+    /* Configure TWD with 'No BSS' thresholds */
+    roamingTriggerCmd.BssLossTimeout = NO_BEACON_DEFAULT_TIMEOUT;
+    roamingTriggerCmd.TsfMissThreshold = (TI_UINT16)((WHA::SbeaconLostCount *)aData)->iLostCount;
+
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "SetBeaconLostCount  ,BssLossTimeout = 0x%x ,TsfMissThreshold = 0x%x  \n",        roamingTriggerCmd.BssLossTimeout, roamingTriggerCmd.TsfMissThreshold);
+
+    return (TWD_CfgConnMonitParams (iTwdCtrl.hTWD, &roamingTriggerCmd) == TI_OK)
+           ? WHA::KSuccess : WHA::KFailed;
+}
+
+/** 
+* \fn     SetRcpiThreshold
+* 
+* \param aData - *SrcpiThreshold
+* \description - we are supporting RCI
+* \return KSuccess or KFailed  
+* \sa     
+*/
+
+WHA::TStatus TIWha::SetRcpiThreshold (const void *aData)
+{
+
+    RssiSnrTriggerCfg_t tTriggerCfg;
+    WHA::TRcpi iRCPI = *(WHA::TRcpi *)aData;
+    
+    tTriggerCfg.index  = TRIGGER_EVENT_LOW_RSSI;
+    if (iRCPI<= TIWha_MIN_RCPI_VAL)
+    {
+        tTriggerCfg.threshold = TIWha_MIN_RSSI_VAL;
+    }
+    else
+    {
+        if (iRCPI >= TIWha_MAX_RCPI_VAL)
+        {
+            tTriggerCfg.threshold = TIWha_MAX_RSSI_VAL;
+        }
+        else
+        {
+            tTriggerCfg.threshold = (iRCPI / 2) + TIWha_MIN_RSSI_VAL;
+        }
+
+    }
+
+    tTriggerCfg.pacing    = TRIGGER_LOW_RSSI_PACING;
+    tTriggerCfg.metric    = METRIC_EVENT_RSSI_BEACON;
+    tTriggerCfg.type      = RX_QUALITY_EVENT_EDGE;
+    tTriggerCfg.direction = RSSI_EVENT_DIR_LOW;
+    tTriggerCfg.hystersis = 3;
+    tTriggerCfg.enable    = TI_TRUE;
+
+
+
+    if (TI_OK == TWD_CfgRssiSnrTrigger (iTwdCtrl.hTWD, &tTriggerCfg))
+    {
+        return WHA::KSuccess;
+    }
+    else
+    {
+        return WHA::KFailed;
+    }
+
+ 
+}
+
+
+/** 
+* \fn     TxRatePolicy
+* 
+* \param aData - *StxRatePolicy
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::TxRatePolicy (
+    TUint32     aLength,            /* Specifies the length of the MIB */
+    const void        *aData)             /* Pointer to the MIB data */
+{
+    TMib Mib;
+    TUint32       i;
+    WHA::StxRatePolicy *pPolicy = (WHA::StxRatePolicy*) aData;
+    
+    if (NULL == aData)
+    {
+        return PARAM_VALUE_NOT_VALID;
+    }
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TxRatePolicy Num of Policies = %d \n",pPolicy->iNumOfPolicyObjects);
+
+    if (pPolicy->iNumOfPolicyObjects > MAX_NUM_OF_TX_RATE_CLASS_POLICIES)
+    {
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "ERROR: Can't configure more than %d Classes",MAX_NUM_OF_TX_RATE_CLASS_POLICIES);
+    }
+
+    Mib.aMib = MIB_txRatePolicy;
+    /* The length field is not in use */
+    Mib.Length = 0;
+    Mib.aData.txRatePolicy.numOfRateClasses = pPolicy->iNumOfPolicyObjects;
+
+    for (i = 0; i < pPolicy->iNumOfPolicyObjects; i++)
+    {
+        
+        Mib.aData.txRatePolicy.rateClass[i].txEnabledRates = 0;
+        
+        /* MCS rates not support in Symbian structure */
+        (pPolicy->iTxRateClass[i].iTxPolicy54)  ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_54MBPS  : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy48)  ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_48MBPS  : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy36)  ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_36MBPS  : NULL;
+        /* 33Mbps not support in TWD */
+        (pPolicy->iTxRateClass[i].iTxPolicy24)  ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_24MBPS  : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy22)  ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_22MBPS  : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy18)  ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_18MBPS  : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy12)  ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_12MBPS  : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy11)  ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_11MBPS  : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy9)   ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_9MBPS   : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy6)   ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_6MBPS   : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy5_5) ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_5_5MBPS : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy2)   ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_2MBPS   : NULL;
+        (pPolicy->iTxRateClass[i].iTxPolicy1)   ? Mib.aData.txRatePolicy.rateClass[i].txEnabledRates |= HW_BIT_RATE_1MBPS   : NULL;
+        
+        //os_printf("Policy[%d] is %x ",i,Mib.aData.txRatePolicy.rateClass[i]);
+        Mib.aData.txRatePolicy.rateClass[i].longRetryLimit = pPolicy->iTxRateClass[i].iLongRetryLimit;
+        Mib.aData.txRatePolicy.rateClass[i].shortRetryLimit = pPolicy->iTxRateClass[i].iShortRetryLimit;
+        
+    }
+    
+    return (TWD_WriteMib (iTwdCtrl.hTWD, &Mib) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+    /*return WHA::KSuccess;*/
+}
+
+
+/** 
+* \fn     btCoexistenceMode
+* 
+* \param aData - *TBTCoexMode
+* \ indicats 3 operation modes
+ *  0 - Disable
+ *  1 - Enable
+ *  2 - Auto	
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::btCoexistenceMode(TUint32 aLength, const void *aData)
+{
+	ESoftGeminiEnableModes *pSGMode = (ESoftGeminiEnableModes*)aData;
+	TTwdParamInfo			iParamInfo;
+
+	iParamInfo.paramType = TWD_SG_ENABLE_PARAM_ID;
+	iParamInfo.paramLength = aLength;
+	switch (*pSGMode)
+	{
+		case SG_PROTECTIVE:
+		case SG_OPPORTUNISTIC:
+			iParamInfo.content.SoftGeminiEnable = SG_OPPORTUNISTIC;
+            TWD_SetParam(iTwdCtrl.hTWD,&iParamInfo);
+			break;
+
+		case SG_DISABLE:
+			iParamInfo.content.SoftGeminiEnable = SG_DISABLE;
+			TWD_SetParam(iTwdCtrl.hTWD,&iParamInfo);
+			break;
+
+		default:
+TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "btCoexistenceMode - Value Invalide = %d",*pSGMode);
+			return WHA::KFailed;
+	}
+	return WHA::KSuccess;
+}
+
+/** 
+* \fn     btCoexistenceProfile
+* 
+* \param aData - *ESoftGeminiEnableProfile
+* \ indicats 3 operation modes
+ *  0 - Data-Data
+ *  1 - VOIP-A2DP/Data
+ *  2 - Data -A2DP	
+* \return KSuccess or KFailed  
+* \sa     
+*/
+WHA::TStatus TIWha::btCoexistenceProfile(TUint32 aLength, const void *aData)
+{
+	ESoftGeminiEnableProfile* pSGProfile = (ESoftGeminiEnableProfile*)aData;
+	TTwdParamInfo			iParamInfo;
+
+	iParamInfo.paramType = TWD_SG_CONFIG_PARAM_ID;
+	iParamInfo.paramLength = aLength;
+	
+
+	switch (*pSGProfile)
+	{
+    case BtCoexProfData:
+            iSgParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO] = 50;
+			break;
+
+		case BtCoexProfDataLowLatency:
+			iSgParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO] = 50;
+			break;
+
+		case BtCoexProfA2DP:
+			iSgParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO] = 71;
+			break;
+
+		default:
+TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "btCoexistenceProfile - Value Invalide = %d",*pSGProfile);
+			return WHA::KFailed;
+	}
+
+	os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iParamInfo.content.SoftGeminiParam,&iSgParams,sizeof(TSoftGeminiParams));
+	TWD_SetParam(iTwdCtrl.hTWD,&iParamInfo);
+	return WHA::KSuccess;
+}
+
+
+/**
+* \fn     TConvertTwdHtCapa2SHtCapa
+* \brief  Convert the TTwdHtCapabilities structure to WHA::SHtCapabilities  structure
+* 
+* \param TTwdHtCapabilities
+* \param WHA::SHtCapabilities
+* 
+* /note
+* 
+* /return none
+*/
+#ifdef HT_SUPPORT
+void TIWha::TConvertTwdHtCapa2SHtCapa (TTwdHtCapabilities* pTwdHtCapabilities,WHA::SHtCapabilities* pHtCapabilities)
+{
+	os_memoryZero (&iTwdCtrl.tOsContext,pHtCapabilities,sizeof(WHA::SHtCapabilities));
+	pHtCapabilities->iHTCapabilitiesBitMask = (
+                                               #ifdef GREENFIELD_FRAME_SUPPORT
+                                               ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_GREENFIELD_FRAME_FORMAT) << 2) |
+                                               #endif
+                                               #ifdef SHORT_GI_SUPPORT
+											   ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SHORT_GI_FOR_20MHZ_PACKETS) << 2) |
+                                               #endif
+											   ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SHORT_GI_FOR_40MHZ_PACKETS) << 2) |
+											   ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_SUPPORT_FOR_STBC_IN_TRANSMISSION) << 2) |
+											   ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_DELAYED_BLOCK_ACK) << 2) |
+											   ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_DSSS_CCK_IN_40_MHZ) << 2) |
+											   ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_LSIG_TXOP_PROTECTION) << 3) |
+											   ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_PCO) << 3) |
+											   ((pTwdHtCapabilities->uHTCapabilitiesBitMask & CAP_BIT_MASK_LDPC_CODING) >> 8));
+
+	pHtCapabilities->iRxMaxDataRate = pTwdHtCapabilities->uRxMaxDataRate;
+	
+	pHtCapabilities->iChannelWidth = pTwdHtCapabilities->uChannelWidth;
+
+#ifdef RXSTBC_SUPPORT
+	pHtCapabilities->iRxStbc = pTwdHtCapabilities->uRxSTBC;
+#else
+    pHtCapabilities->iRxStbc = RXSTBC_NOT_SUPPORTED;
+#endif
+
+	pHtCapabilities->iMaxAmsdu = pTwdHtCapabilities->uMaxAMSDU;
+
+	pHtCapabilities->iMaxAmpdu = pTwdHtCapabilities->uMaxAMPDU;
+
+	pHtCapabilities->iAmpduSpacing = pTwdHtCapabilities->uAMPDUSpacing;
+
+	//pHtCapabilities->iRxMcs = pTwdHtCapabilities->aRxMCS;
+	os_memoryCopy(&iTwdCtrl.tOsContext,pHtCapabilities->iRxMcs,pTwdHtCapabilities->aRxMCS,sizeof(WHA::THtMcsSet));
+
+	//pHtCapabilities->iTxMcs = pTwdHtCapabilities->aTxMCS;
+
+	os_memoryCopy(&iTwdCtrl.tOsContext,pHtCapabilities->iTxMcs,pTwdHtCapabilities->aTxMCS,sizeof(WHA::THtMcsSet));
+
+	pHtCapabilities->iPcoTransTime = pTwdHtCapabilities->uPCOTransTime;
+
+	pHtCapabilities->iMcsFeedback = pTwdHtCapabilities->uMCSFeedback;
+}
+#endif /* HT_SUPPORT */
+
+/**
+* \fn     SetHTCapabilities
+* \brief  set the HT capabilities of  the AP coming from become/prob resp to FW
+* 
+* \param ShtCapabilities
+* 
+* /note
+* 
+* /return OK for sucsses NOK for failed
+*/
+#ifdef HT_SUPPORT
+WHA::TStatus TIWha::SetHTCapabilities (WHA::ShtCapabilities* pApCapabilities)
+{
+	Tdot11HtCapabilitiesUnparse		aHtCapabilitiesUnparse;
+	Tdot11HtCapabilitiesUnparse*	pHtCapabilitiesUnparse = &aHtCapabilitiesUnparse;
+
+	os_memoryZero(&iTwdCtrl.tOsContext,pHtCapabilitiesUnparse, sizeof(Tdot11HtCapabilitiesUnparse));
+	/* Etract the HT Capabilities for FW, at this poin we ignore the HT Control field bit
+	   since no support in FW */
+	pHtCapabilitiesUnparse->aHtCapabilitiesIe[1] |= (((pApCapabilities->iPeerFeatures & WHA::KGreenfieldFormat) ? HT_CAP_GREENFIELD_FRAME_FORMAT_BITMASK : 0) |
+													 ((pApCapabilities->iPeerFeatures & WHA::KShortGiFor20Mhz) ? HT_CAP_SHORT_GI_FOR_20MHZ_BITMASK : 0));
+
+	pHtCapabilitiesUnparse->aHtCapabilitiesIe[0] |= (((pApCapabilities->iPeerFeatures & WHA::KLsigTxopProtection) ? (HT_CAP_LSIG_TXOP_PROTECTION_BITMASK >> 8) : 0) |
+													 ((pApCapabilities->iPeerFeatures & WHA::KReverseDirectionResp) ? (HT_EXT_RD_INITIATION_BITMASK >> 8) : 0));
+
+	
+	pHtCapabilitiesUnparse->aHtCapabilitiesIe[0] |= ((pApCapabilities->iPeerFeatures & WHA::KHtcField) ? (HT_EXT_HT_CONTROL_FIELDS_BITMASK >> 8) : 0);
+
+	/* Extract the MAX MPDU and MPDU Spacing */
+	pHtCapabilitiesUnparse->aHtCapabilitiesIe[HT_CAP_AMPDU_PARAMETERS_FIELD_OFFSET] = ((pApCapabilities->iMaxAmpduLength) |
+																						(pApCapabilities->iAmpduSpacing << 2));
+
+
+    return TWD_CfgSetFwHtCapabilities(iTwdCtrl.hTWD,pHtCapabilitiesUnparse,(pApCapabilities->iHtSupport > 0 ? TI_TRUE : TI_FALSE));
+}
+#endif /* HT_SUPPORT */
+
+
+/**
+* \fn     SetHTInformation
+* \brief  set the HT Information to FW
+* 
+* \param ShtBssOperation
+* 
+* /note
+* 
+* /return OK for sucsses NOK for failed
+*/
+#ifdef HT_SUPPORT
+WHA::TStatus TIWha::SetHTInformation (WHA::ShtBssOperation* pHtInformarion)
+{
+	Tdot11HtInformationUnparse	aHtInformationUnparse;
+	Tdot11HtInformationUnparse*	pHtInformationUnparse = &aHtInformationUnparse;
+
+	pHtInformationUnparse->aHtInformationIe[1] = ((pHtInformarion->iInfo & WHA::ShtBssOperation::KRifsPermitted) ? WHA::ShtBssOperation::KRifsPermitted : 0);
+	pHtInformationUnparse->aHtInformationIe[2] = pHtInformarion->iOpMode;
+	pHtInformationUnparse->aHtInformationIe[3] = (((pHtInformarion->iInfo & WHA::ShtBssOperation::KNonGreenfieldPresent) ? HT_INF_NON_GF_PRES_BITMASK : 0));
+												  
+	pHtInformationUnparse->aHtInformationIe[4] = ((pHtInformarion->iInfo & WHA::ShtBssOperation::KDualCtsProtReq) ? HT_INF_DUAL_BEACON_BITMASK : 0);
+
+	/* Save the MCS rates for use in Join command at basic rates */
+	os_memoryCopy(&iTwdCtrl.tOsContext,iMcsRates,pHtInformarion->iMcsSet,sizeof(WHA::THtMcsSet));
+
+	return TWD_CfgSetFwHtInformation(iTwdCtrl.hTWD,pHtInformationUnparse);
+}
+#endif /* HT_SUPPORT */
+
+
+/**
+* \fn     ConfigureBA
+* \brief  configure the BA initiator and BA receiver
+* 
+* \param ShtBssOperation
+* 
+* /note
+* 
+* /return OK for sucsses NOK for failed
+*/
+#ifdef HT_SUPPORT
+WHA::TStatus TIWha::ConfigureBA (WHA::ShtBlockAckConfigure* pBABitMask)
+{
+	WHA::TStatus status = TI_NOK;
+	iBACounertRespone = 0;
+#ifndef __AMSDU_MODE__
+
+// Check for which TID is enabled for BA session  
+
+#ifdef TX_BA_SUPPORT
+	/* Set all Transmit BA Support */
+	for (int i = 0;i <= MAX_NUM_OF_802_1d_TAGS; i++)
+	{
+		if (((pBABitMask->iTxBlockAckUsage >> i) & 0x1) > ((iTxBlockAckUsageLast >> i) & 0x1))
+		{
+			status = TWD_CfgSetBaInitiator(iTwdCtrl.hTWD,i,TRUE,iJoinedMacAddress,RX_QUEUE_WIN_SIZE,HT_BA_INACTIVITY_TIMEOUT_DEF);
+			iBACounertRespone++;
+		}
+		else {
+			if (((pBABitMask->iTxBlockAckUsage >> i) & 0x1) < ((iTxBlockAckUsageLast >> i) & 0x1))
+			{
+				status = TWD_CfgSetBaInitiator(iTwdCtrl.hTWD,i,FALSE,iJoinedMacAddress,RX_QUEUE_WIN_SIZE,HT_BA_INACTIVITY_TIMEOUT_DEF);
+				iBACounertRespone++;
+			}
+		}
+	}
+    iTxBlockAckUsageLast = pBABitMask->iTxBlockAckUsage;
+#endif
+
+	/* Set all Receive BA */
+	
+	for (int i = 0;i <= MAX_NUM_OF_802_1d_TAGS; i++)
+	{
+		if (((pBABitMask->iRxBlockAckUsage >> i) & 0x1) > ((iRxBlockAckUsageLast >> i) & 0x1))
+		{
+			status = TWD_CfgSetBaReceiver(iTwdCtrl.hTWD,i,TRUE,iJoinedMacAddress,RX_QUEUE_WIN_SIZE);
+			iBACounertRespone++;
+		}
+		else {
+			if (((pBABitMask->iRxBlockAckUsage >> i) & 0x1) < ((iRxBlockAckUsageLast >> i) & 0x1))
+			{
+				status = TWD_CfgSetBaReceiver(iTwdCtrl.hTWD,i,FALSE,iJoinedMacAddress,RX_QUEUE_WIN_SIZE);
+				iBACounertRespone++;
+	}
+		}
+	}
+	
+
+	/* Save the current BA vectors */
+	iRxBlockAckUsageLast = pBABitMask->iRxBlockAckUsage;
+#endif
+	return status;
+}
+#endif /* HT_SUPPORT */
+
+/**
+* \fn     TxAutoRatePolicy
+* \brief  Specifies the supported rates
+* 
+* \param StxAutoRatePolicy
+* 
+* /note
+* 
+* /return OK for sucsses NOK for failed
+*/
+WHA::TStatus TIWha::TxAutoRatePolicy (WHA::StxAutoRatePolicy* pTxAutoRatePolicy)
+{
+	iTxRatePolicy.aMib = MIB_txRatePolicy;
+    /* The length field is not in use */
+    iTxRatePolicy.Length = 0;
+	/* we only have 1 policy since FW decide on which  rate to use */
+    iTxRatePolicy.aData.txRatePolicy.numOfRateClasses = pTxAutoRatePolicy->iTxRateClassId;
+
+    #ifdef HT_SUPPORT
+        iTxRatePolicy.aData.txRatePolicy.rateClass[pTxAutoRatePolicy->iTxRateClassId - 1].txEnabledRates = TIWhaUtils::HTWhaRateToRatePolicy(pTxAutoRatePolicy);
+    #else
+        iTxRatePolicy.aData.txRatePolicy.rateClass[pTxAutoRatePolicy->iTxRateClassId - 1].txEnabledRates = TIWhaUtils::WhaRateToRatePolicy(pTxAutoRatePolicy);
+    #endif
+
+    #ifdef ALL_RATES_OPEN_DEBUG
+        if ( iTxRatePolicy.aData.txRatePolicy.rateClass[pTxAutoRatePolicy->iTxRateClassId - 1].txEnabledRates & HW_BIT_RATE_54MBPS)
+        {
+             iTxRatePolicy.aData.txRatePolicy.rateClass[pTxAutoRatePolicy->iTxRateClassId - 1].txEnabledRates = 0x1DFF;    
+        }
+    #endif
+    
+	iTxRatePolicy.aData.txRatePolicy.rateClass[pTxAutoRatePolicy->iTxRateClassId - 1].shortRetryLimit = pTxAutoRatePolicy->iShortRetryLimit;
+	iTxRatePolicy.aData.txRatePolicy.rateClass[pTxAutoRatePolicy->iTxRateClassId - 1].longRetryLimit = pTxAutoRatePolicy->iLongRetryLimit;
+
+	return (TWD_WriteMib (iTwdCtrl.hTWD, &iTxRatePolicy) == TI_OK) ? WHA::KSuccess : WHA::KFailed;
+}
+
+/**
+* \fn     SetPowerSavePowerLevel
+* \brief  Set the Power save power level
+*
+* 
+* /note
+* 
+* /return 
+*/
+void TIWha::SetPowerSavePowerLevel(void *aMib)
+{
+	//os_printf("SetPowerSavePowerLevel send EPowerPolicy = %d",*((EPowerPolicy*)aMib));
+	TWD_CfgSleepAuth(iTwdCtrl.hTWD, *((EPowerPolicy*)aMib));
+}
+
+
+/**
+* \fn     SoftGemini_SetParams
+* \brief  initialization of Soft Gemini parameters
+*
+* used for init stage to initialize the SG parameters
+* /note
+* 
+* /return 
+*/
+
+TI_STATUS TIWha::SoftGemini_SetParams (TI_HANDLE hTWD, TSoftGeminiParams *pSgParams,ESoftGeminiEnableModes aSgMode )
+{
+	TTwdParamInfo			iParamInfo;
+
+	iParamInfo.paramType = TWD_SG_CONFIG_PARAM_ID;
+	iParamInfo.paramLength = sizeof(TSoftGeminiParams);
+	os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iParamInfo.content.SoftGeminiParam,&iSgParams,sizeof(TSoftGeminiParams));
+	TWD_SetParam(iTwdCtrl.hTWD,&iParamInfo);
+
+	iParamInfo.paramType = TWD_SG_ENABLE_PARAM_ID;
+	iParamInfo.paramLength = sizeof(ESoftGeminiEnableModes);
+	iParamInfo.content.SoftGeminiEnable = aSgMode;
+	TWD_SetParam(iTwdCtrl.hTWD,&iParamInfo);
+	return TI_OK;
+}
+
+/** 
+* \fn     ConfigureBtCoex
+* \brief  Set the Soft Gemini parameters and send it to FW 
+*          
+* \note   
+* \return KSuccess or KFailed
+* \sa     
+*/ 
+void TIWha::InitBtCoex()
+{
+    
+	/* Set Static parameters */
+
+    /* Setting the ratio for each profile */
+    /* Both coexBtLoadRatio & coexBtLoadRatio are 50/50 profiles */
+    /* The default profile is set to BtCoexProfData */
+	switch (BTCOEX_DEFAULT_PROFILE)
+	{
+		case BtCoexProfData:
+			iSgParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO] = 50;
+			break;
+
+		case BtCoexProfDataLowLatency:
+			iSgParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO] = 50;
+			break;
+
+		case BtCoexProfA2DP:
+			iSgParams.coexParams[SOFT_GEMINI_BT_LOAD_RATIO] = 71;
+			break;
+
+		default:
+            TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "btCoexistenceProfile - Value Invalide = %d",BTCOEX_DEFAULT_PROFILE);
+			return;
+	}
+
+    iSgParams.coexParams[SOFT_GEMINI_BT_PER_THRESHOLD] = 7500;
+    iSgParams.coexParams[SOFT_GEMINI_HV3_MAX_OVERRIDE] = 0;
+    iSgParams.coexParams[SOFT_GEMINI_BT_NFS_SAMPLE_INTERVAL] = 400;
+    iSgParams.coexParams[SOFT_GEMINI_AUTO_PS_MODE] = 0;	
+    iSgParams.coexParams[SOFT_GEMINI_AUTO_SCAN_PROBE_REQ] = 170;
+    iSgParams.coexParams[SOFT_GEMINI_ACTIVE_SCAN_DURATION_FACTOR_HV3]	= 50;   
+    iSgParams.coexParams[SOFT_GEMINI_ANTENNA_CONFIGURATION] = 0;        
+    iSgParams.coexParams[SOFT_GEMINI_BEACON_MISS_PERCENT] = 60;
+    iSgParams.coexParams[SOFT_GEMINI_RATE_ADAPT_THRESH] = 21; /* Set to MCS_7 */
+    #ifdef ENHANCED_OPPORTUNISTIC
+        iSgParams.coexParams[SOFT_GEMINI_RATE_ADAPT_SNR] = 1;        
+    #else
+        iSgParams.coexParams[SOFT_GEMINI_RATE_ADAPT_SNR]= 0;
+    #endif    
+
+
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_BR] = 10;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_BR] = 30;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_BR] = 8;
+
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_BR] = 20;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_BR] = 50;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_BR] = 8;
+
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MIN_EDR] = 7;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_MASTER_MAX_EDR] = 25;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_MASTER_EDR] = 20;
+
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MIN_EDR] = 8;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_BT_ACL_SLAVE_MAX_EDR] = 40;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_PS_MAX_BT_ACL_SLAVE_EDR] = 12;    
+    iSgParams.coexParams[SOFT_GEMINI_RXT] = 1200;
+    iSgParams.coexParams[SOFT_GEMINI_TXT] = 1500;
+    iSgParams.coexParams[SOFT_GEMINI_ADAPTIVE_RXT_TXT] = 1;
+    iSgParams.coexParams[SOFT_GEMINI_PS_POLL_TIMEOUT] = 10;
+    iSgParams.coexParams[SOFT_GEMINI_UPSD_TIMEOUT] = 10;
+    iSgParams.coexParams[SOFT_GEMINI_UPSD_TIMEOUT] = 10;
+
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MIN_EDR] = 7;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MASTER_MAX_EDR] = 15;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_MASTER_EDR] = 15;
+
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MIN_EDR] = 8;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_SLAVE_MAX_EDR] = 20;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_SLAVE_EDR] = 15;
+
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MIN_BR] = 20;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_BT_ACL_MAX_BR] = 50;
+    iSgParams.coexParams[SOFT_GEMINI_WLAN_ACTIVE_MAX_BT_ACL_BR] = 5;
+
+    iSgParams.coexParams[SOFT_GEMINI_PASSIVE_SCAN_DURATION_FACTOR_HV3] = 200;
+    iSgParams.coexParams[SOFT_GEMINI_PASSIVE_SCAN_DURATION_FACTOR_A2DP] = 800;
+    iSgParams.coexParams[SOFT_GEMINI_PASSIVE_SCAN_BT_TIME] = 75;
+    iSgParams.coexParams[SOFT_GEMINI_PASSIVE_SCAN_WLAN_TIME] = 15;    
+    iSgParams.coexParams[SOFT_GEMINI_HV3_MAX_SERVED] = 6;    
+
+    iSgParams.coexParams[SOFT_GEMINI_DHCP_TIME] = 5000;    
+    iSgParams.coexParams[SOFT_GEMINI_ACTIVE_SCAN_DURATION_FACTOR_A2DP] = 100;
+
+    iSgParams.coexParams[SOFT_GEMINI_TEMP_PARAM_1] = 0;
+    iSgParams.coexParams[SOFT_GEMINI_TEMP_PARAM_2] = 0;
+    iSgParams.coexParams[SOFT_GEMINI_TEMP_PARAM_3] = 0;
+    iSgParams.coexParams[SOFT_GEMINI_TEMP_PARAM_4] = 0;    
+    iSgParams.coexParams[SOFT_GEMINI_TEMP_PARAM_5] = 0;    
+}
+
+
+/** 
+* \fn     AddKey
+* \brief  Add key according to the key type 
+*          
+* \note   In case we already used the given index, we remove the old key
+* \return   
+* \sa     
+*/ 
+void TIWha::AddKey(
+					  WHA::TKeyType aType, 
+					  const void* aKey,
+					  TUint8 aEntryIndex )
+{    
+    TTwdParamInfo    param;
+    TSecurityKeys    key;
+    TI_STATUS        status;
+
+    os_memoryZero ((TI_HANDLE)&iTwdCtrl.tOsContext, &key, sizeof(TSecurityKeys));
+
+    if (aEntryIndex >= TIWha_MAX_PRIVACY_KEY_INDEX)
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Invalid index=%d\n", aEntryIndex)
+    }
+
+    /* if the Key already exists, we remove it, and add the new one     */
+    /* we check the encLen field beacuse if there is key in this entry  */
+    /* the encLen field is always different than zero                   */
+    if (iTwdCtrl.privacyKey[aEntryIndex].encLen !=0)
+    {
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "Remove duplicate Key from AddKey, aEntryIndex= 0x%x\n", aEntryIndex);
+       RemoveKey(aEntryIndex);
+    }
+    else
+    {
+         TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "AddKey, New key aEntryIndex= 0x%x, encLen= %d \n", aEntryIndex, iTwdCtrl.privacyKey[aEntryIndex].encLen);
+    }
+
+    /* Set the security mode */
+    switch (aType)
+    {
+    case WHA::EWepGroupKey:
+        param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_WEP;
+        iTwdCtrl.eGroupKeyMode = TWD_CIPHER_WEP;
+        break;
+
+    case WHA::EWepPairWiseKey:
+        param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_WEP;
+        iTwdCtrl.ePairwiseKeyMode = TWD_CIPHER_WEP;
+        break;
+
+    case WHA::ETkipGroupKey:
+        param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_TKIP;
+        iTwdCtrl.eGroupKeyMode = TWD_CIPHER_TKIP;
+        break;
+
+    case WHA::ETkipPairWiseKey:
+        param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_TKIP;
+        iTwdCtrl.ePairwiseKeyMode = TWD_CIPHER_TKIP;
+        break;
+
+    case WHA::EAesGroupKey:
+        param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_AES_CCMP;
+        iTwdCtrl.eGroupKeyMode = TWD_CIPHER_AES_CCMP;
+        break;
+
+    case WHA::EAesPairWiseKey:
+        param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_AES_CCMP;
+        iTwdCtrl.ePairwiseKeyMode = TWD_CIPHER_AES_CCMP;
+        break;
+
+    #ifdef GEM_SUPPORT
+    case GEMGroupKey:
+            param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_GEM;
+            iTwdCtrl.eGroupKeyMode = TWD_CIPHER_GEM;
+            break;
+    
+    case GEMPairWiseKey:
+            param.content.rsnEncryptionStatus = (ECipherSuite)TWD_CIPHER_GEM;
+            iTwdCtrl.ePairwiseKeyMode = TWD_CIPHER_GEM;
+            break;
+    #endif
+
+    default:
+            ASSERT_ERR (iTwdCtrl.hReport, "Unknown key type=%d\n", aType)
+    }   
+
+    param.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID;
+    TWD_SetParam (iTwdCtrl.hTWD, &param);
+
+    /*  Converts the AddKey back to the correlated TWD command   */
+    if (ConstructAddKey (&key, 
+                                        aType,
+                                        aKey,
+                                        aEntryIndex) != WHA::KSuccess)
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Failed to construct key type=%d\n", aType)
+    }
+
+    os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                   (void *)&iTwdCtrl.privacyKey[aEntryIndex], 
+                   (void *)&key, 
+                   sizeof(TSecurityKeys));
+    
+    /* Activates the whal TWD_SetParam function (with TWD_RSN_KEY_ADD_PARAM)  */
+    param.paramType = TWD_RSN_KEY_ADD_PARAM_ID;
+    param.content.configureCmdCBParams.pCb = (TUint8*)&key;
+    param.content.configureCmdCBParams.fCb = (void *)TIWhaAdaptCB::AddKeyResponse;
+    param.content.configureCmdCBParams.hCb = this;
+
+    status = TWD_SetParam (iTwdCtrl.hTWD, &param);
+
+    if (status != TI_OK) 
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Add key failure, key index=%d\n", aEntryIndex)
+    }
+}
+
+/** 
+* \fn     ConstructAddKey
+* \brief  utility function for AddKey
+*          
+* \note   
+* \return   
+* \sa     
+*/ 
+WHA::TStatus TIWha::ConstructAddKey (
+    TSecurityKeys   *aSecurityKey,  /* structure to be filled               */
+    WHA::TKeyType        aType,          /* Type of the key to be added          */
+    const void      *aKey,          /* Pointer to buffer specifying the key */
+                                    /* material, according to the key type  */
+                                    /* (see specification for details).     */
+    TUint8          aEntryIndex)    /* Key entry index. Valid range: 0-8.   */
+{  
+    TUint8      broadcast[MAC_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "(%d) - ConstructAddKey, type=%d ïndex=%d\n",__LINE__,aType, aEntryIndex);
+    
+    /* Fill up the mutual fields */
+    switch (aType) 
+    {
+        case WHA::EWepGroupKey:
+        {
+            /* 
+             * WEP Group Key:
+             * 1) Key length 
+             * 2) Key
+             * 3) Default key number
+             */
+            WHA::SWepGroupKey* pKey = (WHA::SWepGroupKey*)aKey;  
+            
+            aSecurityKey->keyType = KEY_WEP;
+            aSecurityKey->encLen = pKey->iKeyLengthInBytes; 
+            aSecurityKey->keyIndex = pKey->iKeyId;
+            
+            if (!bJoined) {
+            /* Clear mac address to distinguish between Group and Pairwise */
+            os_memoryZero ((TI_HANDLE)&iTwdCtrl.tOsContext,
+                           (void*)aSecurityKey->macAddress,
+                           sizeof(TMacAddr));
+            }
+            else
+            {
+                MAC_COPY (aSecurityKey->macAddress, broadcast);
+            }
+
+
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->encKey, 
+                           (void*)pKey->iKey, 
+                           aSecurityKey->encLen);
+                
+            break;
+        }       
+        case WHA::EWepPairWiseKey:
+        {
+            /*
+             * WEP Pairwise Key:
+             * 1) MAC Address of the peer station
+             * 2) Key length 
+             * 3) Key
+             */
+            WHA::SWepPairwiseKey* pKey = (WHA::SWepPairwiseKey*)aKey;  
+            
+            aSecurityKey->keyType = KEY_WEP;
+            aSecurityKey->keyIndex = 0;
+            MAC_COPY (aSecurityKey->macAddress, (TI_UINT8*)&pKey->iMacAddr); 
+            aSecurityKey->encLen = pKey->iKeyLengthInBytes; 
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->encKey, 
+                           (void*)pKey->iKey, 
+                           aSecurityKey->encLen);
+        
+                break;
+        }       
+                
+        case WHA::ETkipGroupKey: 
+        {
+            /* TKIP Group Key:
+             * 1) 128 encryption key
+             * 2) 64 bit Rx MIC Key
+             * 3) Key ID
+             */
+            WHA::STkipGroupKey* pKey = (WHA::STkipGroupKey*)aKey; 
+            
+            aSecurityKey->keyType = KEY_TKIP;
+            aSecurityKey->encLen = WHA::KTKIPKeyLength;
+            MAC_COPY (aSecurityKey->macAddress, broadcast);
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->micRxKey, 
+                           (void*)pKey->iRxMicKey, 
+                           WHA::KTKIPKeyLength);           
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->encKey, 
+                           (void*)pKey->iTkipKey, 
+                           WHA::KTKIPKeyLength);
+            aSecurityKey->keyIndex = pKey->iKeyId;
+            break;
+        }       
+
+        case WHA::ETkipPairWiseKey:
+        {
+            /* 
+             * TKIP Pairwise Key:
+             * 1) MAC Address of the peer station
+             * 2) 64 bit Rx MIC Key
+             * 3) 64 bit Tx MIC Key
+             * 4) 128 encryption key
+             * 5) Key ID
+             */
+            WHA::STkipPairwiseKey* pKey = (WHA::STkipPairwiseKey*)aKey;             
+
+            aSecurityKey->keyType = KEY_TKIP;
+            aSecurityKey->encLen = WHA::KTKIPKeyLength;
+            MAC_COPY (aSecurityKey->macAddress, (TI_UINT8*)&pKey->iMacAddr); 
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->micRxKey, 
+                           (void*)pKey->iRxMicKey, 
+                           WHA::KTKIPKeyLength);            
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->micTxKey, 
+                           (void*)pKey->iTxMicKey, 
+                           WHA::KTKIPKeyLength);            
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->encKey, 
+                           (void*)pKey->iTkipKey, 
+                           WHA::KTKIPKeyLength);
+            aSecurityKey->keyIndex = pKey->iKeyId;
+            break;
+        }       
+
+        case WHA::EAesGroupKey:
+        {
+            /* AES Group Key:
+             * 1) 128 encryption key 
+             * 2) key ID
+             */
+            WHA::SAesGroupKey* pKey = (WHA::SAesGroupKey*)aKey;             
+
+            /* Fill security key structure */
+            aSecurityKey->keyType = KEY_AES;
+            aSecurityKey->encLen = WHA::KAesKeyLength;
+            MAC_COPY (aSecurityKey->macAddress, broadcast);
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->encKey, 
+                           (void*)pKey->iAesKey, 
+                           WHA::KAesKeyLength);
+            aSecurityKey->keyIndex = pKey->iKeyId;
+            break;
+        }       
+
+        case WHA::EAesPairWiseKey:
+        {
+            /* 
+             * AES Pairwise Key:
+             * 1) MAC Address of the peer station
+             * 2) 128 encryption key 
+             */
+            WHA::SAesPairwiseKey* pKey = (WHA::SAesPairwiseKey*)aKey;             
+
+            /* Fill security key structure */
+            aSecurityKey->keyType = KEY_AES;
+            aSecurityKey->encLen = WHA::KAesKeyLength;
+            aSecurityKey->keyIndex = 0;
+            MAC_COPY (aSecurityKey->macAddress, (TI_UINT8*)&pKey->iMacAddr); 
+            os_memoryCopy ((TI_HANDLE)&iTwdCtrl.tOsContext, 
+                           (void*)aSecurityKey->encKey, 
+                           (void*)pKey->iAesKey, 
+                           WHA::KAesKeyLength);                      
+            break;
+        }
+
+        #ifdef GEM_SUPPORT
+            case GEMGroupKey:
+            {
+                SGEMGroupKey* pKey = (SGEMGroupKey*)aKey;
+    
+                /* Fill security key structure */
+                aSecurityKey->keyType = KEY_GEM;
+                aSecurityKey->encLen = KGEMKeyLength;
+                aSecurityKey->keyIndex = pKey->iKeyId;
+                MAC_COPY (aSecurityKey->macAddress, broadcast);
+                GROUP_KEY_COPY ((TI_HANDLE)&iTwdCtrl.tOsContext,aSecurityKey,pKey,KGEMKeyLength);
+                GROUP_MIC_COPY ((TI_HANDLE)&iTwdCtrl.tOsContext,aSecurityKey,pKey,KGEMMicKeyLength);
+                break;
+            }
+    
+            case GEMPairWiseKey:
+            {
+                SGEMPairwiseKey* pKey = (SGEMPairwiseKey*)aKey;             
+    
+                /* Fill security key structure */
+                aSecurityKey->keyType = KEY_GEM;
+                aSecurityKey->encLen = KGEMKeyLength;
+                aSecurityKey->keyIndex = pKey->iKeyId;
+                MAC_COPY (aSecurityKey->macAddress, (TI_UINT8*)&pKey->iMacAddr); 
+                PAIRWISE_KEY_COPY ((TI_HANDLE)&iTwdCtrl.tOsContext,aSecurityKey,pKey,KGEMKeyLength);
+                PAIRWISE_MIC_COPY ((TI_HANDLE)&iTwdCtrl.tOsContext,aSecurityKey,pKey,KGEMMicKeyLength);
+                break;
+            }
+        #endif /* GEM_SUPPORT */
+
+        default:
+            /*
+             * NULL_KEY, XCC_KEY
+             */
+            TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "(%d) - ConstructAddKey - ERROR - Key not supported, %d\n",__LINE__,aType);
+
+            break;
+    }
+
+    return WHA::KSuccess;
+}
+
+/** 
+* \fn     RemoveKey
+* \brief  Remove key from our data base and from Fw
+*          
+* \note   This function is never called from LDD, therfore we use dummy response
+* \return   
+* \sa     
+*/ 
+void TIWha::RemoveKey( TUint8 aEntryIndex)
+{        
+    TTwdParamInfo    param;
+    TI_STATUS        status;
+	ECipherSuite	 eOldCipherSuite;
+    TBool 			 bSecurityChanged = FALSE;
+
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "RemoveKey, aEntryIndex= 0x%x\n", aEntryIndex);
+
+    if (aEntryIndex >= TIWha_MAX_PRIVACY_KEY_INDEX)
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Invalid key index=%d\n", aEntryIndex)
+    }
+    
+	param.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID;
+	status = TWD_GetParam(iTwdCtrl.hTWD, &param);
+	if (status != TI_OK)
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "RemoveKey : Remove key failure, key index=%d\n", aEntryIndex)
+    }
+
+	eOldCipherSuite = param.content.rsnEncryptionStatus;
+
+	/* Synchronies the current security mode with the key security mode */ 
+	switch (iTwdCtrl.privacyKey[aEntryIndex].keyType)
+	{
+		case KEY_WEP: param.content.rsnEncryptionStatus = TWD_CIPHER_WEP; break;
+	    case KEY_TKIP: param.content.rsnEncryptionStatus = TWD_CIPHER_TKIP; break;
+        case KEY_AES: param.content.rsnEncryptionStatus = TWD_CIPHER_AES_CCMP; break;
+        #ifdef GEM_SUPPORT
+            case KEY_GEM: param.content.rsnEncryptionStatus = TWD_CIPHER_GEM; break;
+        #endif
+	}
+
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "RemoveKey, keyType= 0x%x, rsnEncryptionStatus = 0x%x eOldCipherSuite = 0x%x\n",         iTwdCtrl.privacyKey[aEntryIndex].keyType, param.content.rsnEncryptionStatus, eOldCipherSuite);
+
+    /* Check if we should update security mode */
+    if (eOldCipherSuite != param.content.rsnEncryptionStatus)
+    {
+        bSecurityChanged = TRUE;
+        /* Change security mode in whalSecurity  */
+        status = TWD_SetParam (iTwdCtrl.hTWD, &param);
+		if (status != TI_OK)
+		{
+			ASSERT_ERR (iTwdCtrl.hReport, "RemoveKey : Remove key failure, key index=%d\n", aEntryIndex)
+		}
+    }
+	
+    /* Activates the TWD_SetParam function (with TWD_RSN_KEY_REMOVE_PARAM) */
+    param.paramType = TWD_RSN_KEY_REMOVE_PARAM_ID;        
+    param.content.configureCmdCBParams.pCb = (TUint8*)&iTwdCtrl.privacyKey[aEntryIndex];
+    /* Note that we never response a remove key since it is internal command. Symbian never issue this command */
+    param.content.configureCmdCBParams.fCb = (void *)TIWhaAdaptCB::DummyResponse;
+    param.content.configureCmdCBParams.hCb = this;
+
+     status = TWD_SetParam (iTwdCtrl.hTWD, &param); 
+
+    if (status != TI_OK)
+    {
+        ASSERT_ERR (iTwdCtrl.hReport, "Remove key failure, key index=%d\n", aEntryIndex)
+    }
+    else
+    {
+        /* remove the key from the keys table */
+        os_memoryZero ((TI_HANDLE)&iTwdCtrl.tOsContext, &iTwdCtrl.privacyKey[aEntryIndex], sizeof(TSecurityKeys));
+    }
+
+    /* Check if we should update back security mode */
+    if (bSecurityChanged)
+    {
+        param.content.rsnEncryptionStatus = eOldCipherSuite;
+        param.paramType = TWD_RSN_SECURITY_MODE_PARAM_ID;
+        status = TWD_SetParam (iTwdCtrl.hTWD, &param);
+		if (status != TI_OK)
+		{
+			ASSERT_ERR (iTwdCtrl.hReport, "RemoveKey : Remove key failure, key index=%d\n", aEntryIndex)
+		}
+    }
+}
+
+/** 
+* \fn     ConfigureQueue
+* 
+* \return
+* \sa     
+*/
+void TIWha::ConfigureQueue(
+							  WHA::TQueueId aQueueId,
+							  TUint32 aMaxLifeTime,
+							  WHA::TPsScheme aPsScheme,
+							  const WHA::SSAPSDConfig& aSAPSDConfig,
+							  WHA::TAckPolicy aAckPolicy,
+							  	TUint16 aMediumTime )
+{    
+    TTwdParamInfo        param;
+    TQueueTrafficParams  QueueTrafficParams;
+    TI_STATUS            status;  
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+
+    TRACE5(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " TIWha::ConfigureQueue: aQueueId = 0x%x, aPsScheme = 0x%x, APSDConf[0] = 0x%x, APSDConf[1] = 0x%x, aAckPolicy = 0x%x\n",                aQueueId,aPsScheme,aSAPSDConfig.iServiceStartTime,aSAPSDConfig.iServiceInterval,aAckPolicy);
+
+    /* Set parameters */ 
+    QueueTrafficParams.queueID = (TUint8)aQueueId;
+    /* 0- 3 EDCA , 4 - HCCA */
+    QueueTrafficParams.channelType = (aQueueId < 4) ? CHANNEL_TYPE_EDCF : CHANNEL_TYPE_HCCA;
+    QueueTrafficParams.tsid        = (TUint8)aQueueId;   
+    QueueTrafficParams.dot11EDCATableMSDULifeTime = 0;
+    QueueTrafficParams.psScheme    = aPsScheme;
+    QueueTrafficParams.APSDConf[0] = aSAPSDConfig.iServiceStartTime;
+    QueueTrafficParams.APSDConf[1] = aSAPSDConfig.iServiceInterval;
+    QueueTrafficParams.ackPolicy = aAckPolicy;
+
+    param.paramType = (TUint32)TWD_QUEUES_PARAM_ID;
+    param.content.pQueueTrafficParams = &QueueTrafficParams;
+
+    status = TWD_SetParam (iTwdCtrl.hTWD, &param);
+
+    if (status != TI_OK) 
+    {
+        ASSERT_ERR ( iTwdCtrl.hReport, "ERROR:Configure queue failure, queue ID=%d\n", aQueueId)
+    }
+}
+
+/** 
+* \fn     ConfigureAC
+* 
+* \return
+* \sa     
+*/
+void TIWha::ConfigureAC(
+						   TUint16 aCwMin[Wha::KNumOfEdcaQueues],
+						   TUint16 aCwMax[Wha::KNumOfEdcaQueues],
+						   TUint8 aAIFS[Wha::KNumOfEdcaQueues],
+						   TUint16 aTxOplimit[Wha::KNumOfEdcaQueues],
+						   TUint16 aMaxReceiveLifeTime[Wha::KNumOfEdcaQueues] )
+{    
+    TAcQosParams      AcQosParams;
+    WHA::TStatus           status    = TI_OK;
+    TUint8            i;
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+      
+    /* configure all AC's but the last one in a loop that returns as a dummy CB */
+    for (i = 0; (i < Wha::KNumOfEdcaQueues - 1) && (TI_OK == status); i++)
+    {       
+        TRACE5(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " TIWha::ConfigureAC: Index = 0x%x, aCwMin = 0x%x, aCwMax = 0x%x, aAIFS = 0x%x, aTxOpLimit = 0x%x\n",            i,aCwMin[i],aCwMax[i],aAIFS[i],aTxOplimit[i]);
+
+        AcQosParams.ac = i;
+        AcQosParams.cwMin = (TUint8)aCwMin[i];
+        AcQosParams.cwMax = aCwMax[i];
+        AcQosParams.aifsn = aAIFS[i];
+        AcQosParams.txopLimit = aTxOplimit[i];
+
+        status = TWD_CfgAcParams (iTwdCtrl.hTWD, 
+                                  &AcQosParams, 
+                                  (void *)TIWhaAdaptCB::DummyResponse,
+                                  this);
+    }
+
+    /* After the loop - the last AC returns as a real CB */
+    if (TI_OK == status)
+    {
+        TRACE5(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " TIWha::ConfigureAC: Index = 0x%x, aCwMin = 0x%x, aCwMax = 0x%x, aAIFS = 0x%x, aTxOpLimit = 0x%x\n",            i,aCwMin[i],aCwMax[i],aAIFS[i],aTxOplimit[i]);
+        
+        AcQosParams.ac = i;
+        AcQosParams.cwMin = (TUint8)aCwMin[i];
+        AcQosParams.cwMax = aCwMax[i];
+        AcQosParams.aifsn = aAIFS[i];
+        AcQosParams.txopLimit = aTxOplimit[i];
+
+        status = TWD_CfgAcParams (iTwdCtrl.hTWD, 
+                                  &AcQosParams, 
+                                  NULL, /* The generic CB will be called */
+                                  NULL);
+    }
+
+    if (status != TI_OK) 
+    {
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "ERROR: Configure AC failure, status=%d\n", status);
+    }
+}
+
+
+
+/** 
+* \fn     Reset
+* \brief  disconnect from BSS/IBSS
+* \return
+* \sa     
+*/
+void TIWha::Reset() 
+{    
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+    int          status;
+
+    /* Check if we are in 802.11 PS mode. If not we should update sleepMode */
+    if (!(TWD_GetPsStatus (iTwdCtrl.hTWD)))
+    {
+        /* Configure H/W to user sleep mode */
+        SleepMode (iTwdCtrl.sleepMode, FALSE);
+    }
+
+
+    /* If connection timer is running - stop it */
+    if (bConnectionTimerRunning)
+    {
+        bConnectionTimerRunning = TI_FALSE;
+        os_timerStop(&iTwdCtrl.tOsContext, hConnectionTimer);
+    }
+
+#ifdef HT_SUPPORT
+	TWD_CloseAllBaSessions(iTwdCtrl.hTWD);
+#endif /* HT_SUPPORT */
+    
+    status = TWD_CmdFwDisconnect ( iTwdCtrl.hTWD ,DISCONNECT_IMMEDIATE , STATUS_UNSPECIFIED);
+
+    if (status != TI_OK) 
+    {
+        ASSERT_ERR ( iTwdCtrl.hReport, "Reset failure, status=%d\n", status)
+    }
+
+    /* We are not connected */
+    bJoined = 0;
+}
+
+#ifdef TI_TEST
+TTestCmd mTest;
+/**
+* \fn     PltTester
+* \brief  Called when PLT commands sent externally
+*
+* /Param aData - parametrs of PLT command
+* /return  
+*/
+void TIWha::PltTester(const void *aData)
+{
+	TTestCmd* pPltTester = (TTestCmd*)aData;
+	os_memoryCopy(NULL,&mTest,(void *)aData,sizeof(TTestCmd));
+	Plt(pPltTester->testCmdId,&mTest.testCmd_u);
+}
+
+
+
+/**
+* \fn     ChangeQueue
+* \brief  Change the output queue for all packets
+*
+* /Param aData - queue to be set
+* /return  
+*/
+void TIWha::ChangeQueue(const void *aData)
+{
+	iQueueId = *(WHA::TQueueId*)aData;
+
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandResponse(WHA::EWriteMIBResponse, WHA::KSuccess, iUCommandResponseParams);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif
+}
+#endif /* TI_TEST */
+
+
+/**
+* \fn     Plt
+* \brief  production line testing
+*
+* The host driver calls this method to perform production 
+* line testing of the WLAN device
+* /param eTestCmd - specific test enum
+* /param pTestCmdParams - test specific parameters and place for return buffer
+* /return  TStatus - KPending or KError
+*/
+WHA::TStatus TIWha::Plt (ETestCmdID eTestCmd, void *pTestCmdParams)
+{
+	TI_STATUS status;
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " CmdID = 0x%x\n", eTestCmd);
+
+    /* Save type of test to be retrieved later on the CB */
+    iTwdCtrl.ePlt = eTestCmd;
+
+	switch (eTestCmd)
+	{
+    case TEST_CMD_P2G_CAL:
+        status =  TWDriverTest (iTwdCtrl.hTWD, 
+                                  (TestCmdID_enum) eTestCmd, 
+                                  pTestCmdParams,
+                                  TIWhaAdaptCB::TxBipResponse, 
+                                  (TI_HANDLE) this);
+        break;
+        
+    case TEST_CMD_RX_PLT_CAL:
+        status =  TWDriverTest (iTwdCtrl.hTWD, 
+                                  (TestCmdID_enum) eTestCmd, 
+                                  pTestCmdParams,
+                                  TIWhaAdaptCB::RxBipResponse, 
+                                  (TI_HANDLE) this);
+        break;
+
+    case TEST_CMD_RX_STAT_GET:
+		status =  TWDriverTest (iTwdCtrl.hTWD, 
+						   (TestCmdID_enum) eTestCmd, 
+						   pTestCmdParams,
+						   TIWhaAdaptCB::RxStatResponse, 
+						   (TI_HANDLE) this);
+		break;
+    case TEST_CMD_FREE_RUN_RSSI:
+        status =  TWDriverTest (iTwdCtrl.hTWD, 
+						   (TestCmdID_enum) eTestCmd, 
+						   pTestCmdParams,
+						   TIWhaAdaptCB::RunRssiResponse, 
+						   (TI_HANDLE) this);
+		break;
+
+	default:
+		status =  TWDriverTest (iTwdCtrl.hTWD, 
+    				   (TestCmdID_enum) eTestCmd, 
+    				   pTestCmdParams, 
+    				   TIWhaAdaptCB::PltResponse, 
+    				   (TI_HANDLE) this);
+    } /* switch */
+
+	return (status == TI_OK) ? WHA::KPending : WHA::KFailed;
+}
+/**
+* \fn     Plt 
+* \brief  production line testing 
+*
+* The host driver calls this method to perform production 
+* line testing of the WLAN device
+* /param TPltType - specific test enum
+* /param aParams - test specific parameters and place for return buffer
+* /return  TStatus - KPending or KError
+*/
+void TIWha::Plt (WHA::TPltType aType, void *aParams)
+{
+    Plt((ETestCmdID) aType,aParams);
+}
+
+
+/** 
+ * \fn     WriteMem
+ * \brief  write buffer to HW address
+ * 
+ * \note    
+ * \param  pMemoryAccess - address, length, buffer
+ * \return  TStatus 
+ */ 
+WHA::TStatus TIWha::WriteMem (TMemoryAccess *pMemoryAccess)
+{    
+TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " addr = 0x%x length = %d p = %p\n", pMemoryAccess->addr, pMemoryAccess->length, pMemoryAccess);
+
+    TI_STATUS status = TWD_writeMem (iTwdCtrl.hTWD, 
+        (TFwDebugParams*) pMemoryAccess, (void*)TIWhaAdaptCB::WriteMemResponse, this);
+
+    /* convert status to WHA::TStatus */
+    return (status == TI_OK) ? WHA::KPending : WHA::KFailed;
+}
+
+
+/** 
+ * \fn     ReadMem
+ * \brief  read buffer from HW address
+ * 
+ * \note    
+ * \param  pMemoryAccess - address, length, buffer
+ * \return  TStatus 
+ */ 
+WHA::TStatus TIWha::ReadMem (TMemoryAccess  *pMemoryAccess)
+{
+TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " addr = 0x%x length = %d p = %p\n", pMemoryAccess->addr, pMemoryAccess->length, pMemoryAccess);
+
+    TI_STATUS status = TWD_readMem (iTwdCtrl.hTWD, 
+        (TFwDebugParams*) pMemoryAccess, (void*)TIWhaAdaptCB::ReadMemResponse, this);
+
+    /* convert status to WHA::TStatus */
+    return (status == TI_OK) ? WHA::KPending : WHA::KFailed;
+}
+
+
+/**********************************************************
+TIWha Service functions
+**********************************************************/
+
+/**
+* \fn     getMacAddress
+* \brief  return the Mac address from the TWDCtrl
+*
+* 
+* /note
+* 
+* /return 
+*/
+void * TIWha::getMacAddress()
+{
+	return (void *)iTwdCtrl.pMacAddr;
+
+}
+
+/**
+* \fn     InitTwdParamTable
+* \brief  initialization of TWD parameters
+*
+* since we have no ini file, we are initializing the 
+* Modules wit hard coded values
+* /note
+* 
+* /return 
+*/
+void TIWha::InitTwdParamTable()
+{
+    os_memoryZero (&iTwdCtrl.tOsContext, (TI_UINT8*)&iTwdCtrl.twdInitParams, sizeof(TTwdInitParams));
+
+    iTwdCtrl.twdInitParams.tGeneral.packetDetectionThreshold = 0;
+    iTwdCtrl.twdInitParams.tGeneral.qosNullDataTemplateSize = sizeof(QosNullDataTemplate_t);
+    iTwdCtrl.twdInitParams.tGeneral.PsPollTemplateSize = sizeof(psPollTemplate_t);
+    iTwdCtrl.twdInitParams.tGeneral.probeResponseTemplateSize = sizeof(probeRspTemplate_t);
+    iTwdCtrl.twdInitParams.tGeneral.probeRequestTemplateSize = sizeof(probeReqTemplate_t);
+    iTwdCtrl.twdInitParams.tGeneral.beaconTemplateSize = sizeof(probeRspTemplate_t);
+    iTwdCtrl.twdInitParams.tGeneral.nullTemplateSize = sizeof(nullDataTemplate_t);
+    iTwdCtrl.twdInitParams.tGeneral.disconnTemplateSize = sizeof(disconnTemplate_t);
+    /* Beacon broadcast options */
+    iTwdCtrl.twdInitParams.tGeneral.BeaconRxTimeout           = BCN_RX_TIMEOUT_DEF_VALUE;
+    iTwdCtrl.twdInitParams.tGeneral.BroadcastRxTimeout        = BROADCAST_RX_TIMEOUT_DEF_VALUE;
+    iTwdCtrl.twdInitParams.tGeneral.RxBroadcastInPs           = RX_BROADCAST_IN_PS_DEF_VALUE;
+    iTwdCtrl.twdInitParams.tGeneral.ConsecutivePsPollDeliveryFailureThreshold = CONSECUTIVE_PS_POLL_FAILURE_DEF;
+
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlRxDisableBroadcast = TWD_RX_DISABLE_BROADCAST_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlCalibrationChannel2_4 = TWD_CALIBRATION_CHANNEL_2_4_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlCalibrationChannel5_0 = TWD_CALIBRATION_CHANNEL_5_0_DEF;
+
+
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlRtsThreshold       = TWD_RTS_THRESHOLD_DEF;
+
+
+    iTwdCtrl.twdInitParams.tGeneral.WiFiWmmPS                 = WIFI_WMM_PS_DEF;
+
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlMaxTxMsduLifetime  = TWD_MAX_TX_MSDU_LIFETIME_DEF;  
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlMaxRxMsduLifetime  = TWD_MAX_RX_MSDU_LIFETIME_DEF;  
+
+    iTwdCtrl.twdInitParams.tGeneral.rxTimeOut.psPoll          = QOS_RX_TIMEOUT_PS_POLL_DEF;  
+    iTwdCtrl.twdInitParams.tGeneral.rxTimeOut.UPSD            =  QOS_RX_TIMEOUT_UPSD_DEF; 
+
+    /* RSSI/SNR Weights for Average calculations */
+    iTwdCtrl.twdInitParams.tGeneral.uRssiBeaconAverageWeight  = TWD_RSSI_WEIGHT_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.uRssiPacketAverageWeight  = TWD_RSSI_WEIGHT_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.uSnrBeaconAverageWeight   = TWD_RSSI_WEIGHT_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.uSnrPacketAverageWeight   = TWD_RSSI_WEIGHT_DEF;
+
+    /* No used */
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlFragThreshold      = TWD_FRAG_THRESHOLD_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlListenInterval = TWD_LISTEN_INTERVAL_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlRateFallbackRetry  =  TWD_RATE_FB_RETRY_LIMIT_DEF;       
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlMacClock           = 80;     
+    iTwdCtrl.twdInitParams.tGeneral.halCtrlArmClock           = 80;     
+
+    iTwdCtrl.twdInitParams.tGeneral.TxCompletePacingThreshold = TWD_TX_CMPLT_THRESHOLD_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.TxCompletePacingTimeout   = TWD_TX_CMPLT_TIMEOUT_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.RxIntrPacingThreshold     = TWD_RX_INTR_THRESHOLD_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.RxIntrPacingTimeout       = TWD_RX_INTR_TIMEOUT_DEF;
+
+	/* FM Coexistence params */
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uEnable	  		= FM_COEX_ENABLE_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uSwallowPeriod 	= FM_COEX_SWALLOW_PERIOD_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uNDividerFrefSet1	= FM_COEX_N_DIVIDER_FREF_SET1_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uNDividerFrefSet2 = FM_COEX_N_DIVIDER_FREF_SET2_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uMDividerFrefSet1 = FM_COEX_M_DIVIDER_FREF_SET1_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uMDividerFrefSet2 = FM_COEX_M_DIVIDER_FREF_SET2_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uCoexPllStabilizationTime = FM_COEX_PLL_STABILIZATION_TIME_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uLdoStabilizationTime	  	= FM_COEX_LDO_STABILIZATION_TIME_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uFmDisturbedBandMargin	= FM_COEX_DISTURBED_BAND_MARGIN_DEF;
+	iTwdCtrl.twdInitParams.tGeneral.tFmCoexParams.uSwallowClkDif	  		= FM_COEX_SWALLOW_CLK_DIF_DEF;
+
+
+	/* Configure ARP IP */
+
+    iTwdCtrl.twdInitParams.tArpIpFilter.isFilterEnabled       = DEF_FILTER_ENABLE_VALUE;
+    // Compialtion problem     IP_COPY(iTwdCtrl.twdInitParams.tArpIpFilter.addr = "00 22 11 33 44 55");
+
+
+    /* Configure address group */
+    iTwdCtrl.twdInitParams.tMacAddrFilter.numOfMacAddresses   = NUM_GROUP_ADDRESS_VALUE_DEF; 
+    iTwdCtrl.twdInitParams.tMacAddrFilter.isFilterEnabled     = DEF_FILTER_ENABLE_VALUE;
+#if 0
+    for (k = 0; k < pWlanParams->numGroupAddrs; k++)
+    {
+    	MAC_COPY (iTwdCtrl.twdInitParams.tMacAddrFilter.macAddrTable[k]); 
+    }
+#endif
+
+    /* QoS configure queue */
+    iTwdCtrl.twdInitParams.tGeneral.TxBlocksThresholdPerAc[0] = QOS_TX_BLKS_THRESHOLD_BE_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.TxBlocksThresholdPerAc[1] = QOS_TX_BLKS_THRESHOLD_BK_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.TxBlocksThresholdPerAc[2] = QOS_TX_BLKS_THRESHOLD_VI_DEF;
+    iTwdCtrl.twdInitParams.tGeneral.TxBlocksThresholdPerAc[3] = QOS_TX_BLKS_THRESHOLD_VO_DEF;
+
+
+
+    /* Configure the MAC services */ 
+
+    /* Power server */
+    iTwdCtrl.twdInitParams.tPowerSrv.hangOverPeriod           = HANGOVER_PERIOD_DEF_VALUE + 5; /* Increase the hang over time to 10ms */
+    iTwdCtrl.twdInitParams.tPowerSrv.numNullPktRetries        = POWER_MGMNT_NUM_NULL_PACKET_RETRY_DEF_VALUE;
+    /* Scan Server */
+    iTwdCtrl.twdInitParams.tScanSrv.numberOfNoScanCompleteToRecovery = SCAN_SRV_NUMBER_OF_NO_SCAN_COMPLETE_TO_RECOVERY_DEF;
+    iTwdCtrl.twdInitParams.tScanSrv.uTriggeredScanTimeOut     = SCAN_SRV_TRIGGERED_SCAN_TIME_OUT_DEF;
+    iTwdCtrl.TxAlign.uCurrSend = 0;
+    iTwdCtrl.TxAlign.uCurrHandle = 0;
+
+    /* Configure the rate adaptaion */
+    iTwdCtrl.twdInitParams.tRateMngParams.InverseCuriosityFactor[0] = RATE_MGMT_INVERSE_CURIOSITY_FACTOR_OTHER;
+    iTwdCtrl.twdInitParams.tRateMngParams.InverseCuriosityFactor[1] = RATE_MGMT_INVERSE_CURIOSITY_FACTOR_VOICE;
+    iTwdCtrl.twdInitParams.tRateMngParams.MaxPer = RATE_MGMT_MAX_PER;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerAdd = RATE_MGMT_PER_ADD;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerAddShift = RATE_MGMT_PER_ADD_SHIFT;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerAlphaShift = RATE_MGMT_PER_ALPHA_SHIFT;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerBeta1Shift = RATE_MGMT_PER_BETA1_SHIFT;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerBeta2Shift = RATE_MGMT_PER_BETA2_SHIFT;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerTh1 = RATE_MGMT_PER_TH1;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerTh2 = RATE_MGMT_PER_TH2;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateCheckDown = RATE_MGMT_RATE_CHECK_DOWN;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateCheckUp = RATE_MGMT_RATE_CHECK_UP;
+    
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[0] = 1;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[1] = 1;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[2] = 1;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[3] = 3;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[4] = 3;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[5] = 3;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[6] = 6;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[7] = 6;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[8] = 6;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[9] = 6;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[10] = 9;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[11] = 9;
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryPolicy[12] = 9;
+
+    iTwdCtrl.twdInitParams.tRateMngParams.RateRetryScore = RATE_MGMT_RATE_RETRY_SCORE;
+    iTwdCtrl.twdInitParams.tRateMngParams.TxFailLowTh = RATE_MGMT_TX_FAIL_LOW_TH;
+    iTwdCtrl.twdInitParams.tRateMngParams.TxFailHighTh = RATE_MGMT_TX_FAIL_HIGH_TH;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerWeightShift[0] = RATE_MGMT_PER_WEIGHT_SHIFT_OTHER;
+    iTwdCtrl.twdInitParams.tRateMngParams.PerWeightShift[1] = RATE_MGMT_PER_WEIGHT_SHIFT_VOICE;
+    iTwdCtrl.twdInitParams.tRateMngParams.TpWeightShift[0] = RATE_MGMT_TP_WEIGHT_SHIFT_OTHER;
+    iTwdCtrl.twdInitParams.tRateMngParams.TpWeightShift[1] = RATE_MGMT_TP_WEIGHT_SHIFT_VOICE;
+    iTwdCtrl.twdInitParams.tRateMngParams.paramIndex = RATE_MGMT_ALL_PARAMS;
+
+    iTwdCtrl.twdInitParams.tDcoItrimParams.enable = TWD_DCO_ITRIM_ENABLE_DEF;
+    iTwdCtrl.twdInitParams.tDcoItrimParams.moderationTimeoutUsec = TWD_DCO_ITRIM_MODERATION_TIMEOUT_DEF;
+}
+/**
+* \fn     InitTwdPlatformGenParam
+* \brief  initialization Platform General parameters
+*
+* 
+* /return 
+*/
+
+void  TIWha::InitTwdPlatformGenParam()
+{
+  os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iTwdCtrl.twdInitParams.tPlatformGenParams,&iAutoRadioParams.tGeneralParams,sizeof(IniFileGeneralParam));
+}
+
+
+/**
+* \fn     InitTwdRadioParam
+* \brief  initialization of Radio params
+* * /return 
+*/
+
+void TIWha::InitTwdRadioParam()
+{
+  uint8 FemType;
+
+  if (iAutoRadioParams.tGeneralParams.TXBiPFEMAutoDetect == FEM_MANUAL_DETECT_MODE_E)
+      FemType = iAutoRadioParams.tGeneralParams.TXBiPFEMManufacturer;
+  else
+      FemType = TWD_GetFEMType(iTwdCtrl.hTWD);
+  /* fill TWD init parms with relevant (RFMD or TriQuint) Radio parms before calling TWD_SetDefault*/
+   os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iTwdCtrl.twdInitParams.tIniFileRadioParams.tDynRadioParams,&iAutoRadioParams.tDynRadioParams[FemType],sizeof(TDynRadioParams));
+   os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iTwdCtrl.twdInitParams.tIniFileRadioParams.tStatRadioParams,&iAutoRadioParams.tStatRadioParams,sizeof(TStatRadioParams));
+}
+
+
+/**
+* \fn     InitTwdRadioParam
+* \brief  initialization of Radio params
+* * /return 
+*/
+
+void TIWha::InitTwdRadioSmartReflexParam()
+{
+    /* fill TWD init parms with relevant (RFMD or TriQuint) Radio parms before calling TWD_SetDefault*/
+   os_memoryCopy(iTwdCtrl.tOsContext.hOsa,&iTwdCtrl.twdInitParams.tSmartReflexParams.errorTable, &iSmartReflexParams.tErrorTable,sizeof(TSmartReflexErrTable));
+   os_memoryZero(iTwdCtrl.tOsContext.hOsa, &iSmartReflexDebugParams, sizeof(TSmartReflexDebugParams));
+   iTwdCtrl.twdInitParams.tSmartReflexState.enable = iSmartReflexParams.SmartReflexState;
+}        
+
+
+/**
+* \fn     InitReportParamTable
+* \brief  initialization of Report parameters
+*
+* since we ave no ini file, we are initializing the 
+* Modules with hard coded values
+* /note
+* 
+* /return 
+*/
+void TIWha::InitReportParamTable()
+{
+    /* Open All Modules and some severity */
+    iTwdCtrl.report_init.aSeverityTable [REPORT_SEVERITY_INIT]           = '0';
+    iTwdCtrl.report_init.aSeverityTable [REPORT_SEVERITY_INFORMATION]    = '0';	
+    iTwdCtrl.report_init.aSeverityTable [REPORT_SEVERITY_WARNING]        = '0';
+    iTwdCtrl.report_init.aSeverityTable [REPORT_SEVERITY_ERROR]          = '1';
+    iTwdCtrl.report_init.aSeverityTable [REPORT_SEVERITY_FATAL_ERROR]    = '1';
+    iTwdCtrl.report_init.aSeverityTable [REPORT_SEVERITY_SM]             = '0';
+    iTwdCtrl.report_init.aSeverityTable [REPORT_SEVERITY_CONSOLE]        = '0';
+    
+    for (TUint8 index = 0; index < REPORT_FILES_NUM; index++)
+    {
+    	iTwdCtrl.report_init.aFileEnable [index] = '1';
+    }
+}
+
+/**
+* \fn     OpenAllReports
+* \brief  open all reports in report module. 
+*
+* Use this function if you encounter some problem in a specific area.
+*
+* /note Used for debug only.
+* 
+* /return 
+*/
+void TIWha::OpenAllReports()
+{
+    for (TUint8 index = 0; index < SIZE_ARR(iTwdCtrl.report_init.aSeverityTable); index++)
+    {
+        iTwdCtrl.report_init.aSeverityTable [index] = '1';    
+    }
+
+    for (TUint8 index = 0; index < REPORT_FILES_NUM; index++)
+    {
+    	iTwdCtrl.report_init.aFileEnable [index] = '1';
+    }
+
+    report_SetDefaults (iTwdCtrl.hReport, &(iTwdCtrl.report_init));
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+}
+
+
+/** 
+ * \fn     RegisterCb
+ * \brief  registers the TIWha callbacks
+ * 
+ * Register callbacks To Twd level according to the action
+ * that we would like to be triggered on 
+ * 
+ * \note    
+ * \return  status whther the registration succeed or not.
+ * \sa      
+ */
+WHA::TStatus TIWha::RegisterCb ()
+{   
+    /* Register the failure event callback */
+    TWD_RegisterCb (iTwdCtrl.hTWD, 
+                    TWD_EVENT_FAILURE, 
+                (TTwdCB *)TIWhaAdaptCB::FailureIndication, 
+                 this);
+
+	/* Register the send packet callback */
+	TWD_RegisterCb (iTwdCtrl.hTWD,
+					TWD_EVENT_TX_XFER_SEND_PKT_TRANSFER, 
+					(TTwdCB *)TIWhaAdaptCB::TxXfer, 
+					this);
+
+	/* Register the send complete packet callback */
+	TWD_RegisterCb (iTwdCtrl.hTWD,
+					TWD_EVENT_TX_RESULT_SEND_PKT_COMPLETE, 
+					(TTwdCB *)TIWhaAdaptCB::TxComplete, 
+					this);
+
+	/* Register the receive packet callback */
+	TWD_RegisterCb (iTwdCtrl.hTWD,
+					TWD_EVENT_RX_RECEIVE_PACKET, 
+					(TTwdCB *)TIWhaAdaptCB::ReceivePacket, 
+					this);
+
+	/* Register the request for buffer callback */
+	TWD_RegisterCb (iTwdCtrl.hTWD,
+					TWD_EVENT_RX_REQUEST_FOR_BUFFER, 
+					(TTwdCB *)TIWhaAdaptCB::RequestForBuffer, 
+					this);
+
+    /* register scan SRV scan complete CB */
+    TWD_RegisterScanCompleteCb (iTwdCtrl.hTWD, 
+                                                (TScanSrvCompleteCb)TIWhaAdaptCB::ScanComplete, this);
+
+    return WHA::KSuccess;
+}
+
+/** 
+ * \fn     RegisterEvents
+ * \brief  register the TIWha Events
+ * 
+ * Register callbacks To Twd level according to the event 
+ * that we would like to be triggered on 
+ * 
+ * \note    
+ * \return  status whther the registration succeed or not.
+ * \sa      
+ */
+WHA::TStatus TIWha::RegisterEvents ()
+{   
+	/* Register the Regain BSS callback */
+	TWD_RegisterEvent (iTwdCtrl.hTWD, 
+					   TWD_OWN_EVENT_BSS_REGAIN, 
+					   (void *)TIWhaAdaptCB::RegainBssIndication, 
+					   this);
+
+	/* Register the RSSI callback */
+	TWD_RegisterEvent (iTwdCtrl.hTWD, 
+					   TWD_OWN_EVENT_RSSI_SNR_TRIGGER_0, //adi - rssi - use TWD_EVENT_RSSI_SNR_TRIGGER_0
+					   (void *)TIWhaAdaptCB::RcpiIndication, 
+					   this);  
+	TWD_EnableEvent (iTwdCtrl.hTWD, TWD_OWN_EVENT_RSSI_SNR_TRIGGER_0);
+#if 0
+	assaf: no support
+	TWD_RegisterEvent (iTwdCtrl.hTWD, 
+					   TWD_EVENT_RSSI_LEVEL_REGAIN,	//adi - rssi - use TWD_EVENT_RSSI_SNR_TRIGGER_0 
+					   (void *)TIWhaAdaptCB::RcpiIndication, 
+					   this);
+#endif
+	/* Register & enable the Join callback */
+        TWD_RegisterEvent (iTwdCtrl.hTWD,  
+                                        TWD_OWN_EVENT_JOIN_CMPLT, 
+                                        (void *)TIWhaAdaptCB::JoinComplete, 
+                                        this);
+
+	TWD_EnableEvent (iTwdCtrl.hTWD, TWD_OWN_EVENT_JOIN_CMPLT);
+
+#if 0    
+	assaf: no BT support
+	/* Register the BtCoexsitence indications */
+	TWD_RegisterEvent (iTwdCtrl.hTWD, 
+					   TWD_EVENT_BT_COEX_SENSE, 
+					   (void *)TIWhaAdaptCB::btCoexSenseIndication, 
+					   this);       
+
+	TWD_RegisterEvent (iTwdCtrl.hTWD, 
+					   TWD_EVENT_BT_COEX_PROTECTIVE_MODE, 
+					   (void *)TIWhaAdaptCB::btCoexProtectiveIndication, 
+					   this);        
+
+	TWD_RegisterEvent (iTwdCtrl.hTWD, 
+					   TWD_EVENT_BT_COEX_AVALANCHE, 
+					   (void *)TIWhaAdaptCB::btCoexAvalancheIndication, 
+					   this);       
+#endif
+	/* Roaming Triggers */
+	TWD_RegisterEvent (iTwdCtrl.hTWD,
+					   TWD_OWN_EVENT_BSS_LOSE,
+					   (void *)TIWhaAdaptCB::LostBssIndication,
+					   this);
+
+	TWD_EnableEvent (iTwdCtrl.hTWD, TWD_OWN_EVENT_BSS_LOSE);
+
+
+
+	return WHA::KSuccess;
+}
+
+ 
+
+ 
+/**
+* \fn     FillNWSASettings
+* \brief  Fill UMAC structure with correct settings
+*
+* since we ave no ini file, we are initializing the 
+* Modules wit hard coded values
+* \note
+* 
+* \param SNWSASettings - pointer pointer to the UMAC settings struct
+* \return status
+*/
+WHA::TStatus TIWha::FillNWSASettings (WHA::SSettings *SNWSASettings)
+{
+#ifdef HT_SUPPORT
+	TTwdHtCapabilities* pTwdHtCapabilities;
+#endif /* HT_SUPPORT */
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, "FillNWSASettings +");
+    
+    /* Fill all the parameters in the NWSA Settings */
+    SNWSASettings->iNumOfSSIDs              = TIWha_SCAN_MAX_SSID_NUM;        
+    SNWSASettings->iRxBufAlignment          = TIWha_NO_BUFFER_ALIGNMENT_SETTING; /* no alignment is needed */
+    SNWSASettings->iNumOfBytesForSsid       = TIWha_MAX_SSID_LEN;            
+    SNWSASettings->iRates                   = TIWha_RATE_BIT_MASK_SUPPORT;               
+    SNWSASettings->iBand                    = TIWha_BAND_BIT_MASK_SUPPORT;                                           
+    SNWSASettings->iRxoffset                = WSPI_PAD_LEN_READ + sizeof(RxIfDescriptor_t);
+    SNWSASettings->iNumOfGroupTableEntrys   = ADDRESS_GROUP_MAX;        
+    SNWSASettings->iNumOfTxRateClasses      = MAX_NUM_OF_TX_RATE_CLASS_POLICIES;    
+    SNWSASettings->iTxFrameTrailerSpace     = 0;   
+    SNWSASettings->iTxFrameHeaderSpace      = TX_TOTAL_OFFSET_BEFORE_DATA;  
+    SNWSASettings->iFlagsMask               = TIWha_RECEIVE_PACKET_BIT_MASK_SUPPORT; 
+    SNWSASettings->iCapability              = TIWha_CAPABILITY_BIT_MASK_SUPPORT; 
+
+#ifdef GEM_SUPPORT
+	SNWSASettings->iCapability				|= TIWha_CAPABILITY_GEM_SUPPORT;
+#endif /* GEM_SUPPORT */
+
+#ifdef MB_ENABLE
+	SNWSASettings->iCapability				|= TIWha_CAPABILITY_MB_SUPPORT;
+#endif
+
+#ifdef HT_SUPPORT
+	SNWSASettings->iCapability |= TIWha_CAPABILITY_HT_OPERATION;	
+#endif /* HT_SUPPORT */
+
+    SNWSASettings->iCapability |= TIWha_CAPABILITY_AUTO_RATE;
+
+    /* Add DS Parameters -- Allow only APs from the requested channel 
+    to answer the probe increase scan result in crowded environment */
+    
+    //SNWSASettings->iCapability |= WHA::SSettings::KDsParamSetIeInProbe;
+
+    /* Tx power level for each radio band  */
+    TFwInfo *pFwInfo = TWD_GetFWInfo (iTwdCtrl.hTWD);
+
+    /* 
+     * 2.4 GHz
+     * in txPowerTable[x][y]: x - 0 for 2.4GHz, y - power level starting from 0 to NUM_POWER_LEVELS - 1 
+     */ 
+    SNWSASettings->iTxPowerRange[0].iMaxPowerLevel = 
+        pFwInfo->txPowerTable[RADIO_BAND_2_4_GHZ][0] / DBM_TO_TX_POWER_FACTOR;
+    SNWSASettings->iTxPowerRange[0].iMinPowerLevel = 
+        pFwInfo->txPowerTable[RADIO_BAND_2_4_GHZ][NUM_POWER_LEVELS - 1] / DBM_TO_TX_POWER_FACTOR;
+    SNWSASettings->iTxPowerRange[0].iStepping = 0;           
+
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, ": 2.4 iMaxPowerLevel = %d iMinPowerLevel = %d stepping = %d\n",    						    SNWSASettings->iTxPowerRange[0].iMaxPowerLevel,                                          SNWSASettings->iTxPowerRange[0].iMinPowerLevel,                                          SNWSASettings->iTxPowerRange[0].iStepping);
+
+    /* 4.9 GHZ temporary not supported for the power level */
+    SNWSASettings->iTxPowerRange[1].iMaxPowerLevel = 0;
+    SNWSASettings->iTxPowerRange[1].iMinPowerLevel = 0;
+    SNWSASettings->iTxPowerRange[1].iStepping = 0;          
+
+    /* 5.0 GHZ temporary not supported for the power level since there are 4 sub-bands */
+    SNWSASettings->iTxPowerRange[2].iMaxPowerLevel  = 0;
+    SNWSASettings->iTxPowerRange[2].iMinPowerLevel = 0;
+    SNWSASettings->iTxPowerRange[2].iStepping = 0; 
+
+#ifdef HT_SUPPORT
+	TWD_GetTwdHtCapabilities (iTwdCtrl.hTWD,&pTwdHtCapabilities);
+	TConvertTwdHtCapa2SHtCapa (pTwdHtCapabilities,&SNWSASettings->iHtCapabilities);
+#endif /* HT_SUPPORT */
+
+    return WHA::KSuccess;
+}
+
+
+/****************************************************************************
+ *                     FillRadioData
+ ****************************************************************************
+ * DESCRIPTION: fill Radio params , in future will be done by Radio scope
+ * 
+ * INPUTS:   
+ * 
+ * OUTPUT:  radio params
+ * 
+ * RETURNS: OK
+ ****************************************************************************/
+void TIWha::FillRadioData()
+{
+   
+   iAutoRadioParams.tGeneralParams.TXBiPFEMAutoDetect = FEM_AUTO_DETECT_MODE_E;
+   iAutoRadioParams.tGeneralParams.TXBiPFEMManufacturer = FEM_TRIQUINT_TYPE_E;   
+
+   iAutoRadioParams.tGeneralParams.RefClk = eREF_CLK_38_4_E;                                 
+   iAutoRadioParams.tGeneralParams.SettlingTime = 5;                                                                 
+   iAutoRadioParams.tGeneralParams.ClockValidOnWakeup = REF_CLK_NOT_VALID_E;                      
+   iAutoRadioParams.tGeneralParams.DC2DCMode = BT_SPI_IS_NOT_USED_E;                               
+   iAutoRadioParams.tGeneralParams.Single_Dual_Band_Solution = SINGLE_BAND_SOLUTION_E;  
+      
+   iAutoRadioParams.tStatRadioParams.RxTraceInsertionLoss_2_4G = 0;
+   iAutoRadioParams.tStatRadioParams.TXTraceLoss_2_4G  = 0;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[0] = 0xEC;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[1] = 0xF6;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[2] = 0x00;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[3] = 0x0C;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[4] = 0x18;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[5] = 0xF8;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[6] = 0xFC;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[7] = 0x00;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[8] = 0x08;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[9] = 0x10;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[10] = 0xF0;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[11] = 0xF8;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[12] = 0x00;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[13] = 0x0A;
+   iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_2_4G[14] = 0x14;
+   memset(&iAutoRadioParams.tStatRadioParams.RxTraceInsertionLoss_5G[0],0,NUMBER_OF_SUB_BANDS_IN_5G_BAND_E);
+   memset(&iAutoRadioParams.tStatRadioParams.TXTraceLoss_5G[0],0,NUMBER_OF_SUB_BANDS_IN_5G_BAND_E);
+   memset(&iAutoRadioParams.tStatRadioParams.RxRssiAndProcessCompensation_5G[0],0,RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE); 
+
+/* RMFD deafult value */
+   if (iAutoRadioParams.tGeneralParams.Single_Dual_Band_Solution == DUAL_BAND_SOLUTION_E)
+   {
+   
+    iAutoRadioParams.tDynRadioParams[0].TXBiPReferencePDvoltage_2_4G = 0 ;									
+    iAutoRadioParams.tDynRadioParams[0].TxBiPReferencePower_2_4G = 0;																				
+    iAutoRadioParams.tDynRadioParams[0].TxBiPOffsetdB_2_4G = 0;																							
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29;							
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25;							
+    for (int i=0; i<NUMBER_OF_2_4_G_CHANNELS;i++)
+    {
+        iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50;
+        iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50;
+    }
+       
+    iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20;
+    iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20;
+    memset(&iAutoRadioParams.tDynRadioParams[0].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E);												
+     for (int i=0; i<NUMBER_OF_RATE_GROUPS_E;i++)
+    {
+        iAutoRadioParams.tDynRadioParams[0].TxIbiasTable_2_4G[i] = 0x0E;
+    }
+       iAutoRadioParams.tDynRadioParams[0].TxIbiasTable_2_4G[5] = 0x17;
+    iAutoRadioParams.tDynRadioParams[0].RxFemInsertionLoss_2_4G = 0x0D;																			
+
+       // SECTION 2: 5G parameters
+    memset(&iAutoRadioParams.tDynRadioParams[0].TXBiPReferencePDvoltage_5G[0],0,NUMBER_OF_RATE_GROUPS_E);
+    memset(&iAutoRadioParams.tDynRadioParams[0].TxBiPReferencePower_5G[0],0,NUMBER_OF_RATE_GROUPS_E);				
+    memset(&iAutoRadioParams.tDynRadioParams[0].TxBiPOffsetdB_5G[0],0,NUMBER_OF_RATE_GROUPS_E);								
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Normal[0] = 0x1D;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Normal[1] = 0x1E;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Normal[2] = 0x21;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Normal[3] = 0x23;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Normal[4] = 0x27;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Normal[5] = 0;							
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Degraded[0]= 0x1A;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Degraded[1] = 0x1B;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Degraded[2] = 0x1D;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Degraded[3] = 0x1F;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Degraded[4] = 0x23;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_5G_Degraded[5] = 0x00;						
+    memset(&iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_5G_OFDM[0],0,NUMBER_OF_5G_CHANNELS);                         
+    memset(&iAutoRadioParams.tDynRadioParams[0].TxPDVsRateOffsets_5G[0],0,NUMBER_OF_RATE_GROUPS_E);										
+    for (int i=0;i<NUMBER_OF_RATE_GROUPS_E;i++)
+    {
+        iAutoRadioParams.tDynRadioParams[0].TxIbiasTable_5G[i] = 0x27;
+        iAutoRadioParams.tDynRadioParams[0].RxFemInsertionLoss_5G[i] = 0x12;
+    }
+    
+    iAutoRadioParams.tDynRadioParams[0].TxIbiasTable_5G[5] = 0;
+    								
+   }
+   else
+   {
+    iAutoRadioParams.tDynRadioParams[0].TXBiPReferencePDvoltage_2_4G =0x24E ;									
+    iAutoRadioParams.tDynRadioParams[0].TxBiPReferencePower_2_4G = 0x78;																				
+    iAutoRadioParams.tDynRadioParams[0].TxBiPOffsetdB_2_4G = 0;																							
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29;							
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24;
+    iAutoRadioParams.tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25;							
+    for (int i =0;i<NUMBER_OF_2_4_G_CHANNELS;i++)
+    {
+        iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50;
+        iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50;
+    }
+    iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20;
+    iAutoRadioParams.tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20;   
+    memset(&iAutoRadioParams.tDynRadioParams[0].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E);	
+    for (int i = 0 ;i <NUMBER_OF_RATE_GROUPS_E;i++) 
+    {
+        iAutoRadioParams.tDynRadioParams[0].TxIbiasTable_2_4G[i] = 0x1A;
+    }
+   
+    iAutoRadioParams.tDynRadioParams[0].TxIbiasTable_2_4G[5] = 0x2F;
+    iAutoRadioParams.tDynRadioParams[0].RxFemInsertionLoss_2_4G = 0;	
+
+/* TriQuint default value */
+    iAutoRadioParams.tDynRadioParams[1].TXBiPReferencePDvoltage_2_4G= 0x168;									
+    iAutoRadioParams.tDynRadioParams[1].TxBiPReferencePower_2_4G= 0x83;																				
+    iAutoRadioParams.tDynRadioParams[1].TxBiPOffsetdB_2_4G=0;																							
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29;							
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24;
+    iAutoRadioParams.tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25;	
+    for (int i =0;i<NUMBER_OF_2_4_G_CHANNELS;i++)
+    {
+        iAutoRadioParams.tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50;
+        iAutoRadioParams.tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50;
+    }
+    iAutoRadioParams.tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20;
+    iAutoRadioParams.tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20;  
+    memset(&iAutoRadioParams.tDynRadioParams[1].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E); 
+     for (int i = 0 ;i <NUMBER_OF_RATE_GROUPS_E;i++) 
+    {
+        iAutoRadioParams.tDynRadioParams[1].TxIbiasTable_2_4G[i] = 0x11;
+    }
+  
+    iAutoRadioParams.tDynRadioParams[1].TxIbiasTable_2_4G[5] = 0x12; 													
+    iAutoRadioParams.tDynRadioParams[1].RxFemInsertionLoss_2_4G = 0x12;  
+   }
+}
+
+void TIWha::FillSmartReflexData()
+{
+    iSmartReflexParams.SmartReflexState = 0;
+
+    iSmartReflexParams.tErrorTable[0].len = 7;
+    iSmartReflexParams.tErrorTable[0].upperLimit = 3;
+    iSmartReflexParams.tErrorTable[0].values[0] = 24;
+    iSmartReflexParams.tErrorTable[0].values[1] = 16;
+    iSmartReflexParams.tErrorTable[0].values[2] = 5;
+    iSmartReflexParams.tErrorTable[0].values[3] = -5;
+    iSmartReflexParams.tErrorTable[0].values[4] = -16;
+    iSmartReflexParams.tErrorTable[0].values[5] = -24;
+    iSmartReflexParams.tErrorTable[1].len = 7;
+    iSmartReflexParams.tErrorTable[1].upperLimit = 3;
+    iSmartReflexParams.tErrorTable[1].values[0] = 24;
+    iSmartReflexParams.tErrorTable[1].values[1] = 16;
+    iSmartReflexParams.tErrorTable[1].values[2] = 5;
+    iSmartReflexParams.tErrorTable[1].values[3] = -5;
+    iSmartReflexParams.tErrorTable[1].values[4] = -16;
+    iSmartReflexParams.tErrorTable[1].values[5] = -24;
+    iSmartReflexParams.tErrorTable[2].len = 7;
+    iSmartReflexParams.tErrorTable[2].upperLimit = 3;   
+    iSmartReflexParams.tErrorTable[2].values[0] = 24;
+    iSmartReflexParams.tErrorTable[2].values[1] = 16;
+    iSmartReflexParams.tErrorTable[2].values[2] = 5;
+    iSmartReflexParams.tErrorTable[2].values[3] = -5;
+    iSmartReflexParams.tErrorTable[2].values[4] = -16;
+    iSmartReflexParams.tErrorTable[2].values[5] = -24;
+}
+
+#if TI_DBG
+/****************************************************************************
+ *                     PrintRadioData
+ ****************************************************************************
+ * DESCRIPTION: print Radio params , used for debug
+ * 
+ * INPUTS:   
+ * 
+ * OUTPUT:  radio params
+ * 
+ * RETURNS: OK
+ ****************************************************************************/
+void TIWha::PrintRadioData()
+{
+    TI_UINT32 i,j;
+    TI_UINT8* pRadio;
+
+    pRadio = reinterpret_cast<TI_UINT8*>(&iAutoRadioParams); 
+
+    i=0;
+	os_printf("/**********************/ \n");
+	os_printf("/* INI General params */ \n");
+	os_printf("/**********************/ \n");
+
+	os_printf("0x%x, /* RefClk */ \n",						pRadio[i++]);
+	os_printf("0x%x, /* SettlingTime */ \n",				pRadio[i++]);
+	os_printf("0x%x, /* ClockValidOnWakeup */ \n",			pRadio[i++]);
+	os_printf("0x%x, /* DC2DCMode */ \n",					pRadio[i++]);
+	os_printf("0x%x, /* Single_Dual_Band_Solution */ \n",	pRadio[i++]);
+	os_printf("0x%x, /* TXBiPFEMAutoDetect */ \n",			pRadio[i++]);
+	os_printf("0x%x, /* TXBiPFEMManufacturer */ \n",		pRadio[i++]);
+	os_printf("0x%x, /* Padding */ \n",					pRadio[i++]);
+	
+	os_printf("/*************************/ \n");
+	os_printf("/* INI Stat Radio params */ \n");
+	os_printf("/*************************/ \n");
+	
+	os_printf("0x%x, /* RxTraceInsertionLoss_2_4G */ \n",	pRadio[i++]);
+	os_printf("0x%x, /* TXTraceLoss_2_4G */ \n",			pRadio[i++]);
+	for (j=0;j<15;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* RxRssiAndProcessCompensation_2_4G[15] */ \n");
+	for (j=0;j<7;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* RxTraceInsertionLoss_5G[7] */ \n");
+	for (j=0;j<7;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TXTraceLoss_5G[7] */ \n");
+	for (j=0;j<15;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* RxRssiAndProcessCompensation_5G[15] */ \n");
+
+	os_printf("/*******************************/ \n");
+	os_printf("/* Dyn Radio Params. First FEM */ \n");
+	os_printf("/*******************************/ \n");
+	
+	os_printf("0x%x, ", pRadio[i++]);
+	os_printf("0x%x, /* TXBiPReferencePDvoltage_2_4G */ \n", pRadio[i++]);
+	os_printf("0x%x, /* TxBiPReferencePower_2_4G */ \n",	pRadio[i++]);
+	os_printf("0x%x, /* TxBiPOffsetdB_2_4G */ \n",			pRadio[i++]);
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerRatePowerLimits_2_4G_Normal[6] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerRatePowerLimits_2_4G_Degraded[6] */ \n");
+	for (j=0;j<14;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerChannelPowerLimits_2_4G_11b[14] */ \n");
+	for (j=0;j<14;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerChannelPowerLimits_2_4G_OFDM[14] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPDVsRateOffsets_2_4G[6] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxIbiasTable_2_4G[6] */ \n");
+	os_printf("0x%x, /* RxFemInsertionLoss_2_4G */ \n",			pRadio[i++]);
+	for (j=0;j<35;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerChannelPowerLimits_5G_OFDM[35] */ \n");
+	for (j=0;j<14;j++)
+		os_printf("0x%x, ", pRadio[i++]);		
+	os_printf("/* TXBiPReferencePDvoltage_5G[7*2] */ \n");
+	for (j=0;j<7;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxBiPReferencePower_5G[7] */ \n");
+	for (j=0;j<7;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxBiPOffsetdB_5G[7] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerRatePowerLimits_5G_Normal[6] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerRatePowerLimits_5G_Degraded[6] */ \n");	
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPDVsRateOffsets_5G[6] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxIbiasTable_5G[6] */ \n");
+	for (j=0;j<7;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* RxFemInsertionLoss_5G[7] */ \n");
+	os_printf("0x%x, /* Padding */ \n",					pRadio[i++]);
+
+	os_printf("/************************************/ \n");
+	os_printf("/* INI Dyn Radio Params. Second FEM */ \n");
+	os_printf("/************************************/ \n");
+	
+	os_printf("0x%x, ", pRadio[i++]);	
+	os_printf("0x%x, /* TXBiPReferencePDvoltage_2_4G */ \n", pRadio[i++]);	
+	os_printf("0x%x, /* TxBiPReferencePower_2_4G */ \n",	pRadio[i++]);
+	os_printf("0x%x, /* TxBiPOffsetdB_2_4G */ \n",			pRadio[i++]);
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerRatePowerLimits_2_4G_Normal[6] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerRatePowerLimits_2_4G_Degraded[6] */ \n");
+	for (j=0;j<14;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerChannelPowerLimits_2_4G_11b[14] */ \n");
+	for (j=0;j<14;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerChannelPowerLimits_2_4G_OFDM[14] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPDVsRateOffsets_2_4G[6] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxIbiasTable_2_4G[6] */ \n");
+	os_printf("0x%x, /* RxFemInsertionLoss_2_4G */ \n",			pRadio[i++]);
+	for (j=0;j<14;j++)
+	{
+		os_printf("0x%x, ", pRadio[i++]);		
+	}
+	os_printf("/* TXBiPReferencePDvoltage_5G[7*2] */ \n");
+	for (j=0;j<7;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxBiPReferencePower_5G[7] */ \n");
+	for (j=0;j<7;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxBiPOffsetdB_5G[7] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerRatePowerLimits_5G_Normal[6] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerRatePowerLimits_5G_Degraded[6] */ \n");
+	for (j=0;j<35;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPerChannelPowerLimits_5G_OFDM[35] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxPDVsRateOffsets_5G[6] */ \n");
+	for (j=0;j<6;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* TxIbiasTable_5G[6] */ \n");
+	for (j=0;j<7;j++)
+		os_printf("0x%x, ", pRadio[i++]);
+	os_printf("/* RxFemInsertionLoss_5G[7] */ \n");
+	os_printf("0x%x /* Padding */ \n",					pRadio[i++]);
+}
+#endif
+
+
+/** 
+* \fn     TIFailureDfcClient
+* \brief  Constructor
+* 
+* This method is the default constructor for TIFailureDfcClient. 
+* This class is in charge of creating a new DFC that will handle
+* the failure handling & dispatch to the umac in case of a failure event.
+* 
+* \note   
+* return   handle to TIFailureDfcClient class. 
+* \sa     
+*/ 
+TIFailureDfcClient::TIFailureDfcClient(MWlanOsa& aOsa)
+{
+    pFailureDfc = aOsa.DfcCreate();
+}
+
+
+/**
+* \fn     TIFailureDfcClient::OnDfc
+* \brief  Call TIWhaAdaptCB::FailureIndicationDFC from TIFailureDfcClient context
+* 
+* \param handle to TIWha context
+* 
+* /note
+* 
+* /return void
+*/
+void TIFailureDfcClient::OnDfc(TInt aCtx)
+{
+    TIWhaAdaptCB::FailureIndicationDFC ((TI_HANDLE)aCtx);
+}
+
+
+/** 
+* \fn     TIConnectDfcClient
+* \brief  Constructor
+* 
+* This method is the default constructor for TIConnectDfcClient. 
+* This class is in charge of creating a new DFC that will handle
+* the end of the bus connection phase in case of a sync init bus transaction .
+* 
+* \note   
+* return   handle to TIConnectDfcClient class. 
+* \sa     
+*/ 
+TIConnectDfcClient::TIConnectDfcClient(MWlanOsa& aOsa)
+{
+    pConnectDfc = aOsa.DfcCreate();
+}
+
+
+/**
+* \fn     TIConnectDfcClient::OnDfc
+* \brief  Call TIWhaAdaptCB::ConnectBus from TIConnectDfcClient context
+* 
+* \param handle to TIWha context
+* 
+* /note
+* 
+* /return void
+*/
+void TIConnectDfcClient::OnDfc(TInt aCtx)
+{    
+    TIWhaAdaptCB::ConnectBus ((TI_HANDLE)aCtx);
+}
+
+
+
+/*****************************************************************************************************/
+/************************************** CREATE DRIVER ************************************************/
+
+
+DECLARE_STANDARD_PDD()
+{
+    TIWha* p = new TIWha;
+    return p;
+}
+
+
+ TInt TIWha::Install()
+ {
+    TPtrC mDeviceName= DEVICE_NAME;
+
+	return SetName(&mDeviceName);
+ }
+
+ void TIWha::GetCaps( TDes8& aDes ) const
+ {
+     aDes.FillZ(aDes.MaxLength());
+
+     aDes.Copy( (TUint8*)&iVersion, Min(aDes.MaxLength(), sizeof(TVersion)) );
+ }
+
+
+
+ TInt TIWha::Create( DBase *&aChannel, TInt aUnit, const TDesC* anInfo, const TVersion& aVer)
+ {
+     if ( !Kern::QueryVersionSupported( iVersion, aVer ) ) 
+        {
+         return KErrNotSupported;
+        }
+     if (bDriverCreated) {
+         aChannel = (MWlanPddIface*)this;
+         return KErrNone;
+     }
+     else
+     {
+         return KErrNotReady;
+     }
+ }
+
+
+ TInt TIWha::Validate( TInt aUnit, const TDesC8 *aInfo, const TVersion &aVer )
+ {
+     return KErrNone;
+ }
+
+ TBool TIWha::Attach( MWlanOsa& aWlanOsa, MWlanOsaExt& aWlanOsaExt )
+ {
+     iTwdCtrl.tOsContext.hOsa = &aWlanOsa;
+
+     /* Create HPA */
+     iTwdCtrl.tOsContext.hHpa = WlanHpa::Create( aWlanOsaExt, aWlanOsa);
+
+     /* Create SPIA */
+     iTwdCtrl.tOsContext.hSpia = WlanSpia::Create( aWlanOsaExt );
+
+     if (iTwdCtrl.tOsContext.hHpa == NULL || iTwdCtrl.tOsContext.hSpia == NULL) {
+         WLAN_OS_REPORT (("Failed to create Driver layers -- iHpa = 0x%x, , iSpia = 0x%x",iTwdCtrl.tOsContext.hHpa,iTwdCtrl.tOsContext.hSpia));
+         return EFalse;
+     }
+
+
+     pFailureDfcClient = new TIFailureDfcClient(*iTwdCtrl.tOsContext.hOsa);
+     if (pFailureDfcClient == NULL)
+     {
+         WLAN_OS_REPORT (("ERROR: CreateDriver TIFailureDfcClient failure\n"));        
+     }
+
+     pConnectDfcClient = new TIConnectDfcClient(*iTwdCtrl.tOsContext.hOsa);
+     if (pConnectDfcClient == NULL)
+     {
+         WLAN_OS_REPORT (("ERROR: CreateDriver TIConnectDfcClient failure\n"));        
+     }
+
+     return ETrue;
+ }
+
+
+ WHA::Wha& TIWha::Extract()
+ {
+     return *this;
+ }
+
+
+ void TIWha::GetCapabilities( SCapabilities*& aCapabilities )
+ {
+    aCapability = (SCapabilities*)Kern::Alloc(sizeof(SCapabilities));
+    aCapability->iCapabilities = SCapabilities::KCachedMemory;
+    aCapability->iCacheLineLength = 32;
+
+    aCapabilities = aCapability;
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWha.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1065 @@
+/*
+ * TIWha.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWha.h 
+ *  \brief  Interface between the sandbox to the BSP of Omap2430
+ *
+ *  \see   
+ */
+
+
+#ifndef TIWha_H
+#define TIWha_H
+
+/* Includes that are rquired for using MWlanDfcClient */
+#include <kernel/kernel.h>
+#include <wlandfc.h>
+#include <wlandfcclient.h>
+#include <wlanpddiface.h>
+
+/* Other driver includes*/
+#include "TIWhaDef.h" /*struct and definitions neded for the TI WLAN driver*/
+#include "TWDriver.h" /*interface with the HW abstraction of the WLAN driver*/
+#include "TIWhaUtils.h"
+#include "TIWlanHpaCB.h"
+
+extern void Assert( const TInt8*, TInt, TBool );
+
+
+/*
+ * This is a class for Failure Indication DFC implementation
+ */
+class TIFailureDfcClient : public MWlanDfcClient
+{
+    public:        
+
+        /** 
+    	* \fn     TIFailureDfcClient
+    	* \brief  Constructor
+    	*
+        * Create a MWlanDfc object.
+    	* 
+    	* \note
+    	* \param  	aOsa
+    	* return   handle to TIFailureDfcClient class.
+    	* \sa
+    	*/
+        TIFailureDfcClient(MWlanOsa& aOsa);
+
+        /** 
+    	* \fn     OnDfc
+    	* \brief  Call TIWhaAdaptCB::FailureIndicationDFC in order to handle the failure indication
+        * from a different context
+    	* 
+    	* \note
+    	* \param   aCtx - Relevant Context
+    	* return   void
+    	* \sa
+    	*/
+        virtual void OnDfc( TInt aCtx ); 
+
+        /* A pointer to the relevant wlan DFC object */
+        MWlanDfc* pFailureDfc;
+};
+
+
+
+/*
+ * This is a class for Sync bus connection DFC implementation
+ */
+class TIConnectDfcClient : public MWlanDfcClient
+{
+    public:
+
+        /** 
+    	* \fn     TIConnectDfcClient
+    	* \brief  Constructor
+    	*     	
+        * Create a MWlanDfc object.
+    	* 
+    	* \note
+    	* \param  	aOsa
+    	* return   handle to TIConnectDfcClient class.
+    	* \sa
+    	*/
+        TIConnectDfcClient(MWlanOsa& aOsa);
+
+
+        /** 
+    	* \fn     OnDfc
+    	* \brief  Call TIWhaAdaptCB::ConnectBus() in order to finish the bus connection procees
+    	* 
+    	* \note
+    	* \param  	aCtx - Relevant Context
+    	* return   void
+    	* \sa
+    	*/
+        virtual void OnDfc( TInt aCtx ); 
+
+        /* A pointer to the relevant wlan DFC object */
+        MWlanDfc* pConnectDfc;
+};
+
+
+
+/**
+* This is a class for TI WLAN driver implementation
+*/
+class TIWha :     public WHA::Wha , public DPhysicalDevice , public MWlanPddIface
+{
+public:  
+
+	/** 
+	* \fn     TIWha
+	* \brief  Constructor
+	* 
+	*  TIWha constructor
+	* 
+	* \note   
+	* \param  	aOsa
+	* \param  aHpa
+	* \param  aSpia
+	* return   handle to TIWha class. 
+	* \sa     
+	*/ 
+	TIWha(MWlanOsa& aOsa, WlanHpa& aHpa, WlanSpia& aSpia);
+
+
+			/** 
+	* \fn     TIWha
+	* \brief  Constructor
+	* 
+	*  TIWha constructor
+	* 
+	* \note   
+	* 
+	* return   handle to TIWha class. 
+	* \sa     
+	*/ 
+    TIWha();
+
+	/** 
+	 * \fn     ~TIWha
+	 * \brief  destructor
+	 * 
+	 * Destroy TIWha object
+	 * 
+	 * \note   
+	 * \param  
+	 * \return   
+	 * \sa     
+	 */ 
+	virtual ~TIWha();
+
+
+  
+
+	/* Call constructor */
+	static Wha* Create( MWlanOsa& aOsa, 
+	                    WlanHpa& aHpa, 
+	                    const SHwBusAccessLayer& aTransPortLayer );
+
+	/* Call destructor */
+	static void Destroy( Wha* aWha );
+
+
+	/** 
+	 * \fn     WhaCb
+	 * \brief  attach call back to LDD form the WLAN driver
+	 * 
+	 * \note   	in case error indication was received - return Null. That way we avoid calls to UMAC.
+	 * \param  
+	 * \return pointer to the Call Back function in the WHA (LDD)  
+	 * \sa     
+	 */ 	
+    WHA::MWhaCb* WhaCb() {return iWhaCb;}
+
+
+	/** 
+	* \fn     FailureIndicationCb
+	* \brief  Generic Error Indicatin function to the UMAC
+	* 
+	* sends the UMAC Error indications as agreed.
+	* 
+	* \note   
+	* \param EFailureEvent  - the kind of error
+	* \return 
+	* \sa     
+	*/         
+	void FailureIndicationCb ( EFailureEvent failureEvent);    
+    	
+
+    /** 
+     * \fn     ConnectionTimeOut
+     * \brief  change rate management parameters after the connection phase
+     * 
+     * \note    
+     * \return  
+     * \sa      
+     */    
+    void ConnectionTimeOut ();
+
+    /** 
+     * \fn     SetTxFailLowThreshold
+     * \brief  Set new Tx Fail rate to FW
+     * 
+     * \note    
+     * \return  
+     * \sa      
+     */    
+    void SetTxFailLowThreshold( TI_UINT8 uTxFailLowTh);
+	
+   /** 
+ * \fn     InitializeAfterTimer
+ * \brief  start second part of initialization after timer expired
+ *          
+ * \note    
+ * \param  
+ * \return  
+ * \sa      
+ */ 
+    void InitializeAfterTimer();
+	
+    /** 
+     * \fn     RxMemFailTimerCb
+     * \brief  call RxXfer in case memory allocation failed, so we will try again
+     *          
+     * \note    
+     * \param  
+     * \return  
+     * \sa      
+     */ 
+    void RxMemFailTimerCb();
+
+/*******************************************************************************
+ *                                                                             *
+ * WLAN Symbian HAL API command methods below.                                     *
+ *                                                                             *
+ *******************************************************************************/
+
+    /** 
+     * \fn     Initialize
+     * \brief  Downloads the firmware code to the WLAN device
+     * (reference wlanwha.h) 
+     *          
+     * \note    
+     * \param  aData firmware data
+     * \param  aLength length of the data in bytes
+     * \return  
+     * \sa      
+     */ 
+	void Initialize(
+				   const void* aData, 
+				   TUint32 aLength );
+
+    /** 
+     * \fn     Configure
+     * \brief  Method configures the WLAN device after the WHA layer has send the EInitializeResponse event.
+     * (reference wlanwha.h) 
+     *          
+     * \note    
+     * \param  aData firmware data. The content is vendor specific.
+     * \param  aWhaSettings output data that holds the capabilities
+     * \return  
+     * \sa      
+     */ 
+	void Configure(
+		const WHA::SConfigureData&, 
+		WHA::SSettings& aWhaSettings );
+
+    /** 
+     * \fn     Configure
+     * \brief  Command will cause the WHA layer to release all OS resources and stop
+	 * its operation. (reference wlanwha.h) 
+     *          
+     * \note    
+     * \param  aSynchronous should command be executed synchronously (ETrue) or not (EFalse) 
+     * \return Command was executed synchronously and no command response event is sent
+     * \sa      
+     */ 
+ 	WHA::TStatus Release( TBool aSynchronous );
+
+    /** 
+     * \fn     Scan
+     * \brief  When the WLAN device receives this command, it goes into a scanning mode.
+     * (reference wlanwha.h) 
+     *          
+     * \note    
+     * \param  aMaxTransmitRate specifies the transmission rate of the probe request in case of a active scan
+     * \param  aBand selects the used frequency band. 
+     * \param aNumOfChannels number of channels provided in the command
+	 * \param aChannels specifies the scanned channels
+	 * \param aScanType specifies the scan type:0 foreground scan, 1 background scan, 2 forced background scan
+	 * \param aNumOfProbeRequests number of probe requests (per SSID): sent to one (1) channel, Zero (0) means that none is send, 
+	 * which means that a passive scan is to be done.  
+	 * \param aNumOfSSID number of SSID provided in the scan command (this is zero (0) in broadcast scan)
+	 * \param aSsid Array of the SSID to be probed in scan
+     * \return 
+     * \sa      
+     */ 
+	void Scan(  WHA::TRate                  aMaxTransmitRate, 
+				WHA::TBand                  aBand,
+				TUint8                      aNumOfChannels,
+				const WHA::SChannels*   aChannels, 
+				WHA::TScanType          aScanType,
+				TUint8                      aNumOfProbeRequests,
+				TBool                       aSplitScan,
+				TUint8                      aNumOfSSID,
+				const WHA::SSSID*       aSsid);
+
+     /** 
+     * \fn     StopScan
+     * \brief  This method stops a previously started scan process in the WLAN device.
+     * (reference wlanwha.h) 
+     *          
+     * \note    
+     * \param 
+     * \return
+     * \sa      
+     */ 
+   void StopScan();
+
+    /** 
+    * \fn     Join
+    * \brief  The WLAN host driver uses this method to command the WLAN device to 
+	* join a BSS or an IBSS or to start an IBSS.(reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aMode specifies the operation mode of the station: 0 for IBSS, 1 for BSS
+	* \param aBSSID specifies the BSSID of the BSS or IBSS to be joined or the IBSS to be started
+	* \param aSSID specifies the SSID of the IBSS to join or start
+	* \param aBand selects the used frequency band. Only 1 bit is used to select the band
+	* \param aChannel specifies the channel number to join.
+    * \param aBeaconInterval specifies the time between TBTTs in TUs
+	* \param aBasicRateSet defines the BSS basic rate set
+	* \param aAtimWindow ATIM window of IBSS
+    * \param aPreambleType Specifies the PLCP preamble type used: 0 for long preamble, 1 for short preamble
+    * \param aProbeForJoin specifies if a probe request should be send with the specified SSID when joining to the network. 
+    * \return
+    * \sa      
+    */ 
+	void Join(
+			 WHA::TOperationMode aMode,
+			 const WHA::TMacAddress& aBSSID,
+			 const WHA::SSSID& aSSID, 
+			 WHA::TBand aBand,
+			 WHA::TChannelNumber aChannel,
+			 TUint32 aBeaconInterval,
+			 WHA::TRate aBasicRateSet,
+			 TUint16 aAtimWindow,
+			 WHA::TPreamble aPreambleType,
+			 TBool aProbeForJoin );
+
+    /** 
+    * \fn     SetPsMode
+    * \brief  The WLAN host driver uses this method to manipulate the WLAN devices 
+	* 802.11 power management mode in infrastructure mode.(reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aPsMode desired 802.11 power management mode:0 - 802.11 power save disable, 1 - 802.11 power save enable
+    * \return
+    * \sa      
+    */ 
+	void SetPsMode( WHA::TPsMode aPsMode );
+
+    /** 
+    * \fn     SetBssParameters
+    * \brief  The WLAN host driver uses this method to fix connection parameters 
+	* after the initial connection setup (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aDTIM specifies the DTIM interval in multiples of beacons
+    * \param aAID specifies the AID received during the association process
+    * \return
+    * \sa      
+    */ 
+	void SetBssParameters(
+						 TUint8 aDTIM, 
+						 TUint16 aAID );
+
+    /** 
+    * \fn     Measure
+    * \brief  This method starts radio measurements in the WLAN device.
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aTxPowerLevel used transmission power level during the measurement process. 
+	* \param aBand selects the used frequency band. Only 1 bit is used to select the band
+	* \param aChannel specifies the channel number.
+    * \param aActivationDelay number of TBTTs until interval specified by the aMeasurementOffset starts.
+    * \param aMeasurementOffset Time after the activation delay in TUs
+	* \param aNumberOfMeasurementTypes number of measurement types to activate at parallel
+	* \param aParameterSet specific measurement parameter set
+    * \return
+    * \sa      
+    */ 
+	void Measure(
+				WHA::TPowerLevel aTxPowerLevel,
+				WHA::TBand aBand,
+				WHA::TChannelNumber aChannel,
+				TUint8 aActivationDelay,
+				TUint8 aMeasurementOffset,
+				TUint8 aNumberOfMeasurementTypes,
+				const WHA::SParameterSet* aParameterSet );
+
+    /** 
+    * \fn     StopMeasure
+    * \brief  This method stops all previously started measurement processes in the WLAN device. 
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param 
+    * \return
+    * \sa      
+    */ 
+	void StopMeasure();
+
+    /** 
+    * \fn     ReadMib
+    * \brief  The WLAN host driver uses this method to read configuration 
+	* information and statistics from the WLAN vendor specific solution. 
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aMib ID of the MIB to be accessed
+    * \return
+    * \sa      
+    */ 
+ 	void ReadMib( WHA::TMib aMib );
+
+    /** 
+    * \fn     WriteMib
+    * \brief  The WLAN host driver uses this method to write configuration 
+	* information to the WLAN vendor specific solution
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aMib ID of the MIB to be written
+	* \param aLength length of the MIB
+	* \param aData pointer to the MIB data
+	* \param aMore more MIBS are written after this command (ETrue) or not (EFalse) 
+	* \return ESuccess: Command was executed synchronously and no command response event is sent
+	*         EPending: Command is executed asynchronously and corresponding command response event 
+    *                   will be sent upon command completion
+    * \sa      
+    */ 
+	WHA::TStatus WriteMib(
+						 WHA::TMib aMib,
+						 TUint16 aLength,
+						 const void* aData,
+						 TBool aMore  );
+
+    /** 
+    * \fn     AddKey
+    * \brief  This method adds a new (or replaces an old) encryption key to WLAN device
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aType type of the key to be added
+	* \param aKey pointer to buffer specifying the key material, 
+	* \param aEntryIndex
+	* \return 
+    * \sa      
+    */ 
+	void AddKey(
+			   WHA::TKeyType aType, 
+			   const void* aKey,
+			   TUint8 aEntryIndex );
+
+    /** 
+    * \fn     RemoveKey
+    * \brief  This method removes encryption keys from active key set. 
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aEntryIndex index of the key to remove from the set, Valid range: 0-8
+    * \return 
+    * \sa      
+    */ 
+	void RemoveKey( TUint8 aEntryIndex );
+
+    /** 
+    * \fn     ConfigureQueue
+    * \brief  The WLAN host driver uses this method to configure QoS parameters of transmission queues 
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aQueueId ID for the queue
+    * \param aMaxLifeTime dot11MaxTransmitMsduLifetime to be used for the specified queue. 
+    * \param aPsScheme PS scheme of the specified queue: 0 Regular PS, 1 U-APSD, 2 Legacy PSPOLL,3 S-APSD [optional]
+    * \param aSAPSDConfig
+    * \param aQueueId ID for the queue
+    * \param aAckPolicy ACK frame policy of the specified queue: 0 - normal, 1 - Tx no ACK [optional],2 - block ACK [optional]
+    * \return 
+    * \sa      
+    */ 
+	void ConfigureQueue(
+					   WHA::TQueueId aQueueId,
+					   TUint32 aMaxLifeTime,
+					   WHA::TPsScheme aPsScheme,
+					   const WHA::SSAPSDConfig& aSAPSDConfig,
+					   WHA::TAckPolicy aAckPolicy,
+                       TUint16 aMediumTime );
+
+    /** 
+    * \fn     ConfigureAC
+    * \brief  The WLAN host driver uses this method to configure EDCA Access Category parameters.
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aCwMin CWmin (in slots) for the access class
+    * \param aCwMax CWmax (in slots) for the access class
+    * \param aAIFS AIFS value (in slots) for the access class
+    * \param aTxOplimit Tx Op Limit (in microseconds) for the access class
+    * \param aMaxReceiveLifeTime dot11MaxReceiveLifeTime to be used for the specified queue.  
+    * \return 
+    * \sa      
+    */ 
+	void ConfigureAC(
+					TUint16 aCwMin[Wha::KNumOfEdcaQueues],
+					TUint16 aCwMax[Wha::KNumOfEdcaQueues],
+					TUint8 aAIFS[Wha::KNumOfEdcaQueues],
+					TUint16 aTxOplimit[Wha::KNumOfEdcaQueues],
+					TUint16 aMaxReceiveLifeTime[Wha::KNumOfEdcaQueues] );
+
+    /** 
+    * \fn     SendPacket
+    * \brief  The WLAN host driver uses this method to send packets across the interface. 
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aFrame pointer to the frame (MSDU) content
+    * \param aLength MSDU length.
+    * \param aQueueId transmit queue as defined in ConfigureQueue
+    * \param aTxRateClassId transmit rate class ID defined in txRatePolicy MIB. 
+    * \param aMaxTransmitRate defines the highest transmission rate to be used   
+    * \param aMore informs the WHA layer if an another packet is pending for transmission in the same context  
+    * \param aPacketId packet identifier   
+    * \param aPowerLevel transmission power level 
+    * \param aExpiryTime the elapsed time in TUs  
+    * \param aReserved reserved field  
+    * \return ESuccess: Packet was accepted for delivery to WLAN device. 
+    *  ESuccessXfer: Packet and all the (possible) other packets queued inside the WHA layer were transferred to the WLAN device.
+    *  EQueueFull: The designated transmit queue is full and the packet was not accepted for delivery to WLAN device. 
+    * \sa      
+    */ 
+	WHA::TStatus SendPacket(
+						   const void* aFrame,
+						   TUint16 aLength,
+						   WHA::TQueueId aQueueId,
+						   TUint8 aTxRateClassId,
+						   WHA::TRate aMaxTransmitRate,
+						   TBool aMore,
+						   WHA::TPacketId aPacketId,
+						   WHA::TPowerLevel aPowerLevel,
+						   TUint32 aExpiryTime,
+						   void* aReserved );
+
+    /** 
+    * \fn     Reset
+    * \brief  The WLAN host driver uses this command to reset the WLAN vendor specific solution to its initial state
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param   
+    * \return 
+    * \sa      
+    */ 
+	void Reset();
+
+    /** 
+    * \fn     Plt
+    * \brief  The host driver calls this method to perform production line testing of the WLAN device
+    * (reference wlanwha.h) 
+    *          
+    * \note    
+    * \param aType indicates which test to perform  
+    * \param aParams test specific parameters 
+    * \return 
+    * \sa      
+    */ 
+    void Plt (WHA::TPltType aType, void *aParams);
+    
+
+	/**
+	 * Direct read/write operation from the device 
+	 */
+	WHA::TStatus WriteMem (TMemoryAccess *pMemoryAccess);
+	WHA::TStatus ReadMem (TMemoryAccess  *pMemoryAccess);
+
+	/**********************************************/
+	/************ TIWha callbacks **************/
+	/**********************************************/
+
+    /* ConnectBusCb called after first connection phase (init command transaction) is finished*/
+    void ConnectBusCb (TI_STATUS status); 
+	/* Init HW Callback called after all software init is done  and NVS configuration was saved as defaults, will download the FW*/
+	void InitHwCb ( TI_STATUS status);
+	/* Init FW Callback called after Fw was downloaded will configure the FW*/
+	void InitFwCb ( TI_STATUS status);
+	/* Config FW Callback will set the defaults*/
+	void ConfigFwCb ( TI_STATUS status);
+    /* InitFailCb will be called in case of a failure in one of the init SM's */
+	void InitFailCb ( TI_STATUS status);
+
+	/**********************************************/
+	/************ Complete callbacks **************/
+	/**********************************************/
+
+	/* Complete Callback */
+	void ScanCompleteCb (TI_STATUS returnStatus , E80211PsStatus PSMode);
+
+	/* Power Save Complete Callback */
+	void SetPsModeCompleteCb (TUint8 PSMode, TUint8 transStatus);
+
+	/* Measurement Complete Callback */
+	void MeasureCompleteCb               ( TMeasurementReply *pMsrReply);
+
+
+	/**********************************************/
+	/*********** Indication callbacks *************/
+	/**********************************************/
+	/* RCPI Indication Callback */
+	void RcpiIndicationCb                ( TUint8* buffer, TUint32 len);
+	/* Lost Beacon Indication Callback */        
+	void LostBssIndicationCb             ();
+	/* Regain Bss Indication Callback */        
+	void RegainBssIndicationCb           ();
+	/* BtCoexistence Indication CallBacks */
+	void btCoexSenseIndicationCb         ( TUint8* buffer, TUint32 len);
+	void btCoexProtectiveIndicationCb    ( TUint8* buffer, TUint32 len);
+	void btCoexAvalancheIndicationCb     ( TUint8* buffer, TUint32 len);
+    /* FW statistics callback */
+    void TWD_StatisticsReadCB (TI_HANDLE hTWD, TI_UINT16 MboxStatus, ACXStatistics_t* pElem);
+	/*Avr RSSI Callback*/
+	void TWD_AvrRssiReadCB (TI_HANDLE hCb, TI_UINT16 MboxStatus, ACXRoamingStatisticsTable_t* roamingStatistics);
+	/**********************************************/
+	/************ Response callbacks **************/
+	/**********************************************/
+
+	/* Generic Response Callback */
+	void GenericCommandResponseCb ( TUint16 CmdType, TUint16 CmdID, TUint32 aStatus);
+	/* Scan Response Callback */
+	void ScanResponseCb(WHA::TStatus aStatus);
+	/* Join Response Callback */
+	void JoinCompleteCb ();
+
+	/* Add Key Response Callback */
+	void AddKeyResponseCb                ( WHA::TStatus aStatus);
+	/* Remove Key Response Callback */
+	void RemoveKeyResponseCb             ( WHA::TStatus aStatus);
+	/* Stop Scan Response Callback */
+	void StopScanResponseCb (WHA::TStatus aStatus);
+
+	/* Power Save Response Callback */
+	void SetPsModeResponseCb (TUint8 aStatus);
+
+	/* Read MIB Response Callback */
+	void ReadMIBResponseCb               ( TUint16 aStatus,  void *InterrogateParamsBuf);
+	/* TxPower Level Read MIB CallBack */
+	void ReadMIBStationIdResponse      (TUint16 aStatus, void *InterrogateParamsBuf);
+	void ReadMIBstatisticsTableResponse(TUint16 aStatus,  void *InterrogateParamsBuf);
+	void ReadMIBcountersTableResponse  (TUint16 aStatus,  void *InterrogateParamsBuf);
+	void ReadMIBBtCoexParamsResponse   (TUint16 aStatus,  void *InterrogateParamsBuf);
+	/* Read Version Callback */
+	void ReadMIBVersion                (TUint16 aStatus,  void *InterrogateParamsBuf);
+	/* Measure Response Callback */
+	void MeasureResponseCb               ( TUint16 aStatus);
+	/* Stop Measure Response Callback */
+	void StopMeasureResponseCb           ( TUint16 aStatus);
+	/* Command Complete Generic Callback */
+
+
+	/* PLT Response Callback */
+	void PltResponseCb                   ( TI_STATUS aStatus,  void *InterrogateParamsBuf);
+	/* PLT RX PER callbacks */
+	void PltPerGetResultResponseCb       ( TUint16 aStatus,  void *InterrogateParamsBuf);
+	void PltPerStartResponseCb           ( TUint16 aStatus,  void *InterrogateParamsBuf);
+	void PltPerStopResponseCb            ( TUint16 aStatus,  void *InterrogateParamsBuf);
+	void PltPerClearResponseCb           ( TUint16 aStatus, void *InterrogateParamsBuf);
+	/* Read Memory/Registers Response Callback */
+	void ReadMemResponseCb          (TFwDebugParams* params);
+	/* Write Registers Response Callback */
+	void WriteMemResponseCb         (TFwDebugParams* params);
+
+	/* PLT TX calibration */
+	void PltGainGetResponseCb            ( TUint16 aStatus,  void *InterrogateParamsBuf);
+	void PltGetNVSUpdateBufferResponseCb ( TUint16 aStatus,  void *InterrogateParamsBuf);
+
+#ifdef PLT_TESTER
+	TUint8 iRealPlt;
+	void PltSm(void *pBuf);
+
+#endif
+	/* RX CallBacks */
+    ERxBufferStatus RequestForBufferCb (void **pWbuf, TI_UINT16 aLength, TI_UINT32 uEncryptionflag);
+	
+	void ReceivePacketCb (const void *aFrame);
+
+
+	/* Frame was written to FW */
+	void TxXferCb(TTxCtrlBlk *pPktCtrlBlk);
+
+	/* Frame was transmitted over the air (or failed to be transmitted) */
+	void TxCompleteCb (TxResultDescriptor_t *pTxResultInfo, TI_UINT32 backpressure);
+
+	/**
+	* \fn     InitResponse
+	* \brief ititializatin response function. In case of success - return command response
+	*								In case of error - send error indication (as requested from Palau)
+	*
+	* /note
+	* 
+	* /param aTwdInitStatus - Whether Init was successful
+	*   
+	* /return 
+	*/
+	void InitResponse                  (WHA::TStatus aTwdInitStatus);
+
+
+	/**
+	* \fn     getMacAddress
+	* \brief  return the Mac address from the TWDCtrl
+	*
+	* 
+	* /note
+	* 
+	* /return 
+	*/
+	void * getMacAddress();
+
+
+    /**
+	* \fn     ConvertTxBip2Nvs
+	* \brief  Fill in the Tx NVS params in iBipNvsBuffer
+	*
+	* 
+	* /note
+	* 
+	* /return 
+	*/
+	void ConvertTxBip2Nvs(void* pBuf);
+
+
+    /**
+	* \fn     ConvertRxBip2Nvs
+	* \brief  Fill in the Rx NVS params in iBipNvsBuffer
+	*
+	* 
+	* /note
+	* 
+	* /return 
+	*/
+    void ConvertRxBip2Nvs(void* pBuf);
+
+private:
+
+    /**
+	* Internal PLT to match the TWD test API
+	* /param eTestCmd indicates which test to perform
+	* /param pTestCmdParams test specific parameters
+	* /return 
+	*/
+
+    WHA::TStatus Plt (ETestCmdID eTestCmd, void *pTestCmdParams);
+    
+
+#ifdef TI_TEST
+	void PltTester(const void *aData);
+	void ChangeQueue(const void *aData);
+#endif /* TI_TEST */
+
+
+	/*Helper function*/
+
+	TI_STATUS CreateDriver();
+	void DestroyDriver();
+
+    	
+	/**
+	* \fn     InitTwdParamTable
+	* \brief  initialization of TWD parameters
+	*
+	* since we have no ini file, we are initializing the 
+	* Modules with hard coded values
+	* /note
+	* 
+	* /return 
+	*/
+	void             InitTwdParamTable   ();
+    /* FEM Auto Detection*/
+    void             InitTwdRadioParam   ();
+    void             FillRadioData();
+    void             FillSmartReflexData();
+    void             InitTwdPlatformGenParam();
+    #ifdef TI_DBG
+       void             PrintRadioData();
+    #endif
+
+    void             InitTwdRadioSmartReflexParam();
+
+
+	/**
+	* \fn     InitBtCoex
+	* \brief  initialization of Soft Gemini parameters
+	*
+	* since we have no ini file, we are initializing the 
+	* Modules with hard coded values
+	* /note
+	* 
+	* /return 
+	*/
+	void 			InitBtCoex();
+
+	/**
+	* \fn     InitReportParamTable
+	* \brief  initialization of Report parameters
+	*
+	* since we ave no ini file, we are initializing the 
+	* Modules wit hard coded values
+	* /note
+	* 
+	* /return 
+	*/
+	void             InitReportParamTable();       
+	/* Open reports for debug */
+	void 	OpenAllReports();
+
+	/** 
+	* \fn     RegisterCb
+	* \brief  registers the TIWha callbacks
+	* 
+	* Register callbacks To Twd level according to the action
+	* that we would like to be triggered on 
+	* 
+	* \note    
+	* \return  status whther the registration succeed or not.
+	* \sa      
+	*/
+	WHA::TStatus     RegisterCb                ();
+
+
+	/** 
+	* \fn     RegisterEvents
+	* \brief  register the TIWha Events
+	* 
+	* Register callbacks To Twd level according to the event 
+	* that we would like to be triggered on 
+	* 
+	* \note    
+	* \return  status whther the registration succeed or not.
+	* \sa      
+	*/
+	WHA::TStatus     RegisterEvents        ();
+
+
+	/**
+	* \fn     FillNWSASettings
+	* \brief  Fill UMAC structure with correct settings
+	*
+	* since we ave no ini file, we are initializing the 
+	* Modules wit hard coded values
+	* /note
+	* 
+	* /param SNWSASettings - pointer pointer to the UMAC settings struct
+	* /return status
+	*/
+	WHA::TStatus     FillNWSASettings      (WHA::SSettings *SNWSASettings);
+
+	/**
+	* \fn     WriteMib utility functions
+	* \brief  For each WriteMib command we use one of the following functions
+	*
+	* /return status
+	*/
+	WHA::TStatus SetSlotTime (const void *aData);
+	WHA::TStatus Dot11MaxReceiveLifeTime (const void *aData) ;
+	WHA::TStatus SetRxFilter (const void *aData);
+	WHA::TStatus SetCurrentTxPowerLevel (const void *aData);
+	WHA::TStatus SetTemplateFrame (const void *aData);
+	WHA::TStatus SetDot11GroupAddrTable (const void *aData);           
+	WHA::TStatus SetDefaultKeyID (const void *aData); 
+	WHA::TStatus Dot11RTSThreshold (const void *aData);
+	WHA::TStatus CtsToSelf (const void *aData);
+	WHA::TStatus SetArpIpAddrTable (const void *aData);
+	WHA::TStatus SetBeaconFilterIETable (const void *aData);
+	WHA::TStatus SetBeaconFilterEnable (const void *aData);
+	WHA::TStatus SleepMode ( const WHA::TSleepMode&       aSleepMode, TBool       bResponse);
+	WHA::TStatus WakeUpConditions (const void *aData);
+	WHA::TStatus SetBeaconLostCount (const void  *aData);
+	WHA::TStatus SetRcpiThreshold (const void *aData);
+	WHA::TStatus TxRatePolicy (TUint32     aLength, const void *aData); 
+	WHA::TStatus btCoexistenceMode(TUint32 aLength, const void *aData);
+        WHA::TStatus btCoexistenceProfile(TUint32 aLength, const void *aData);
+#ifdef HT_SUPPORT
+	void         TConvertTwdHtCapa2SHtCapa (TTwdHtCapabilities* pTwdHtCapabilities,WHA::SHtCapabilities* pHtCapabilities);
+	WHA::TStatus SetHTCapabilities (WHA::ShtCapabilities* pApCapabilities);
+	WHA::TStatus SetHTInformation (WHA::ShtBssOperation* pHtInformarion);
+	WHA::TStatus ConfigureBA (WHA::ShtBlockAckConfigure* pBABitMask);	
+#endif
+    WHA::TStatus TxAutoRatePolicy (WHA::StxAutoRatePolicy* pTxAutoRatePolicy);
+	void 		 SetPowerSavePowerLevel(void *aMib);
+	TI_STATUS SoftGemini_SetParams (TI_HANDLE hTWD, TSoftGeminiParams *pSgParams,ESoftGeminiEnableModes aSgMode );
+	
+	void prepareNextFwChunk ();
+
+	WHA::TStatus preparePktCtrlBlk ( TTxCtrlBlk **pPktCtrlBlk,
+                                              const void* aFrame,
+            								  TUint16 aLength,
+            								  WHA::TQueueId aQueueId,
+            								  TUint8 aTxRateClassId,
+            								  WHA::TRate aMaxTransmitRate,
+            								  TBool aMore,
+            								  WHA::TPacketId aPacketId,
+            								  WHA::TPowerLevel aPowerLevel,
+            								  TUint32 aExpiryTime);
+
+
+    WHA::TStatus AlignTxForTWD (void*& aFrame,TUint16& aLength);
+    void AlignTxSecurityForUMAC (TBool aQFull = FALSE);
+	
+	WHA::TStatus ConstructAddKey (	TSecurityKeys   *aSecurityKey,  /* structure to be filled               */
+							    WHA::TKeyType        aType,          /* Type of the key to be added          */
+							    const void      *aKey,          /* Pointer to buffer specifying the key */
+							                                    /* material, according to the key type  */
+							                                    /* (see specification for details).     */
+							    TUint8          aEntryIndex);    /* Key entry index. Valid range: 0-8.   */
+
+	/*Data*/
+	TIWlanHpaCB*                        iTiWlanHpaCb;
+	WHA::UCommandResponseParams         iUCommandResponseParams; 
+	TI_UINT8							iReabMibMem[TIWha_MAX_READ_MIB_BUFFER];
+	WHA::UCommandCompletionParams		iUCommandCompletionParams;
+	WHA::UIndicationParams				iUIndicationParams;
+	TI_BOOL								bErrorIndication;
+	TI_BOOL								bCallRelease;	
+	TI_BOOL								bFreeDriver;    	
+	TFileInfo           				iFwFile;
+    TI_UINT8*							ipNVSbuf;
+	TI_UINT32							iNVSlength;
+	TI_BOOL								bFailureIndication;	
+	TwdCtrl                    			iTwdCtrl; 
+    TAutoRadioIniParams                 iAutoRadioParams;   
+
+    TSmartReflexConfigParams            iSmartReflexParams;
+    TSmartReflexDebugParams             iSmartReflexDebugParams;
+
+    TI_UINT8                            iSecurityPadding;
+     
+    /* Add the Soft Gemini Parameters to TIWha */
+    TSoftGeminiParams					iSgParams;
+    TI_UINT32							iRxPacketsAllocated;
+
+#ifdef TI_TEST
+	WHA::TQueueId						iQueueId;
+	ACXRoamingStatisticsTable_t			roamingStatistics;
+#endif /* TI_TEST */
+
+    /* PDD create API */
+public:
+    TInt Install();
+    void GetCaps( TDes8& aDes ) const;
+    TInt Create( DBase *&aChannel, TInt aUnit, const TDesC* anInfo, const TVersion& aVer);
+    TInt Validate( TInt aUnit, const TDesC8 *aInfo, const TVersion &aVer );
+    TBool Attach( MWlanOsa& aWlanOsa, MWlanOsaExt& aWlanOsaExt );
+    WHA::Wha& Extract();
+    void GetCapabilities( SCapabilities*& aCapabilities );
+
+    /*
+	 * Hold the capability off the cashe memory
+	 */
+    SCapabilities*    aCapability;
+
+public:
+
+	TUint8								iNvsStart[24];
+	TUint8								iBipNvsBuffer[MAX_TLV_LENGTH];
+
+    TI_UINT32                           iPacketIdTable[CTRL_BLK_ENTRIES_NUM];
+	TUint16								aScanResultCount;
+	TUint16								SentScanResult;
+	TI_STATUS							aPsMode;
+	TI_STATUS							aScanStatus; 
+    TI_HANDLE							hConnectionTimer;           /* Timer for special rate management during connection */
+    static const TI_UINT32              uConnectionApproxTimeMs = 5000; /* After 5 seconds we will set back the original Tx fail rate */
+    TI_BOOL                             bConnectionTimerRunning;
+	
+    TI_HANDLE                           hInitializeTimer;     /* Holds the timer for initialize */
+    TI_HANDLE                           readDot11StationIdMibTmr;
+
+    TI_HANDLE                           hRxMemFailTimer;		/* Next parameters handle Rx memory allocation failure */
+	TI_BOOL								bRxMemFailTimerRunning;
+    TI_UINT32                           uRxMemFailCount;                    
+    static const TI_UINT32              MAX_CONSECUTIVE_RX_MEM_FAIL = 50; /* After this amount of failures we will start dropping packets */
+    static const TI_UINT32              RX_ALLOC_FAIL_TIME_OUT = 10;      /* time out for requesting a buffer again */
+
+	EFailureEvent 						ifailureEvent;
+
+    TMib								iTxRatePolicy;
+
+#ifdef HT_SUPPORT
+	TMacAddr							iJoinedMacAddress; 
+	TUint8 								iTxBlockAckUsageLast;
+    TUint8 								iRxBlockAckUsageLast;
+	WHA::THtMcsSet						iMcsRates;
+	TUint8								iBACounertRespone;	
+#endif /* HT_SUPPORT */
+    TI_UINT8                            bJoined;
+        
+    TI_UINT8                            iConnectionCounter;
+    const void*                         iData;
+    TI_UINT32                           iLength;
+
+    /* Holds the failure event number in order save it in the failure handling context switch */
+    EFailureEvent                       iFailureEvent;
+
+    /* Holds the other two optinal wlan DFC's context */
+    TIFailureDfcClient*                 pFailureDfcClient;
+    TIConnectDfcClient*                 pConnectDfcClient;
+    TBusDrvCfg                          BusDrvCfg;
+
+private:
+    TI_BOOL                       bDriverCreated;
+};
+
+#endif      // TIWha_H   
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaAdaptCb.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,762 @@
+/*
+ * TIWhaAdaptCb.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  WhaAdaptCB.cpp 
+ *  \brief  Adapt CB between C code and C++ code (i.e TWD to TIWha functions)
+ *
+ *  \see   
+ */
+#include "external_inc.h"
+#include "TIWhaAdaptCb.h"
+
+#define __FILE_ID__								FILE_ID_145
+
+#define pTIWha (reinterpret_cast<TIWha*>(hTIWha))
+
+
+
+/** 
+ * \fn     ConnectBus
+ * \brief  
+ *          ConnectBus Callback called in two contexts:  
+ *          1. From Bus driver context on an A-sync bus init transaction
+ *          2. From MWlanDfcClient context, on a Sync bus init transaction
+ * \note
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ConnectBus (TI_HANDLE hTIWha)
+{
+    pTIWha->ConnectBusCb ((WHA::TStatus)0); 
+}
+
+void TIWhaAdaptCB::ConnectBusDFC (TI_HANDLE hTIWha)
+{    
+    pTIWha->pConnectDfcClient->pConnectDfc->Enqueue(*(pTIWha->pConnectDfcClient) ,(TInt)hTIWha);
+}
+
+
+/** 
+ * \fn     InitHw
+ * \brief  
+ *              Init HW Callback called after all software init is done  
+ *              and NVS configuration was saved as defaults, will download the FW
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::InitHw (TI_HANDLE hTIWha, TI_STATUS status)
+{
+    pTIWha->InitHwCb ((WHA::TStatus)status);    
+}
+
+/** 
+ * \fn     InitFw
+ * \brief  
+ *             Init FW Callback called after Fw was downloaded will configure the FW
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::InitFw (TI_HANDLE hTIWha, TI_STATUS status)
+{
+    pTIWha->InitFwCb ((WHA::TStatus)status);    
+}
+
+/** 
+ * \fn     InitFw
+ * \brief  
+ *              Config  FW Callback will set the defaults
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ConfigFw (TI_HANDLE hTIWha, TI_STATUS status)
+{
+    pTIWha->ConfigFwCb ((WHA::TStatus)status);    
+}
+
+/** 
+ * \fn     InitFail
+ * \brief  
+ *              
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::InitFail (TI_HANDLE hTIWha, TI_STATUS status)
+{    
+    pTIWha->InitFailCb ((WHA::TStatus)status);    
+}
+
+/** 
+ * \fn     ScanComplete
+ * \brief  
+ *              Scan Complete Callback
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ScanComplete (TI_HANDLE hTIWha, EScanResultTag eTag,TI_UINT32 uResultCount, 
+					                                    TI_UINT16 SPSStatus, TI_BOOL TSFError, TI_STATUS ScanStatus,
+					                                    TI_STATUS PSMode)
+{
+	/* save the Scan result and PS for furder use */
+	pTIWha->aScanResultCount = uResultCount;
+	pTIWha->aPsMode = PSMode;
+	pTIWha->aScanStatus = ScanStatus;
+
+#ifdef TI_DBG
+	WLAN_OS_REPORT(("ScanComplete -- uResultCount = %d",uResultCount));
+    WLAN_OS_REPORT(("ScanComplete -- aScanResultCount = %d, SentScanResult= %d",pTIWha->aScanResultCount, pTIWha->SentScanResult));
+    WLAN_OS_REPORT(("ScanComplete -- ScanStatus = %d, PSMode= %d",ScanStatus, PSMode));
+#endif
+
+    /* Pass to TIWha only relevant parameters */
+	if (pTIWha->aScanResultCount <= pTIWha->SentScanResult)
+	{
+		//os_printf("TIWhaAdaptCB::ScanComplete Call ScanCompleteCb");
+		pTIWha->ScanCompleteCb ( (WHA::TStatus)ScanStatus,  (E80211PsStatus)PSMode);
+	}
+}
+
+/** 
+ * \fn     SetPsModeComplete
+ * \brief  
+ *              Power Save Complete Callback
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::SetPsModeComplete             (TI_HANDLE hTIWha, TI_UINT8 PSMode, TI_UINT8 transStatus)
+{
+    pTIWha->SetPsModeCompleteCb (PSMode, transStatus);
+}
+
+/** 
+ * \fn     SetPsModeCompleteDummy
+ * \brief  
+ *              Power Save Complete Dummy Callback
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::SetPsModeCompleteDummy        (TI_HANDLE hTIWha, TI_UINT8 PSMode, TI_UINT8 transStatus)
+{
+}
+
+/** 
+ * \fn     FailureIndication
+ * \brief  
+ *         Failure Indication Callback
+ * \note   call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::FailureIndication             (TI_HANDLE hTIWha, EFailureEvent failureEvent)
+{    
+    /* Save the failure event reason, so we will have after we context swith to iFailureDfc */
+    pTIWha->iFailureEvent = failureEvent;
+    /* Register FailureDfcClient to handle the failure from a different context */
+    pTIWha->pFailureDfcClient->pFailureDfc->Enqueue(*(pTIWha->pFailureDfcClient) ,(TInt)hTIWha);            
+}
+
+
+/** 
+ * \fn     FailureIndicationDFC
+ * \brief  
+ *         Failure Indication DFC Callback - Called from MWlanDfcClient context
+ * \note
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::FailureIndicationDFC (TI_HANDLE hTIWha)
+{    
+    pTIWha->FailureIndicationCb(pTIWha->iFailureEvent);
+}
+
+/** 
+ * \fn     ConnectionTimeOut
+ * \brief  
+ *              End of connection phase
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ConnectionTimeOut             (TI_HANDLE hTIWha)
+{
+    pTIWha->ConnectionTimeOut ();
+}
+
+/** 
+ * \fn     InitializeAfterTimer
+ * \brief  call second part of initialization after timer expired
+ *          
+ * \note    
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::InitializeAfterTimer           (TI_HANDLE hTIWha)
+{
+    pTIWha->InitializeAfterTimer();
+}
+
+/** 
+ * \fn     RcpiIndication
+ * \brief  
+ *              RCPI Indication Callback
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::RcpiIndication                (TI_HANDLE hTIWha, TI_UINT8* buffer, TI_UINT32 len)
+{
+    pTIWha->RcpiIndicationCb ( buffer, len);  
+}
+
+/** 
+ * \fn     LostBssIndication
+ * \brief  
+ *              Lost Beacon Indication Callback 
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::LostBssIndication             (TI_HANDLE hTIWha)
+{
+    pTIWha->LostBssIndicationCb ( );  
+}
+
+/** 
+ * \fn     RegainBssIndication
+ * \brief  
+ *              Regain Bss Indication Callback 
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::RegainBssIndication           (TI_HANDLE hTIWha)
+{
+    pTIWha->RegainBssIndicationCb ( );  
+}
+
+/** 
+ * \fn     btCoexSenseIndication
+ * \brief  
+ *              
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::btCoexSenseIndication         (TI_HANDLE hTIWha, TI_UINT8* buffer, TI_UINT32 len)
+{
+    pTIWha->btCoexSenseIndicationCb ( buffer, len);  
+}
+
+/** 
+ * \fn     btCoexProtectiveIndication
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::btCoexProtectiveIndication    (TI_HANDLE hTIWha, TI_UINT8* buffer, TI_UINT32 len)
+{
+    pTIWha->btCoexProtectiveIndicationCb ( buffer, len);  
+}
+
+/** 
+ * \fn     btCoexAvalancheIndication
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::btCoexAvalancheIndication     (TI_HANDLE hTIWha, TI_UINT8* buffer, TI_UINT32 len)
+{
+    pTIWha->btCoexAvalancheIndicationCb ( buffer, len);  
+}
+
+/** 
+ * \fn     GenericCommandResponse
+ * \brief  
+ *              CB for every CMD without a specific CB
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::GenericCommandResponse (TI_HANDLE hTIWha, TI_UINT16 CmdType, TI_UINT16 CmdID, TI_UINT32 aStatus)
+{
+    pTIWha->GenericCommandResponseCb ( CmdType, CmdID, aStatus);
+}
+
+/** 
+ * \fn     DummyResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::DummyResponse (TI_HANDLE Dummy, TI_STATUS aStatus)
+{
+}
+
+/** 
+ * \fn     ScanResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ScanResponse(TI_HANDLE hTIWha,TI_STATUS aStatus)
+{
+    pTIWha->ScanResponseCb ( (WHA::TStatus)aStatus);
+}
+
+/** 
+ * \fn     JoinComplete
+ * \brief  
+ *              Actually join complete...
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::JoinComplete                  (TI_HANDLE hTIWha)
+{
+    pTIWha->JoinCompleteCb ();
+}
+
+/** 
+ * \fn     StopScanResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::StopScanResponse              (TI_HANDLE hTIWha, TI_STATUS aStatus)
+{
+    pTIWha->StopScanResponseCb ( (WHA::TStatus)aStatus);
+}
+
+/** 
+ * \fn     SetPsModeResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::SetPsModeResponse             (TI_HANDLE hTIWha, TI_UINT8 aStatus)
+{
+    pTIWha->SetPsModeResponseCb (aStatus);
+}
+
+/** 
+ * \fn     SetPsModeResponseDummy
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::SetPsModeResponseDummy        (TI_HANDLE hTIWha, TI_UINT8 aStatus)
+{
+}
+
+/** 
+ * \fn     ReadMIBResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ReadMIBResponse               (TI_HANDLE hTIWha, TI_UINT16 aStatus,  void *InterrogateParamsBuf)
+{
+    pTIWha->ReadMIBResponseCb ( aStatus, InterrogateParamsBuf);
+}
+
+/** 
+ * \fn     MeasureResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::MeasureResponse               (TI_HANDLE hTIWha, TI_UINT16 aStatus)
+{ 
+}
+
+/** 
+ * \fn     StopMeasureResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::StopMeasureResponse           (TI_HANDLE hTIWha, TI_UINT16 aStatus)
+{ 
+}
+
+/** 
+ * \fn     StopMeasureResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::AddKeyResponse			(TI_HANDLE hTIWha, TI_STATUS aStatus)
+{
+    pTIWha->AddKeyResponseCb (aStatus);
+    
+}
+
+/* RX CallBacks */
+/** 
+ * \fn     RequestForBuffer
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+ERxBufferStatus TIWhaAdaptCB::RequestForBuffer (TI_HANDLE hTIWha, void **pWbuf, TI_UINT16 aLength, TI_UINT32 uEncryptionFlag)
+{
+    return pTIWha->RequestForBufferCb (pWbuf, aLength, uEncryptionFlag);
+}
+
+/** 
+ * \fn     ReceivePacket
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ReceivePacket (TI_HANDLE        hTIWha,
+                             const void    *aFrame)
+{
+	pTIWha->ReceivePacketCb (aFrame);
+}
+
+
+/** 
+ * \fn     ReceivePacketWhileScan
+ * \brief  
+ * \note    Use while Scan only to count the scan resault
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ReceivePacketWhileScan(TI_HANDLE hTIWha, const void *aFrame)
+{
+        RxIfDescriptor_t*  pRxParams = (RxIfDescriptor_t*)aFrame;
+
+	pTIWha->ReceivePacketCb (aFrame);
+
+	if (pRxParams->packet_class_tag == TAG_CLASS_BCN_PRBRSP)
+	{
+		pTIWha->SentScanResult++;
+        if (pTIWha->aScanResultCount <= pTIWha->SentScanResult)
+		{
+			/* Send the scan complete CB */
+			#ifdef TI_DBG
+				WLAN_OS_REPORT(("ReceivePacketWhileScan Call Scan Complete"));
+			#endif
+			pTIWha->ScanCompleteCb (pTIWha->aScanStatus, (E80211PsStatus)pTIWha->aPsMode);			
+		}
+	}
+}
+
+/** 
+ * \fn     ReceivePacket
+ * \brief  Frame was written to FW 
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::TxXfer ( TI_HANDLE hTIWha, TTxCtrlBlk *pPktCtrlBlk)
+{
+    pTIWha->TxXferCb (pPktCtrlBlk);
+}
+
+/** 
+ * \fn     TxComplete
+ * \brief  Frame was transmitted over the air (or failed to be transmitted)
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::TxComplete ( TI_HANDLE hTIWha, TxResultDescriptor_t *pTxResultInfo, TI_UINT32 backpressure)
+{
+    pTIWha->TxCompleteCb ( pTxResultInfo, backpressure);
+}
+
+
+/** 
+ * \fn     TxBipResponse
+ * \brief   TxBIP Response Callback 
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::TxBipResponse (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf)
+{
+	// Convert from FW result to NVS file All manipulation is done on buffer
+	// supplied by Symbian
+	os_printf("BipResponse call ConvertBip2Nvs");
+    /* ConvertRxBip2Nvs() will update only the Tx part of the NVS */
+	pTIWha->ConvertTxBip2Nvs(InterrogateParamsBuf); 
+
+	// After convertion finished calling Regular PLT response to indicate that NVS file is ready
+	PltResponse(hTIWha,aStatus,InterrogateParamsBuf);
+}
+
+
+/** 
+ * \fn     RxBipResponse
+ * \brief   RxBIP Response Callback 
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::RxBipResponse (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf)
+{
+	// Convert from FW result to NVS file All manipulation is done on buffer
+	// supplied by Symbian
+    /* ConvertRxBip2Nvs() will update only the Rx part of the NVS */
+	os_printf("BipResponse call ConvertBip2Nvs");
+	pTIWha->ConvertRxBip2Nvs(InterrogateParamsBuf); 
+
+	// After convertion finished calling Regular PLT response to indicate that NVS file is ready
+	PltResponse(hTIWha,aStatus,InterrogateParamsBuf);
+}
+
+/** 
+ * \fn     RxStatResponse
+ * \brief   Get Statistic Response Callback 
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::RxStatResponse				  (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf)
+{
+
+	//normalize the RSSI to RCPI in 0.5DB scale
+
+	/*valus are in db/8
+	so if RCPI = (db +110) * 2 then to have it in valus of db/2 -> RCPI = (db/4 +220) */
+
+	if ((*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageRssi > 0)
+	{
+		(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageRssi = 220;
+	}
+	else
+	{
+		if ((*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageRssi/8 < -110)
+		{
+			(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageRssi = 0;
+		}
+		else
+		{
+			(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageRssi=
+			(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageRssi/4 +220;
+		}
+	}
+
+
+	/* On RX Statistic we move thru this function to print the RX statistic */
+
+	WLAN_OS_REPORT(("Received Valid Packet no.: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.ReceivedValidPacketsNumber,(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.ReceivedValidPacketsNumber));
+	WLAN_OS_REPORT(("Received FCS Error Packet no.: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.ReceivedFcsErrorPacketsNumber,(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.ReceivedFcsErrorPacketsNumber));
+	WLAN_OS_REPORT(("Received Address missmatch Error Packet no.: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.ReceivedPlcpErrorPacketsNumber,(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.ReceivedPlcpErrorPacketsNumber));
+	WLAN_OS_REPORT(("Sequence Number Missing Count: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.SeqNumMissCount,(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.SeqNumMissCount));
+	WLAN_OS_REPORT(("Average SNR: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageSnr,(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageSnr));
+	WLAN_OS_REPORT(("Average RSSI: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageRssi,(*((RadioRxStatistics*)InterrogateParamsBuf)).oRxPathStatistics.AverageRssi));
+	WLAN_OS_REPORT(("Base Packet ID: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).oBasePacketId,(*((RadioRxStatistics*)InterrogateParamsBuf)).oBasePacketId));
+	WLAN_OS_REPORT(("Number of Packets: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).ioNumberOfPackets,(*((RadioRxStatistics*)InterrogateParamsBuf)).ioNumberOfPackets));
+	WLAN_OS_REPORT(("Number of Missed Packets: %d(0x%x)\n", (*((RadioRxStatistics*)InterrogateParamsBuf)).oNumberOfMissedPackets,(*((RadioRxStatistics*)InterrogateParamsBuf)).oNumberOfMissedPackets));
+
+	PltResponse(hTIWha,aStatus,InterrogateParamsBuf);
+}
+
+
+/** 
+ * \fn     RunRssiResponse
+ * \brief   Print the RSSI value 
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::RunRssiResponse (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf)
+{
+    /* Print the Rssi value, the value is RSSI * 8 */
+    WLAN_OS_REPORT (("PltResponseCb : FLALI Command Respons -- Status = %d",((TTestCmdFreeRSSI*)InterrogateParamsBuf)->oRadioStatus));
+    WLAN_OS_REPORT (("PltResponseCb : FLALI Command Respons -- RSSI = %d",((TTestCmdFreeRSSI*)InterrogateParamsBuf)->RSSIVal));
+
+	PltResponse(hTIWha,aStatus,InterrogateParamsBuf);
+}
+
+/** 
+ * \fn     PltResponse
+ * \brief   PLT Response Callback 
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::PltResponse (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf)
+{
+    pTIWha->PltResponseCb ( aStatus, InterrogateParamsBuf);
+}
+
+
+/** 
+ * \fn     ReadMemResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ReadMemResponse          (TI_HANDLE hTIWha, TFwDebugParams* params)
+{
+    pTIWha->ReadMemResponseCb (params);
+	
+}
+
+
+/** 
+ * \fn     WriteMemResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::WriteMemResponse         (TI_HANDLE hTIWha, TFwDebugParams* params)
+{
+    pTIWha->WriteMemResponseCb (params);
+}
+
+
+/** 
+ * \fn     ReadDot11StationIdCb
+ * \brief  
+ * \note    call  ReadMIBResponseCb after timer context change
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::ReadDot11StationIdCb         (TI_HANDLE hTIWha)
+{
+    /* Call ReadMIBResponse from the ReadDot11StationIdCb since we have the CHIP ID */
+    pTIWha->ReadMIBResponseCb ( WHA::KSuccess, pTIWha->getMacAddress());
+}
+
+/** 
+ * \fn     RxMemFailTimerCb
+ * \brief  
+ * \note    call  TIWha::RxMemFailTimerCb
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::RxMemFailTimerCb         (TI_HANDLE hTIWha)
+{
+    pTIWha->RxMemFailTimerCb ();
+}
+
+/** 
+ * \fn     AvrRssiReadResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::AvrRssiReadResponse (TI_HANDLE hTIWha, TI_UINT16 MboxStatus, ACXRoamingStatisticsTable_t* roamingStatistics)
+{
+    pTIWha->TWD_AvrRssiReadCB (hTIWha, MboxStatus, roamingStatistics);
+}
+
+
+/** 
+ * \fn     StatisticsReadResponse
+ * \brief  
+ * \note    call member function of TIWha class
+ * \param  hTIWha - handle to TIWha class
+ * \return  
+ * \sa      
+ */ 
+void TIWhaAdaptCB::StatisticsReadResponse (TI_HANDLE hTIWha, TI_UINT16 MboxStatus, ACXStatistics_t* pElem)
+{
+    pTIWha->TWD_StatisticsReadCB (hTIWha, MboxStatus, pElem);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaAdaptCb.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,177 @@
+/*
+ * TIWhaAdaptCb.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWhaAdaptCB.h 
+ *  \brief  Adapt CB between C code and C++ code (i.e TWD to TIWha functions)
+ *
+ *  \see   
+ */
+
+#ifndef TI_WHA_ADAPT_CB_H
+#define TI_WHA_ADAPT_CB_H
+
+#include "TIWha.h"
+
+class TIWhaAdaptCB
+{
+public:
+
+    /* Connect CB called after that TxnQ_Connect is done */
+    static void  ConnectBus (TI_HANDLE hTIWha);    
+    static void ConnectBusDFC (TI_HANDLE hTIWha);
+    
+	/* Init HW Callback called after all software init is done  and NVS configuration was saved as defaults, will download the FW*/
+	static void  InitHw (TI_HANDLE hTIWha, TI_STATUS status);
+	/* Init FW Callback called after Fw was downloaded will configure the FW*/
+	static void InitFw (TI_HANDLE hTIWha, TI_STATUS status);
+	/* Config  FW Callback will set the defaults*/
+	static void ConfigFw (TI_HANDLE hTIWha, TI_STATUS status);
+	
+	static void InitFail (TI_HANDLE hTIWha, TI_STATUS status);
+
+	/* Scan Complete Callback */
+	static void ScanComplete (TI_HANDLE hTIWha, EScanResultTag eTag,TI_UINT32 uResultCount, 
+					                                    TI_UINT16 SPSStatus, TI_BOOL TSFError, TI_STATUS ScanStatus,
+					                                    TI_STATUS PSMode);
+
+	/* Power Save Complete Callback */
+	static void SetPsModeComplete             (TI_HANDLE hTIWha, TI_UINT8 PSMode, TI_UINT8 transStatus);
+
+	/* Power Save Complete Dummy Callback */
+	static void SetPsModeCompleteDummy        (TI_HANDLE hTIWha, TI_UINT8 PSMode, TI_UINT8 transStatus);
+
+	/* Failure Indication Callback */
+	static void FailureIndication             (TI_HANDLE hTIWha, EFailureEvent failureEvent);    
+
+        /* Failure Indication DFC Callback */
+        static void FailureIndicationDFC             (TI_HANDLE hTIWha);    
+
+        /* Connection time out CB, used to indicate that the connection proccess is over */
+        static void ConnectionTimeOut             (TI_HANDLE hTIWha);
+
+        /* Start Initialize */
+        static void InitializeAfterTimer          (TI_HANDLE hTIWha);
+
+	/* RCPI Indication Callback */
+	static void RcpiIndication                (TI_HANDLE hTIWha, TI_UINT8* buffer, TI_UINT32 len);
+
+	/* Lost Beacon Indication Callback */        
+	static void LostBssIndication             (TI_HANDLE hTIWha);
+
+	/* Regain Bss Indication Callback */        
+	static void RegainBssIndication           (TI_HANDLE hTIWha);
+
+	/* BtCoexistence Indication CallBacks */
+	static void btCoexSenseIndication         (TI_HANDLE hTIWha, TI_UINT8* buffer, TI_UINT32 len);
+	static void btCoexProtectiveIndication    (TI_HANDLE hTIWha, TI_UINT8* buffer, TI_UINT32 len);
+	static void btCoexAvalancheIndication     (TI_HANDLE hTIWha, TI_UINT8* buffer, TI_UINT32 len);
+
+	/* Init Response Callback */
+	static void GenericCommandResponse (TI_HANDLE hTIWha, TI_UINT16 CmdType, TI_UINT16 CmdID, TI_UINT32 aStatus);
+	/* Dummy Response Callback - needed in cases that Mib was done but no indication in neede in the UMAC */
+	static void DummyResponse (TI_HANDLE Dummy, TI_STATUS aStatus);
+	/* Scan Response Callback */
+	static void ScanResponse(TI_HANDLE hTIWha,TI_STATUS aStatus);
+	/* JoinComplete Callback */
+	static void JoinComplete                  (TI_HANDLE hTIWha);
+	/* Stop Scan Response Callback */
+	static void StopScanResponse              (TI_HANDLE hTIWha, TI_STATUS aStatus);
+	/* Power Save Response Callback */
+	static void SetPsModeResponse             (TI_HANDLE hTIWha, TI_UINT8 aStatus);
+	/* Power Save Response Dummy Callback */
+	static void SetPsModeResponseDummy        (TI_HANDLE hTIWha, TI_UINT8 aStatus);
+	/* Read MIB Response Callback */
+	static void ReadMIBResponse               (TI_HANDLE hTIWha, TI_UINT16 aStatus,  void *InterrogateParamsBuf);
+	/* Measure Response Callback */
+	static void MeasureResponse               (TI_HANDLE hTIWha, TI_UINT16 aStatus);
+	/* Stop Measure Response Callback */
+	static void StopMeasureResponse           (TI_HANDLE hTIWha, TI_UINT16 aStatus);
+	/* Add key response callback */
+	static void AddKeyResponse			( TI_HANDLE hTIWha, TI_STATUS aStatus);
+
+	/* PLT */
+	/* PLT Response Callback */
+	static void PltResponse                   (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf);
+	/* Tx BIP Response Callbake */
+	static void TxBipResponse                   (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf);
+        /* Rx BIP Response Callbake */
+        static void RxBipResponse                   (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf);
+	/* RX Statistic Parameters */
+	static void RxStatResponse				  (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf);
+
+    /* Free Run RSSI Response */
+    static void RunRssiResponse (TI_HANDLE hTIWha, TI_STATUS aStatus,  void *InterrogateParamsBuf);
+
+	/* PLT RX PER callbacks */
+	static void PltPerGetResultResponse       (TI_HANDLE hTIWha, TI_UINT16 aStatus,  void *InterrogateParamsBuf);
+	static void PltPerStartResponse           (TI_HANDLE hTIWha, TI_UINT16 aStatus,  void *InterrogateParamsBuf);
+	static void PltPerStopResponse            (TI_HANDLE hTIWha, TI_UINT16 aStatus,  void *InterrogateParamsBuf);
+	static void PltPerClearResponse           (TI_HANDLE hTIWha, TI_UINT16 aStatus, void *InterrogateParamsBuf);
+	/* Read Memory/Registers Response Callback */
+	static void ReadMemResponse          (TI_HANDLE hTIWha, TFwDebugParams* params);
+	/* Write Registers Response Callback */
+	static void WriteMemResponse         (TI_HANDLE hTIWha, TFwDebugParams* params);
+	/* PLT TX calibration */
+	static void PltGainGetResponse            (TI_HANDLE hTIWha, TI_UINT16 aStatus,  void *InterrogateParamsBuf);
+	static void PltGetNVSUpdateBufferResponse (TI_HANDLE hTIWha, TI_UINT16 aStatus,  void *InterrogateParamsBuf);
+
+	/* RX CallBacks */
+    static ERxBufferStatus RequestForBuffer (TI_HANDLE hTIWha, void **pWbuf, TI_UINT16 aLength, TI_UINT32 uEncryptionflag);
+    static void ReceivePacket (TI_HANDLE hTIWha, const void *aFrame);
+    static void ReceivePacketWhileScan (TI_HANDLE hTIWha, const void *aFrame);
+
+	/* Frame was written to FW */
+	static void TxXfer ( TI_HANDLE hTIWha, TTxCtrlBlk *pPktCtrlBlk);
+
+	/* Frame was transmitted over the air (or failed to be transmitted) */
+	static void TxComplete ( TI_HANDLE hTIWha, TxResultDescriptor_t *pTxResultInfo, TI_UINT32 backpressure);
+	
+    static void ReadDot11StationIdCb        (TI_HANDLE hTIWha);
+
+	static void RxMemFailTimerCb         (TI_HANDLE hTIWha);
+
+    static void AvrRssiReadResponse (TI_HANDLE hTIWha, TI_UINT16 MboxStatus, ACXRoamingStatisticsTable_t* roamingStatistics);
+
+    static void StatisticsReadResponse (TI_HANDLE hTIWha, TI_UINT16 MboxStatus, ACXStatistics_t* pElem);                
+};
+
+
+
+#endif /* TI_WHA_ADAPT_CB_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaCb.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,2332 @@
+/*
+ * TIWhaCb.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 TIWhaCB.c
+ *  \brief TIWha Adaptation CB implementation
+ *
+ */
+
+
+#include "TIWha.h"
+#include "TIWhaAdaptCb.h"
+#ifdef FPGA1273_STAGE_
+#warning FPGA
+#include "fw1273_fpga.h"
+#endif
+extern "C"
+{
+#include "timer.h"
+#include "report.h"
+#include "TWDriver.h"
+#include "WlanDrvCommon.h"
+#include "version.h"
+#define __FILE_ID__								FILE_ID_146
+}
+
+ 
+/** 
+ * \fn     prepareNextFwChunk
+ * \brief  called for each Fw chunk. last chunk is marked with bLast
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha:: prepareNextFwChunk ()
+{
+    /* Move to the next chunk (if this is the first chunk then uLength == 0)*/
+    iFwFile.pBuffer 	+= iFwFile.uLength; 
+
+    /* read Chunk's address */
+    iFwFile.uAddress = BYTE_SWAP_LONG( *((TI_UINT32*)(iFwFile.pBuffer)) );
+    iFwFile.pBuffer += DRV_ADDRESS_SIZE;
+    /* read Portion's length */
+    iFwFile.uLength = BYTE_SWAP_LONG( *((TI_UINT32*)(iFwFile.pBuffer)) );
+    iFwFile.pBuffer += DRV_ADDRESS_SIZE;
+
+    /* decrease number of chunks left, and check if this is the last one */
+    if ( --iFwFile.uChunksLeft == 0 )  
+    {
+        /* Last chunk. Next time we should continue with our own sequence */
+    	iFwFile.bLast = TI_TRUE;
+    }     
+
+    
+    /*TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INIT,  TIWLANWHA_CB_MODULE_LOG, MSG_2195 , iFwFile.bLast, iFwFile.uChunksLeft, iFwFile.uLength, iFwFile.uAddress);*/
+}
+
+
+/* Thisis called whentxnQ_ConnectBus has finished */
+void TIWha:: ConnectBusCb ( TI_STATUS status)
+{ 
+    /* This will download the FW image into part with DMA of 512 bytes each time */
+    TWD_Init (iTwdCtrl.hTWD,
+    	  iTwdCtrl.hReport,
+    	  this,
+    	  iTwdCtrl.hTimer,
+    	  iTwdCtrl.hContext,
+    	  iTwdCtrl.hTxnQ,
+    	  (TTwdCallback)TIWhaAdaptCB::InitHw,
+    	  (TTwdCallback)TIWhaAdaptCB::InitFw,
+    	  (TTwdCallback)TIWhaAdaptCB::ConfigFw,
+    	  NULL,//(TTwdCallback)drvMain_TwdStopCb,
+    	  (TTwdCallback)TIWhaAdaptCB::InitFail);
+
+    /* Set the default ELP mode to be in awake mode */
+    TWD_CfgSleepAuth (iTwdCtrl.hTWD, POWERAUTHO_POLICY_AWAKE);
+
+    
+    /*TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INIT,  TIWLANWHA_MODULE_LOG, MSG_2196, "data = 0x%x len = %d\n",aData,aLength);*/
+
+    /* Set Report default parameters in to the logger internal DB */
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, "Set Defaults");
+     
+    /* Setting the defaults values for the TWD and the Report modules
+    note that all parameters are hardcoded and not from a configuration file */
+    InitTwdParamTable ();
+    InitTwdPlatformGenParam();
+    
+    /*  FEM Auto Detection Configure Radio Params only if Manual mode selected*/
+    if (iAutoRadioParams.tGeneralParams.TXBiPFEMAutoDetect == FEM_MANUAL_DETECT_MODE_E)
+    {     
+      /* fill TWD init parms with relevant (RFMD or TriQuint) Radio parms before calling TWD_SetDefault*/
+      InitTwdRadioParam();
+    }
+
+    
+    /* Fill the default SmartReflex params */
+    InitTwdRadioSmartReflexParam();
+
+    /* Initializing the SG profile and params */
+    InitBtCoex();
+
+    TWD_SetDefaults (iTwdCtrl.hTWD, &(iTwdCtrl.twdInitParams));
+
+    
+    TWD_SetRateMngDebug(iTwdCtrl.hTWD, &(iTwdCtrl.twdInitParams.tRateMngParams));
+
+    /* Set the default burst mode to false */
+    TWD_CfgBurstMode (iTwdCtrl.hTWD, BURST_MODE_ENABLE_DEF);
+
+    /* Set the SG params to the wlan internal DB */
+    /* BTCOEX_DEFAULT_MODE is set to SG_OPPORTUNISTIC */
+    SoftGemini_SetParams(iTwdCtrl.hTWD,&iSgParams,BTCOEX_DEFAULT_MODE);
+
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, "Register CB/Events");
+    
+    RegisterCb ();
+    RegisterEvents ();
+
+  /* sending the NVS buffer - it can be default or real nvs*/
+    if ( TWD_InitHw (iTwdCtrl.hTWD,ipNVSbuf,iNVSlength) != TI_OK)
+    {
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_FATAL_ERROR, "\n.....TWD_InitHw failure \n");
+    }
+}
+
+
+/** 
+ * \fn     InitHwCb
+ * \brief  called after  init was done
+ * 
+ * kick the next stage of itit after all TWD modules wew initialaized. 
+ * 
+ * \note    
+ * \param  hTIWha -  Handle to the TIWha object
+ * \param  aStatus - status
+ * \return  
+ * \sa      
+ */ 
+void TIWha:: InitHwCb ( TI_STATUS status)
+{ 
+    uint8 FemType;
+  
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, "\n");
+
+   /*  FEM Auto Detection Configure Radio Params only if Manual mode selected*/
+   if (iAutoRadioParams.tGeneralParams.TXBiPFEMAutoDetect == FEM_MANUAL_DETECT_MODE_E)
+   {       
+       FemType = TWD_GetFEMType(iTwdCtrl.hTWD);
+    
+       if (FemType != iAutoRadioParams.tGeneralParams.TXBiPFEMManufacturer)
+       {
+           WLAN_OS_REPORT(("TIWha:: InitHwCb  ERROR Manual FEM is %d  real FEM is %d \n",iAutoRadioParams.tGeneralParams.TXBiPFEMManufacturer,FemType));
+       }       
+   }
+   
+    /* update Radio params due to FEM type*/
+    if (iAutoRadioParams.tGeneralParams.TXBiPFEMAutoDetect == FEM_AUTO_DETECT_MODE_E)
+    {
+     /* fill TWD init parms with relevant (RFMD or TriQuint) Radio parms before calling TWD_SetDefault*/
+     InitTwdRadioParam();
+      /* FEM Auto Detect, calling agian TWD_SetDefault, to store real Radio params in TWD DB due to FEM detection */
+     TWD_SetDefaults (iTwdCtrl.hTWD, &(iTwdCtrl.twdInitParams));
+
+    }
+     
+    /* 
+     * prepare Fw file. 
+     */
+     
+    /* First chunk points to begining of Fw */
+    /*  This was retrieved in Iniatialize iFwFile.pBuffer = (TI_UINT8*)firmware;*/
+    /* length of chunk will be updated later in prepareNextFwChunk() */
+    iFwFile.uLength	= 0;
+    /* First 4 bytes indicate the number of chunks */
+    iFwFile.uChunksLeft = BYTE_SWAP_LONG( *((TI_UINT32*)(iFwFile.pBuffer)) );
+    iFwFile.pBuffer += DRV_ADDRESS_SIZE;
+
+    /* Mark if we are in the last chunk (i.e. only one chunk) */
+    iFwFile.bLast = ( iFwFile.uChunksLeft == 1 ? TI_TRUE : TI_FALSE);
+
+    /* Prepare next chunk for initFw */
+    prepareNextFwChunk ();
+
+    /* call TWD with first chunk */        
+    TWD_InitFw ( iTwdCtrl.hTWD, &iFwFile);
+}
+
+
+/** 
+ * \fn     InitFwCb
+ * \brief  after FW download
+ * 
+ * giv back the context to the UMAC for configuration
+ * 
+ * \note    
+ * \param  hTIWha -  Handle to the TIWha object
+ * \param  aStatus - status
+ * \return  
+ * \sa      
+ */ 
+void TIWha:: InitFwCb (  TI_STATUS status)
+{ 
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, " last = %d ChunksLeft = %d\n", iFwFile.bLast, iFwFile.uChunksLeft);
+
+    if (status != TI_OK )
+    {
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, " status = %d \n", status);
+    }
+    
+    /* check if another rounf of FW download is needed */
+    if ( iFwFile.bLast == TI_FALSE )
+    {
+        /* download another chunk */
+        prepareNextFwChunk ();
+        TWD_InitFw ( iTwdCtrl.hTWD, &iFwFile);
+    }
+    else
+    {
+        /* Call Init Response with the given status */
+        InitResponse ((WHA::TStatus)status);
+    }
+    /* next step will be configure from UMAC */       
+}
+
+/** 
+ * \fn     ConfigFwCb
+ * \brief  after FW configured
+ * 
+ * after FW configured using the set defauls stage.
+ * 
+ * \note    
+ * \param  hTIWha -  Handle to the TIWha object
+ * \param  aStatus - status
+ * \return  
+ * \sa      
+ */ 
+void TIWha:: ConfigFwCb (  TI_STATUS status)
+{
+ 
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, " status = %d\n",status);
+
+    if (status == TI_OK)
+    {        
+        /* Register the command complete generic callback. From now on we will get response for every command */
+        TWD_RegisterCb (iTwdCtrl.hTWD, TWD_EVENT_COMMAND_COMPLETE, 
+                                                (TTwdCB *)TIWhaAdaptCB::GenericCommandResponse, this);
+
+        /* Enable external events from FW */
+        TWD_EnableExternalEvents (iTwdCtrl.hTWD); 
+
+        /* At this stage now send back the Command Response of the Configure stage to the UMAC */
+        if( bErrorIndication == TI_FALSE)
+        {    
+            WhaCb()->CommandResponse(WHA::EConfigureResponse, WHA::KSuccess, iUCommandResponseParams);		
+        }
+        #if TI_DBG
+            else
+            {
+                WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+            }
+        #endif
+
+        /* Indicate that UMAC will send the Release() command by itself, since EConfigureResponse was sent */
+        bCallRelease  = TI_FALSE;
+
+    }
+    else    /* Configure Failure - Send error indication since it is the only thing that will unload the driver */ 
+    {
+        TIWhaAdaptCB::FailureIndication (this, HW_AWAKE_FAILURE);
+    }
+}
+
+
+/** 
+ * \fn     InitFailCb
+ * \brief  general fail in init/configure stages
+ * 
+ * \note    
+ * \param  hTIWha -  Handle to the TIWha object
+ * \param  aStatus - status
+ * \return  
+ * \sa      
+ */ 
+void TIWha::InitFailCb ( TI_STATUS status)
+{     
+    InitResponse ((WHA::TStatus)WHA::KFailed);
+}
+
+/** 
+ * \fn     ConnectionTimeOut
+ * \brief  change rate management parameters after the connection phase
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::ConnectionTimeOut ()
+{
+    TRACE1( iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "%s\n",__FUNCTION__);
+
+    bConnectionTimerRunning = TI_FALSE;
+    SetTxFailLowThreshold(TIWHA_TX_FAIL_LOW_TH_AFTER_CONNECTION);
+}
+
+/** 
+ * \fn     SetTxFailLowThreshold
+ * \brief  Set new Tx Fail rate to FW
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */    
+void TIWha::SetTxFailLowThreshold( TI_UINT8 uTxFailLowTh)
+{
+    RateMangeParams_t tRM;
+
+    TRACE2( iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "%s Th = %d\n",__FUNCTION__,uTxFailLowTh);
+    /* Set the Tx fail Threshold again to the FW */
+    tRM.paramIndex = RATE_MGMT_TX_FAIL_LOW_TH_PARAM;
+    tRM.TxFailLowTh = uTxFailLowTh;
+    /* CommandResponse would be ignored for this call (for ACX_SET_RATE_MAMAGEMENT_PARAMS) */
+    TWD_SetRateMngDebug(iTwdCtrl.hTWD, &tRM);
+}
+/** 
+ * \fn     FailureIndication
+ * \brief  fail CB for the driver
+ * 
+ * propogats faliure indication
+ * \note    
+ * \param  failureEvent - failure Event
+ * \return  
+ * \sa      
+ */ 
+void TIWha::FailureIndicationCb ( EFailureEvent failureEvent)
+{   
+    bFailureIndication = TI_TRUE;
+
+    /* 
+     * Check if we should call Release() directly since UMAC calls release only after 
+     * successful EConfigureResponse 
+     */
+    if (bCallRelease)
+    {	
+
+		/* in case we are before configure complete save the failure event to send it later */
+		ifailureEvent = failureEvent;
+
+        iConnectionCounter++;
+        WLAN_OS_REPORT(("POR identified - Reconnecting #%d \n", iConnectionCounter));
+
+        /* if we have consecutive failures then add delayes till next reconnect to increase success probability */
+        if (iConnectionCounter > 2) 
+        {
+            /* if we fail more than 5 times notify the upper layer on failure to initailze */
+            if (iConnectionCounter > 5) 
+            {
+
+                bCallRelease = TI_FALSE;
+                 /* If we recognize failure in init time then release the driver and try to intialize again */
+                 Release(TRUE);
+
+                 WLAN_OS_REPORT((" ************** FailureIndicationCb == %d ****************** \n",ifailureEvent));
+
+                 /* call to LDD with failure indication */                                      
+                 if( bErrorIndication == TI_FALSE)
+                 {    
+                     WhaCb()->Indication (WHA::EError, iUIndicationParams);
+                 }
+                 #if TI_DBG
+                     else
+                     {
+                        WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+                     }
+                 #endif
+                
+                return;
+            }
+            /* 2 < iConnectionCounter <= 5 */
+            else
+            {
+                /* If we recognize failure in init time then release the driver and try to intialize again */
+                Release(TRUE);                
+                /* If we have more than 2 conssecutive failures wait 400ms before turning on the device */
+                os_StalluSec ((TI_HANDLE)&iTwdCtrl.tOsContext, STALL_ON_FAILURE );    
+            }
+        }
+        /* iConnectionCounter <= 2 */
+        else        
+        {
+            /* If we recognize failure in init time then release the driver and try to intialize again */
+            Release(TRUE);
+            /* Wait 1ms before turning on the device */
+            os_StalluSec ((TI_HANDLE)&iTwdCtrl.tOsContext, STALL_ON_RECONNECT );
+        }
+        Initialize(iData, iLength);
+
+        bFailureIndication = TI_FALSE;
+
+        return;
+
+	}
+     
+
+    TRACE1( iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, " ************** FailureIndicationCb == %d ****************** \n",failureEvent);
+
+    #ifndef NO_ERROR_INDICATION
+        /* Always return MacNotResponding in case of an EEROR */
+        iUIndicationParams.iError.iStatus = WHA::KErrorMacNotResponding; 
+
+        if( bErrorIndication == TI_FALSE)
+        {    
+            WhaCb()->Indication (WHA::EError, iUIndicationParams);
+        }
+        #if TI_DBG
+            else
+            {
+                WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+            }
+        #endif
+
+    #endif
+
+    /* Mark that from now on there will be no calls to LDD (this is done with a dummy WhaCb() ) */
+    bErrorIndication = TI_TRUE;
+}
+
+/** 
+ * \fn     RcpiIndication
+ * \brief  rcpi CB for the driver
+ * 
+ * propogats rcpi indication
+ * \note    
+ * \param  buffer - RCPI value
+ * \return  
+ * \sa      
+ */ 
+void TIWha::RcpiIndicationCb ( TUint8* buffer, TUint32 len)
+{
+    TRACE0( iTwdCtrl.hReport, REPORT_SEVERITY_WARNING, " *********** RcpiIndication  ****************** \n");
+    
+	iUIndicationParams.iRcpi.iRcpi= *((WHA::TRcpi*)buffer);	
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->Indication (WHA::ERcpi, iUIndicationParams);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif
+}
+
+
+/** 
+ * \fn     TIWha_ScanResponseCb
+ * \brief  Scan complete CB call directly to the host driver command response 
+ * 
+ * Function detailed description goes here 
+ * 
+ * \note    
+ * \param  aStatus - status
+ * \return  
+ * \sa      
+ */ 
+void TIWha::ScanResponseCb (WHA::TStatus aStatus)
+{
+    
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " aStatus = %d\n", aStatus);
+
+    if( bErrorIndication == TI_FALSE)
+    {    
+        (WhaCb())->CommandResponse(WHA::EScanCommandResponse,  WHA::KSuccess, iUCommandResponseParams);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif
+}
+
+/** 
+ * \fn     ScanCompleteCb
+ * \brief  Scan complete CB. 
+ * 
+ * \note    
+ * \param  PSMode - not used
+ * \param  returnStatus - status
+ * \return  
+ * \sa      
+ */ 
+void TIWha::ScanCompleteCb (TI_STATUS returnStatus , E80211PsStatus PSMode)
+{
+	WHA::TStatus status = ( returnStatus == TI_OK ) ? WHA::KSuccess : WHA::KFailed;
+
+   /* return PS state by using PowerSaveSrv in TWD */
+    iUCommandCompletionParams.iScanComplete.iDot11PowerManagementMode = TWD_GetPsStatus (iTwdCtrl.hTWD) ? WHA::KPsEnable : WHA::KPsDisable;
+
+    TRACE2(iTwdCtrl.hTWD, REPORT_SEVERITY_INFORMATION , " - status = %d iDot11PowerManagementMode = %d\n", status, iUCommandCompletionParams.iScanComplete.iDot11PowerManagementMode );
+
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandComplete(WHA::EScanComplete, status, iUCommandCompletionParams);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif
+
+	/* Set back the ReceivePacket CB to norman path */
+    TWD_RegisterCb (iTwdCtrl.hTWD,
+                    TWD_EVENT_RX_RECEIVE_PACKET, 
+                    (TTwdCB *)TIWhaAdaptCB::ReceivePacket, 
+                    this);
+}
+
+
+/** 
+ * \fn     GenericCommandResponseCb
+ * \brief  Whenever we don't have a specific callback we get into here
+ *
+ * \param           CmdType - Command Type
+ * \param            CmdID   - ACX ID
+ * \param            aStatus - Success or Failure    
+ * \return
+ * \sa     
+ */
+void TIWha::GenericCommandResponseCb ( TUint16 CmdType, TUint16 CmdID, TUint32 aStatus)
+{
+    WHA::TCommandId commandId = WHA::EWriteMIBResponse; /* By default we get here on WriteMib response */
+
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "GenericCommandResponseCb Command = 0x%x, ACX = 0x%x, status = %d\n",        CmdType, CmdID, aStatus);
+
+    switch (CmdType)
+    {
+	/* Do not send Command Response in case of Ps Mode ==> this may happen when doing Scan in ForceBackgroundScan Type 
+	that sets the PS to be entered and then a Command Response of Entering PS mode is received via this channel although the Scan command has been issued */
+	case CMD_SET_PS_MODE:
+		return;
+
+    case CMD_CONFIGURE:
+        switch (CmdID)
+        {
+			case ACX_TID_CFG:
+			    commandId = WHA::EConfigureQueueResponse;
+			    break;
+			case ACX_AC_CFG:
+			    commandId = WHA::EConfigureACResponse;
+			    break;
+			case ACX_AID:
+			    commandId = WHA::ESetBssParametersResponse;
+			    break;
+			    
+			case ACX_SLEEP_AUTH:
+			    if ( ! iTwdCtrl.bResponse )
+			    {   /* In this case we don't send response since it is an internal command */
+			       return;
+			    }
+			    break;
+#ifdef HT_SUPPORT
+			case ACX_BA_SESSION_RESPONDER_POLICY:
+			case ACX_BA_SESSION_INITIATOR_POLICY:
+				iBACounertRespone--;
+				if (iBACounertRespone > 0)
+				{
+					return;
+				}
+				commandId = WHA::EWriteMIBResponse;
+				break;
+#endif /* HT_SUPPORT */
+			    
+			/* In this case it is an internal MIB so do not send response to upper layer */
+			case ACX_PREAMBLE_TYPE:
+			    return;
+            /* Internal command before join and after full connection */
+            case ACX_SET_RATE_MAMAGEMENT_PARAMS:
+                return;
+        }
+			    break;
+    
+		    case CMD_STOP_SCAN:
+		        /* The regular StopScan command always goes through StopScanResponseCb(). This is a special
+		         * error case where ScanSrv decided to send StopScan. Therefore we shouldn't forward the indication
+		         * to UMAC 
+		         */
+		        return;
+		        
+		    case CMD_START_JOIN:
+		        /* 
+		         * In TWD we have 'join response' and 'join complete' while Symbian defines only 'join response'.
+		         * Hence, here we ignore the response, and the join complete returns to Symbian as EJoinResponse
+		         */
+		        return;
+
+		    case CMD_DISCONNECT:
+		        commandId = WHA::EResetResponse;
+		        break;
+
+            case CMD_SET_STA_STATE:
+				/* This is an internal command sent by WHA at Set AID method.
+				   This is used to indicate the FW that the STA is connected for COEX and 11N BA */
+                return;
+
+	        default:
+	            break;
+        }
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "GenericCommandResponseCb sending response to UMAC status = %d\n",aStatus);
+
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandResponse(commandId, aStatus, iUCommandResponseParams);		
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif
+}
+
+/**
+* \fn     InitResponse
+* \brief ititializatin response function. In case of success - return command response
+*								In case of error - send error indication (as requested from Palau)
+*
+* /note
+* 
+* /param aTwdInitStatus - Whether Init was successful
+*   
+* /return 
+*/
+void TIWha::InitResponse (WHA::TStatus aTwdInitStatus)
+{       
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INIT, " status = %d\n",aTwdInitStatus);
+    
+    if (aTwdInitStatus == WHA::KSuccess)
+    {
+            if( bErrorIndication == TI_FALSE)
+            {    
+                WhaCb()->CommandResponse(WHA::EInitializeResponse, WHA::KSuccess, iUCommandResponseParams);
+            }
+            #if TI_DBG
+                else
+                {
+                    WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+                }
+            #endif
+            
+    }
+    else    /* Init Failure - Send error indication since it is the only thing that will unload the driver */ 
+    {
+        /* Call UMAC with error indication */        
+        TIWhaAdaptCB::FailureIndication (this, HW_AWAKE_FAILURE);
+    }
+}
+
+
+/****************************************************************************************
+ *                     MeasureComplete()                                   *
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::MeasureCompleteCb ( TMeasurementReply* msrReply)
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                     MeasureResponse()                                   *
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::MeasureResponseCb ( TUint16 aStatus)
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                       StopMeasureResponse()                             *
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::StopMeasureResponseCb ( TUint16 aStatus)
+{
+    return;
+}
+
+
+
+/**
+* \fn     SetPsModeResponseCb
+*
+* 
+* /param aStatus 
+*   
+* /return 
+*/
+void TIWha::SetPsModeResponseCb (TUint8 aStatus)
+{
+	WHA::TStatus status = ( aStatus == TI_OK ) ? WHA::KSuccess : WHA::KFailed;
+
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION , " - aStatus: = %d status = %d\n", aStatus, status);
+
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandResponse (WHA::ESetPsModeCommandResponse, status, iUCommandResponseParams);		
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+}
+
+
+/**
+* \fn     SetPsModeCompleteCb
+*
+* 
+* /param aStatus 
+*   
+* /return 
+*/
+void TIWha::SetPsModeCompleteCb (TUint8 PSMode, TUint8 transStatus)
+{
+    /* By default the request was successful */
+    WHA::TStatus        status = WHA::KSuccess;
+    /* By default we are not in 802.11 ps mode */
+    WHA::TPsMode psMode = WHA::KPsDisable;
+    
+    switch (transStatus)
+    {
+    case ENTER_POWER_SAVE_FAIL :  
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR , " - status: Enter PowerSaveFailure\n");
+
+        status = WHA::KFailed;
+        break;
+
+    case EXIT_POWER_SAVE_FAIL :  
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR , " - status: Exit PowerSaveFailure (but we our awake anyway)\n");
+        /* PS State is awake because even if we failed - we are not in PS - but the return is Failed */
+        status = WHA::KFailed;
+        break;
+
+    case ENTER_POWER_SAVE_SUCCESS :  
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION , " - status: Enter PowerSave Success\n");
+        psMode = WHA::KPsEnable;
+        break;
+
+    case EXIT_POWER_SAVE_SUCCESS :  
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION , " - status: Exit PowerSave Success\n");
+        break;
+
+    default :
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR , " unknown- status = %d: Failed\n", __FUNCTION__);
+        status = WHA::KFailed;
+    }
+
+    /* 
+     * On any case other then ENTER_POWER_SAVE_FAIL we change sleep mode
+     * Note that on EXIT_POWER_SAVE_FAIL we are actually awake and therfore we change sleepMode
+     */
+    if ( transStatus != ENTER_POWER_SAVE_FAIL && transStatus != EXIT_POWER_SAVE_SUCCESS) 
+    {
+        /* Configure Awake if we are in PsDisable and user-defined sleepMode otherwise  */ 
+        if ( psMode == WHA::KPsEnable )
+        {
+            /* Configure H/W to user sleep mode */
+            SleepMode (iTwdCtrl.sleepMode, FALSE);
+        }
+        else 
+        {
+            /* Configure H/W to awake */
+            SleepMode (WHA::KAwakeMode, FALSE);
+        }
+    }
+    
+    iUCommandCompletionParams.iSetPsModeComplete.iDot11PowerManagementMode = psMode;
+    
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandComplete(WHA::ESetPsModeComplete, status, iUCommandCompletionParams);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+}
+
+
+/****************************************************************************************
+ *                        AddKeyResponse()                                 *
+ ****************************************************************************************
+DESCRIPTION:    This method is the adapt response to the AddKey command.
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::AddKeyResponseCb ( WHA::TStatus aStatus)
+{
+    WHA::TStatus status = ( aStatus == TI_OK ) ? WHA::KSuccess : WHA::KFailed;
+    
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandResponse (WHA::EAddKeyResponse, status, iUCommandResponseParams);		
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+
+    return;
+}
+
+
+/****************************************************************************************
+ *                        RemoveKeyResponse()                              *
+ ****************************************************************************************
+DESCRIPTION:    This method is the adapt response to the RemoveKey command.
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::RemoveKeyResponseCb ( WHA::TStatus aStatus)
+{
+    WHA::TStatus status = ( aStatus == TI_OK ) ? WHA::KSuccess : WHA::KFailed;
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandResponse (WHA::ERemoveKeyResponse , status, iUCommandResponseParams);	
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+
+    return;
+}
+
+
+/** 
+ * \fn     StopScanResponse
+ * \brief  member function.
+ * 
+ * \note    
+ * \param  aStatus - result of sending stop scan command to FW
+ * \return  
+ * \sa      
+ */ 
+void TIWha::StopScanResponseCb (WHA::TStatus aStatus)
+{
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION , " - status: %d\n", aStatus);
+
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandResponse(WHA::EStopScanResponse, aStatus, iUCommandResponseParams);     
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+}
+
+#ifdef PLT_TESTER
+int state = 0;
+TTestCmd test;
+/** 
+ * \fn     PltSm
+ * \brief  debug function till we have full support for PLT.
+ * 
+ * \note    
+ * \param  pBuf - contain PLT return buffer
+ * \return  
+ * \sa      
+ */ 
+void TIWha::PltSm(void *pBuf)
+{
+        TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION,  " state = %d ptr = %p plt = %d\n", state, pBuf, iTwdCtrl.ePlt);
+	
+	os_printf("*********** TIWha::PltSm state = %d ****************",state);
+
+
+	switch (state)
+	{
+
+    case 0:
+		{
+           
+            os_printf("*********** TEST_CMD_CHANNEL_TUNE  0 7 ****************");
+            /* If we want to debug the plt sequence with no scan */
+            /* state++; */
+            state = 9; /* Start Tx Bip */
+			test.testCmd_u.Channel.iChannel 	= 7;
+			test.testCmd_u.Channel.iBand 		= 0;
+
+			Plt ( TEST_CMD_CHANNEL_TUNE, (void *) &(test.testCmd_u));
+			break;
+		}
+
+	case 1:
+		{
+            os_printf("*********** TEST_CMD_RX_STAT_RESET   ******************");
+			state++;
+			Plt ( TEST_CMD_RX_STAT_RESET, &(test.testCmd_u));
+			break;
+		}
+
+    case 2:
+		{
+            os_printf("*********** TEST_CMD_RX_STAT_START   ******************");
+			state++;
+			Plt ( TEST_CMD_RX_STAT_START, &(test.testCmd_u));
+			break;
+		}
+	case 3:
+		{
+            os_printf("*********** TEST_CMD_RX_STAT_GET     ******************");
+			state++;
+			os_memorySet(NULL , (void *) &test, 0,sizeof(test));
+			Plt ( TEST_CMD_RX_STAT_GET, (void *) &(test.testCmd_u));
+			break;
+		}
+    case 4:
+		{
+            os_printf("*********** TEST_CMD_RX_STAT_STOP    ******************");
+			TTestCmd data;
+			os_memoryCopy(NULL , (void *) &data.testCmd_u, 
+				pBuf, sizeof(data.testCmd_u));
+
+			WLAN_OS_REPORT(("Received Valid Packet no.: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.ReceivedValidPacketsNumber,data.testCmd_u.Statistics.oRxPathStatistics.ReceivedValidPacketsNumber));
+			WLAN_OS_REPORT(("Received FCS Error Packet no.: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.ReceivedFcsErrorPacketsNumber,data.testCmd_u.Statistics.oRxPathStatistics.ReceivedFcsErrorPacketsNumber));
+			WLAN_OS_REPORT(("Received Address missmatch Error Packet no.: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.ReceivedPlcpErrorPacketsNumber,data.testCmd_u.Statistics.oRxPathStatistics.ReceivedPlcpErrorPacketsNumber));
+			WLAN_OS_REPORT(("Sequence Number Missing Count: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.SeqNumMissCount,data.testCmd_u.Statistics.oRxPathStatistics.SeqNumMissCount));
+			WLAN_OS_REPORT(("Average SNR: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.AverageSnr,data.testCmd_u.Statistics.oRxPathStatistics.AverageSnr));
+			WLAN_OS_REPORT(("Average RSSI: %d(0x%x)\n", data.testCmd_u.Statistics.oRxPathStatistics.AverageRssi,data.testCmd_u.Statistics.oRxPathStatistics.AverageRssi));
+			WLAN_OS_REPORT(("Base Packet ID: %d(0x%x)\n", data.testCmd_u.Statistics.oBasePacketId,data.testCmd_u.Statistics.oBasePacketId));
+			WLAN_OS_REPORT(("Number of Packets: %d(0x%x)\n", data.testCmd_u.Statistics.ioNumberOfPackets,data.testCmd_u.Statistics.ioNumberOfPackets));
+			WLAN_OS_REPORT(("Number of Missed Packets: %d(0x%x)\n", data.testCmd_u.Statistics.oNumberOfMissedPackets,data.testCmd_u.Statistics.oNumberOfMissedPackets));
+
+			state++;
+			Plt ( TEST_CMD_RX_STAT_STOP, pBuf);
+			break;
+		}
+	case 5:
+	   {
+            os_printf("*********** TEST_CMD_FCC            ******************");
+	 		state++;
+            test.testCmdId = TEST_CMD_FCC;
+			test.testCmd_u.TxPacketParams.iDelay = 5000;
+			test.testCmd_u.TxPacketParams.iRate = 0x1;
+			test.testCmd_u.TxPacketParams.iSize = 1000;
+			test.testCmd_u.TxPacketParams.iAmount = 0;
+			test.testCmd_u.TxPacketParams.iPower = 2000;
+			test.testCmd_u.TxPacketParams.iSeed = 10000;
+			test.testCmd_u.TxPacketParams.iPacketMode = 3;
+			test.testCmd_u.TxPacketParams.iDcfOnOff = 0;
+			test.testCmd_u.TxPacketParams.iGI = 204;
+			test.testCmd_u.TxPacketParams.iPreamble = 0;
+			test.testCmd_u.TxPacketParams.iType = 0;
+			test.testCmd_u.TxPacketParams.iScrambler = 1;
+			test.testCmd_u.TxPacketParams.iEnableCLPC = 204;
+			test.testCmd_u.TxPacketParams.iSeqNumMode = 1;
+			test.testCmd_u.TxPacketParams.iSrcMacAddr[0] = 0xDE;
+			test.testCmd_u.TxPacketParams.iSrcMacAddr[1] = 0xAD;
+			test.testCmd_u.TxPacketParams.iSrcMacAddr[2] = 0xBE;
+			test.testCmd_u.TxPacketParams.iSrcMacAddr[3] = 0xFF;
+			test.testCmd_u.TxPacketParams.iSrcMacAddr[4] = 0;
+			test.testCmd_u.TxPacketParams.iSrcMacAddr[5] = 0;
+			for (int i = 0 ; i < 6 ; i ++)
+			{
+				test.testCmd_u.TxPacketParams.iDstMacAddr[i] = 0x5A;
+			}
+
+			os_printf("Pad = 0x%x",&(test.testCmd_u.TxPacketParams.Pad));
+			os_printf("iDelay = 0x%x",&(test.testCmd_u.TxPacketParams.iDelay));
+			os_printf("iRate = 0x%x",&(test.testCmd_u.TxPacketParams.iRate));
+			Plt( TEST_CMD_FCC, (void *) &(test.testCmd_u));
+			break;
+	}
+    case 6:
+		{
+            os_printf("*********** TEST_CMD_STOP_TX         ******************");
+			state++;
+			Plt ( TEST_CMD_STOP_TX, pBuf);
+          	break;
+		}
+	case 7:
+		{
+            os_printf("*********** TEST_CMD_TELEC           ******************");
+			state++;
+			test.testCmd_u.TxToneParams.iPower = 10000;
+
+			Plt ( TEST_CMD_TELEC, (void *) &(test.testCmd_u));
+			break;
+		}
+	case 8:
+		{
+            os_printf("*********** TEST_CMD_STOP_TX         ******************");
+			state++;
+			Plt ( TEST_CMD_STOP_TX, pBuf);
+            
+			break;
+		}
+	case 9:
+		{
+            os_printf("***********                  BIP                 ******************");
+            os_printf("*********** TEST_CMD_UPDATE_PD_REFERENCE_POINT   ******************");
+			state++;
+			test.testCmd_u.PdBufferCalReferencePoint.iReferencePointDetectorValue = 375;
+			test.testCmd_u.PdBufferCalReferencePoint.iReferencePointPower = 128; 
+			test.testCmd_u.PdBufferCalReferencePoint.isubBand = 0;
+
+			Plt ( TEST_CMD_UPDATE_PD_REFERENCE_POINT, (void *) &(test.testCmd_u));
+			break;
+		}
+	case 10: 
+
+		{
+            os_printf("***********              TEST_CMD_P2G_CAL        ******************");
+			state++;
+			test.testCmd_u.P2GCal.iSubBandMask = 1;
+			Plt ( TEST_CMD_P2G_CAL, (void *) &(test.testCmd_u));
+			break;
+		}
+	case 11:
+		{	
+			state++;
+			os_printf("**********               NVS                     *****************");
+
+			/* Print the NVS as in the wilink6_nvs.h file */
+			for (int i = 0; i < iNVSlength; i+=16)
+			{
+					os_printf("0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,0x%02x ,",
+							  ((TUint8*)iBipNvsBuffer)[i+0],((TUint8*)iBipNvsBuffer)[i+1],((TUint8*)iBipNvsBuffer)[i+2],
+							  ((TUint8*)iBipNvsBuffer)[i+3],((TUint8*)iBipNvsBuffer)[i+4],((TUint8*)iBipNvsBuffer)[i+5],
+							  ((TUint8*)iBipNvsBuffer)[i+6],((TUint8*)iBipNvsBuffer)[i+7],((TUint8*)iBipNvsBuffer)[i+8],
+							  ((TUint8*)iBipNvsBuffer)[i+9],((TUint8*)iBipNvsBuffer)[i+10],((TUint8*)iBipNvsBuffer)[i+11],
+							  ((TUint8*)iBipNvsBuffer)[i+12],((TUint8*)iBipNvsBuffer)[i+13],((TUint8*)iBipNvsBuffer)[i+14],
+							  ((TUint8*)iBipNvsBuffer)[i+15]);
+			}
+			
+			//break;
+		}
+
+    case 12:
+
+		{
+
+		os_printf("**********          PltSm TEST END                *****************");
+
+		state = 0;
+		ScanResponseCb(WHA::KSuccess);
+		ScanCompleteCb(TI_OK,POWER_SAVE_802_11_SUCCESS);
+		return;
+		}
+
+	}
+	
+}
+#endif /* PLT_TESTER */
+
+/****************************************************************************************************/
+/*  Function:		ConvertTxBip2Nvs																*/
+/****************************************************************************************************/
+/*  Description:	Recreate the NVS array from the result of the Tx BIP and from the				*/
+/*                  NVS stored for MAC Address restoration	                                        */
+/*                  iBipNvsBuffer - is used in order to keep the TxBiP part for future updates		*/	
+/*  Parameters:		pBuf  - The original supplied BIP pointer										*/
+/*  Return Value:	void																			*/
+/****************************************************************************************************/
+void TIWha::ConvertTxBip2Nvs(void* pBuf)
+{
+    /* The  P2GCAL Buffer coming from WHA (not containing the TesCmdID )*/
+    TTestCmdP2GCal*	pTestCmdP2GCal = (TTestCmdP2GCal*)pBuf;
+
+    #ifdef TI_TEST
+        os_printf("Status = %d",pTestCmdP2GCal->oRadioStatus);
+    #endif
+
+    /* Restore back the MAC Address stored from the NVS into the NVS array */
+    os_memoryCopy(NULL,iBipNvsBuffer,iNvsStart,MAC_ADD_SIZE);
+    
+    /* Copy the TxBIP data into the NVS */
+    os_memoryCopy(NULL, &iBipNvsBuffer[TX_VALUE_INDEX], ((TTestCmdP2GCal*)pTestCmdP2GCal)->oNvsStruct.Buffer, ((TTestCmdP2GCal*)pTestCmdP2GCal)->oNvsStruct.Length);
+
+    /* Update the Rx & Tx Params type */
+    iBipNvsBuffer[TX_TYPE_INDEX] = TX_TYPE;    
+    iBipNvsBuffer[TX_LEN_INDEX] = TX_LEN_LS;
+    iBipNvsBuffer[TX_LEN_INDEX + 1] = TX_LEN_MS;
+
+    iBipNvsBuffer[RX_TYPE_INDEX] = RX_TYPE;    
+    iBipNvsBuffer[RX_LEN_INDEX] = RX_LEN;
+
+    pTestCmdP2GCal->oNvsStruct.Length = NVS_LEN;
+
+    #ifdef TI_TEST
+        os_printf("NVS Length, After -- %d",pTestCmdP2GCal->oNvsStruct.Length);
+    #endif
+    
+    iBipNvsBuffer[NVS_TYPE_INDEX] 		= NVS_TYPE;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 1]	= 0x03;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 2]	= 0x00;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 3]	= 0x00;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 4]	= 0x00;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 5]	= 0x02;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 6]	= 0xFF;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 7]	= 0xFF;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 8]	= 0x00;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 9]	= 0x00;
+
+    /* Copy the TxBIP data into the pBuf */
+    os_memoryCopy(NULL, pTestCmdP2GCal->oNvsStruct.Buffer, iBipNvsBuffer, pTestCmdP2GCal->oNvsStruct.Length);
+    
+
+    #ifdef TI_TEST
+        os_printf("**********               NVS                     *****************");
+        
+        for (int i = 0; i < iNVSlength; i++)
+        {
+            os_printf("iBipNvsBuffer[%d] = 0x%x",i,((TUint8*)iBipNvsBuffer)[i]);
+        }
+    #endif /*TI_TEST*/
+}
+
+
+/****************************************************************************************************/
+/*  Function:		ConvertRxBip2Nvs    															*/
+/****************************************************************************************************/
+/*  Description:	Recreate the NVS array from the result of the Rx BIP and from the				*/
+/*                  NVS stored for MAC Address restoration											*/	
+/*                  iBipNvsBuffer - is used in order to keep the RxBiP part for future updates		*/	
+/*  Parameters:		pBuf  - The original supplied BIP pointer										*/
+/*  Return Value:	void																			*/
+/****************************************************************************************************/
+void TIWha::ConvertRxBip2Nvs(void* pBuf)
+{
+    /* The  P2GCAL Buffer coming from WHA (not containing the TesCmdID )*/
+    RadioRxPltCal*	pTestCmdRxPltCal = (RadioRxPltCal*)pBuf;
+
+    #ifdef TI_TEST
+        os_printf("Status = %d",pTestCmdRxPltCal->oRadioStatus);
+    #endif
+
+    /* Restore back the MAC Address stored from the NVS into the NVS array */
+    os_memoryCopy(NULL,iBipNvsBuffer,iNvsStart,MAC_ADD_SIZE);
+
+    /* Copy the TxBIP data into the NVS */
+    os_memoryCopy(NULL, &iBipNvsBuffer[RX_VALUE_INDEX], ((RadioRxPltCal*)pTestCmdRxPltCal)->oNvsStruct.Buffer, ((RadioRxPltCal*)pTestCmdRxPltCal)->oNvsStruct.Length);
+
+    /* Update the Rx & TX Params type */
+    iBipNvsBuffer[TX_TYPE_INDEX] = TX_TYPE;    
+    iBipNvsBuffer[TX_LEN_INDEX] = TX_LEN_LS;
+    iBipNvsBuffer[TX_LEN_INDEX + 1] = TX_LEN_MS;
+
+    iBipNvsBuffer[RX_TYPE_INDEX] = RX_TYPE;    
+    iBipNvsBuffer[RX_LEN_INDEX] = RX_LEN;
+        
+    pTestCmdRxPltCal->oNvsStruct.Length = NVS_LEN;
+
+    #ifdef TI_TEST
+        os_printf("NVS Length, After -- %d",pTestCmdRxPltCal->oNvsStruct.Length);
+    #endif
+    
+    
+    iBipNvsBuffer[NVS_TYPE_INDEX] 		= NVS_TYPE;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 1]	= 0x03;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 2]	= 0x00;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 3]	= 0x00;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 4]	= 0x00;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 5]	= 0x02;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 6]	= 0xFF;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 7]	= 0xFF;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 8]	= 0x00;
+    iBipNvsBuffer[NVS_TYPE_INDEX + 9]	= 0x00;
+
+    /* Copy the RxBIP data into the pBuf */
+    os_memoryCopy(NULL, pBuf, pTestCmdRxPltCal->oNvsStruct.Buffer, pTestCmdRxPltCal->oNvsStruct.Length);
+
+    #ifdef  TI_TEST
+        os_printf("**********               NVS                     *****************");
+        
+        for (int i = 0; i < iNVSlength; i++)
+        {
+            os_printf("iBipNvsBuffer[%d] = 0x%x",i,((TUint8*)iBipNvsBuffer)[i]);
+        }
+    #endif
+}
+
+/****************************************************************************************************/
+/*  Function:		UpdateNVSFile																	*/
+/****************************************************************************************************/
+/*  Description:	Create NVS file																	*/ 
+/*  Parameters:		updatedProtocol - protocol sending BIP if == NVS_FILE_WRONG_UPDATE				*/
+/*									  will get the previous NVS file								*/
+/*					nvsPtr - tx PTL NVS structure													*/
+/*  Return Value:	True - file created, False - otherwise											*/
+/****************************************************************************************************/
+/*	25.05.2008		Efil	Function Created														*/
+/****************************************************************************************************/
+
+#if 0
+bool TIWha::UpdateNVSFile(const void	*nvsPtr)
+{
+	
+	// read previous NVS
+	nvsFileValid = true;//this->ReadNVSFile(currentNVSbuffer, &lengthOfCurrentNVSBufer);
+	lengthOfCurrentNVSBufer = iNVSlength;
+	currentNVSbuffer = ipNVSbuf;
+
+	txTypeIndexValue = currentNVSbuffer[NVS_PRE_PARAMETERS_LENGTH + NVS_TX_TYPE_INDEX];
+	rxTypeIndexValue = currentNVSbuffer[NVS_PRE_PARAMETERS_LENGTH + NVS_RX_TYPE_INDEX];
+
+	// if read all the parameter (needed) from the previous NVS
+	if (!nvsFileValid									|| 
+		(lengthOfCurrentNVSBufer >= NVS_TOTAL_LENGTH)	||
+		(txTypeIndexValue != eNVS_RADIO_TX_PARAMETERS)	||
+		(rxTypeIndexValue != eNVS_RADIO_RX_PARAMETERS))
+	{
+		os_printf("lengthOfCurrentNVSBufer = %d txTypeIndexValue = %d rxTypeIndexValue = %d",lengthOfCurrentNVSBufer,txTypeIndexValue,rxTypeIndexValue);
+		nvsFileValid = false;
+	}
+	
+	//nvsBinFile = fopen(NVS_FILE_NAME, "wb");
+
+   /* if (NULL == nvsBinFile)
+	{
+		return false;
+	}*/
+
+	// fill MAC Address
+	//FillMACAddressToNVS(nvsBinFile);
+	
+	// fill end burst transaction zeros
+	/*for (index = 0; index < NVS_END_BURST_TRANSACTION_LENGTH; index++)
+	{
+		fwrite(&valueToSet, sizeof(uint8), 1, nvsBinFile);
+	}*/
+
+	// fill zeros to Align TLV start address
+	/*for (index = 0; index < NVS_ALING_TLV_START_ADDRESS_LENGTH; index++)
+	{
+		fwrite(&valueToSet, sizeof(uint8), 1, nvsBinFile);
+	}*/
+
+	// Getting from TX BiP Command
+//	if(updatedProtocol)
+//	{
+		// Fill new TX BiP values
+		FillTXParameterToNVS(currentNVSbuffer,
+			                 nvsPtr);
+		if (nvsFileValid)
+		{
+			// set Parameters of RX from the previous file
+			FillOldRXParameterToNVS(nvsBinFile,
+				                    currentNVSbuffer,
+									lengthOfCurrentNVSBufer);
+		}
+		else
+		{
+			FillDefaultRXParameterToNVS(nvsBinFile);
+		}
+
+//	}
+	// Getting from RX BiP Command
+	else if (NVS_FILE_RX_PARAMETERS_UPDATE == updatedProtocol)
+	{
+		if (nvsFileValid)
+		{
+			// set Parameters of TX from the previous file
+			FillOldTXParameterToNVS(nvsBinFile,
+				                    currentNVSbuffer,
+									lengthOfCurrentNVSBufer);
+		}
+		else
+		{
+			FillDefaultTXParameterToNVS(nvsBinFile);
+		}
+
+		// Fill new RX BiP values 
+		FillRXParameterToNVS(nvsBinFile,
+			                 nvsPtr);
+	
+	}
+	// Getting error from Sending aider TX or RX BiP
+	else  /* NVS_FILE_WRONG_UPDATE == updatedProtocol */
+	{
+		// Fill new TX BiP values
+		FillTXParameterToNVS(nvsBinFile,
+			                 nvsPtr);
+
+		// Fill new RX BiP values 
+		FillRXParameterToNVS(nvsBinFile,
+			                 nvsPtr);
+
+	}
+
+	// Fill the NVS version to the NVS
+	this->FillVersionToNVS(nvsBinFile,
+						   versionStr,
+						   nvsFileValid,
+						   currentNVSbuffer,
+						   lengthOfCurrentNVSBufer);
+
+	// End of NVS
+	this->WriteEndNVSParam(nvsBinFile);
+	
+
+	// close the file
+	fclose(nvsBinFile);
+
+	return true;
+}
+#endif
+/*
+BipRespons(TI_STATUS aStatus, void *pItrBuf)
+Call ConvertBip2Nvs(pItrBuf)
+Call PltResponse
+*/
+
+/** 
+ * \fn     PltResponseCb
+ * \brief  member function.
+ * 
+ * \note    
+ * \param  aStatus - result of sending stop scan command to FW
+ * \param  pItrBuf -  buffer for results
+ * \return  
+ * \sa          TIWHA::Plt
+ */ 
+void TIWha::PltResponseCb ( TI_STATUS aStatus, void *pItrBuf)
+{
+	WHA::TStatus status = ( aStatus == TI_OK ) ? WHA::KSuccess : WHA::KFailed;
+	os_printf("*** PltResponseCb status = %d  ***",status);
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " aStatus = %d ptr = %p plt = %d\n", aStatus, pItrBuf, iTwdCtrl.ePlt);
+
+    #ifdef PLT_TESTER
+        os_printf("*** PltResponseCb  iRealPlt %d ***",iRealPlt);
+        if(iRealPlt)
+        {		
+            if( bErrorIndication == TI_FALSE)
+            {    
+                WhaCb()->CommandResponse(WHA::EWriteMIBResponse,status,iUCommandResponseParams);
+            }
+            #if TI_DBG
+                else
+                {
+                    WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+                }
+            #endif	
+        }
+        else
+        {
+            PltSm (pItrBuf);
+        }
+    #else 
+        /* Note that the results are located in the original given buffer in TIWha::Plt() */
+        #ifdef TI_TEST            
+            if( bErrorIndication == TI_FALSE)
+            {    
+                WhaCb()->CommandResponse(WHA::EWriteMIBResponse,status,iUCommandResponseParams);
+            }
+            #if TI_DBG
+                else
+                {
+                    WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+                }
+            #endif	
+    	#else
+            /* in case of using an external tester we have to return response */            
+            if( bErrorIndication == TI_FALSE)
+            {    
+                WhaCb()->CommandResponse(WHA::EPLtResponse, status, iUCommandResponseParams);
+            }
+            #if TI_DBG
+                else
+                {
+                    WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+                }
+            #endif	
+	    #endif
+    #endif /* PLT_TESTER */
+
+	return;
+}
+
+/** 
+ * \fn     ReadMemResponseCb
+ * \brief  member function.
+ * 
+ * \note    
+ * \param  params - struct of the retrieved results
+ * \return  
+ * \sa          TIWha::WriteMem
+ */ 
+ void TIWha::ReadMemResponseCb (TFwDebugParams* params)
+{
+     TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " p = %p\n",params);
+    
+    #ifdef WRITE_READ_MEM_NEW_API  
+        /* Note that the results are located in the original given buffer in TIWha::ReadMem() */	
+        if( bErrorIndication == TI_FALSE)
+        {    
+            WhaCb()->CommandResponse(WHA::EReadMemoryResponse, WHA::KSuccess, iUCommandResponseParams);		
+        }
+        #if TI_DBG
+            else
+            {
+                WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+            }
+        #endif	
+    #endif
+}
+
+/** 
+ * \fn     WriteMemResponseCb
+ * \brief  member function.
+ * 
+ * \note    
+ * \param  params - struct of the retrieved results
+ * \return  
+ * \sa          TIWha::WriteMem
+ */ 
+void TIWha::WriteMemResponseCb (TFwDebugParams* params)
+{
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " p = %p\n", params);
+
+    #ifdef WRITE_READ_MEM_API  
+        /* Note that the results are located in the original given buffer in TIWha::WriteMem() */
+        if( bErrorIndication == TI_FALSE)
+        {    
+            WhaCb()->CommandResponse(WHA::EWriteMemoryResponse, WHA::KSuccess, iUCommandResponseParams);		
+        }
+        #if TI_DBG
+            else
+            {
+                WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+            }
+        #endif	
+    #endif
+}
+
+
+
+/****************************************************************************************
+ *                        PltPerStartResponse()                            
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::PltPerStartResponseCb ( TUint16 aStatus, void *pItrBuf)
+{   
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+
+    return;
+}
+
+/****************************************************************************************
+ *                        PltPerStopResponse()                                 
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::PltPerStopResponseCb ( TUint16 aStatus, void *pItrBuf)
+{
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+
+    return;
+}
+
+
+/****************************************************************************************
+ *                        PltPerClearResponse()                                 
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::PltPerClearResponseCb ( TUint16 aStatus, void *pItrBuf)
+{
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "\n");
+
+    return;
+}
+
+
+/****************************************************************************************
+ *                        PltPerGetResultResponse()                                 
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::PltPerGetResultResponseCb ( TUint16 aStatus, void *pItrBuf)
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                        PltGainGetResponse()                                 
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::PltGainGetResponseCb ( TUint16 aStatus, void *pItrBuf)
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                        PltGetNVSUpdateBufferResponse()                                 
+ ****************************************************************************************
+DESCRIPTION:    
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::PltGetNVSUpdateBufferResponseCb ( TUint16 aStatus, void *InterrogateParamsBuf)
+{
+    return;
+}
+
+
+/** 
+ * \fn     JoinCompleteCb
+ * \brief  Send Join response with the current power level table
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::JoinCompleteCb ()
+{    
+    /* Tx power level for each radio band  */
+    TFwInfo *pFwInfo = TWD_GetFWInfo (iTwdCtrl.hTWD);
+
+    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "JoinCompleteCb \n");
+
+    /*
+     * Note: Only 2.4 band is supported for power level feedback.
+     */
+    iUCommandResponseParams.iJoinResponse.iMinPowerLevel = 
+		pFwInfo->txPowerTable[RADIO_BAND_2_4_GHZ][MIN_POWER_LEVEL-1] / DBM_TO_TX_POWER_FACTOR;
+    iUCommandResponseParams.iJoinResponse.iMaxPowerLevel= 
+		pFwInfo->txPowerTable[RADIO_BAND_2_4_GHZ][MAX_POWER_LEVEL] / DBM_TO_TX_POWER_FACTOR;
+
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandResponse (WHA::EJoinResponse, WHA::KSuccess, iUCommandResponseParams);		
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+}
+
+/** 
+ * \fn     ReadMIBResponseCb
+ * \brief  member function.
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::ReadMIBResponseCb ( TUint16 aStatus, void *pItrBuf)
+{
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " Mib = %d \n", iTwdCtrl.currentReadMibID);
+    
+    if (aStatus != TI_OK)
+    {
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "GWSI_AdaptCB_ReadMIBResponse: error received from Mail Box on MIB read");
+    }
+
+    /* 
+     * iData points to the pre-allocated ReadMib buffer. This buffer will be filled with the results
+     * in the next ReadMIBXXX functions 
+     */
+    iUCommandResponseParams.iReadMibResponse.iData = (const void*)iReabMibMem;
+    
+    /* Fill in iUCommandResponseParams according to the current MIB */
+    switch (iTwdCtrl.currentReadMibID)
+    {
+    case WHA::KMibDot11StationId:
+        ReadMIBStationIdResponse(aStatus, pItrBuf);
+        break;
+    
+    case WHA::KMibStatisticsTable:
+        ReadMIBstatisticsTableResponse (aStatus, pItrBuf);
+        break;
+    
+    case WHA::KMibCountersTable:
+        ReadMIBcountersTableResponse (aStatus, pItrBuf);
+        break;
+    default:
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "ReadMIBResponse: error unknown MIB = %d", iTwdCtrl.currentReadMibID);
+      
+    }
+
+    /* Send response to upper layer */    
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->CommandResponse(WHA::EReadMIBResponse, (WHA::TStatus)aStatus, iUCommandResponseParams);		
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+}
+
+/** 
+ * \fn     ReadMIBStationIdResponse 
+ * \brief  Copy station ID to iReabMibMem buffer
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::ReadMIBStationIdResponse (TUint16 aStatus, void *pItrBuf)
+{    
+    iUCommandResponseParams.iReadMibResponse.iLength = sizeof(WHA::Sdot11StationId);
+    iUCommandResponseParams.iReadMibResponse.iMib = WHA::KMibDot11StationId;
+    MAC_COPY (iReabMibMem, ((TI_UINT8*)pItrBuf));
+    
+    TRACE6(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",                iReabMibMem[0],iReabMibMem[1],iReabMibMem[2],                iReabMibMem[3],iReabMibMem[4],iReabMibMem[5]);
+}
+
+
+/** 
+ * \fn     ReadMIBstatisticsTableResponse
+ * \brief  Copy statistics table to iReabMibMem buffer
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::ReadMIBstatisticsTableResponse (TUint16 aStatus, void *pItrBuf)
+{
+    WHA::SstatisticsTable *pStatisticsTable = (WHA::SstatisticsTable* )iReabMibMem;
+    ACXRoamingStatisticsTable_t *pRetreivedResult = (ACXRoamingStatisticsTable_t *)pItrBuf;
+
+    pStatisticsTable->iSnr = pRetreivedResult->snrData;
+    /* 
+     * Temporary, use RSSI value instead of RCPI. Make it positive. 
+     * In case the RSSI is positive already (odd but theoretically 
+     * possible result), set it to 0 
+     */
+    if ((pRetreivedResult->rssiData < TIWha_MAX_RSSI_VAL) && (pRetreivedResult->rssiData > TIWha_MIN_RSSI_VAL))
+    {
+        pStatisticsTable->iRcpi = (pRetreivedResult->rssiBeacon - TIWha_MIN_RSSI_VAL) * 2;
+    }
+    else
+    {
+        /* incase that the RSSI value shifted we fixed it to -45db (130 incase of RCPI) */
+        if (pRetreivedResult->rssiData < 0) {
+            pStatisticsTable->iRcpi = 130;
+        }
+        pStatisticsTable->iRcpi = 0;
+    }
+    
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "ReadMIBstatisticsTableResponse:  status = %d SNR=0x%x, RCPI=0x%x\n",          aStatus, pStatisticsTable->iSnr, pStatisticsTable->iRcpi);
+    
+    iUCommandResponseParams.iReadMibResponse.iLength = sizeof(WHA::SstatisticsTable);
+    iUCommandResponseParams.iReadMibResponse.iMib = WHA::KMibStatisticsTable;
+}
+
+
+/** 
+ * \fn     ReadMIBcountersTableResponse
+ * \brief  Copy counters table to iReabMibMem buffer
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::ReadMIBcountersTableResponse (TUint16 aStatus, void *pItrBuf)
+{
+    WHA::ScountersTable       *pCountersTable = (WHA::ScountersTable*)iReabMibMem;
+    ACXErrorCounters_t     *pRetreivedResult = (ACXErrorCounters_t *)pItrBuf;
+
+    pCountersTable->iPlcpError = pRetreivedResult->PLCPErrorCount;
+    pCountersTable->iFcsError = pRetreivedResult->FCSErrorCount;
+
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "ReadMIBcountersTableResponse:  FCSErrorCount = 0x%x, PLCPErrorCount = 0x%x \n",         pCountersTable->iFcsError, pCountersTable->iPlcpError);
+
+    iUCommandResponseParams.iReadMibResponse.iLength = sizeof(WHA::SstatisticsTable);
+    iUCommandResponseParams.iReadMibResponse.iMib = WHA::KMibCountersTable;
+}
+
+
+/****************************************************************************************
+ *                        ReadMIBBtCoexParamsResponse()                    *
+ ****************************************************************************************
+DESCRIPTION:    result of Read counters Table
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::ReadMIBBtCoexParamsResponse (TUint16 aStatus, void *pItrBuf)
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                        ReadMIBVersion()                                 *
+ ****************************************************************************************
+DESCRIPTION:    result of Read counters Table
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::ReadMIBVersion (TUint16 aStatus, void *pItrBuf)
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                        LostBssIndication()                              *
+ ****************************************************************************************
+DESCRIPTION:    LostBss Event Callback
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::LostBssIndicationCb ()
+{
+	WHA::UIndicationParams	*pParams = NULL;
+    
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->Indication(WHA::EBssLost,*pParams);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+
+    #ifdef TI_DBG
+        WLAN_OS_REPORT(("TIWha::LostBssIndicationCb () --"));
+    #endif
+}
+
+
+/****************************************************************************************
+ *                        RegainBssIndication()                            *
+ ****************************************************************************************
+DESCRIPTION:    RegainBss Event Callback
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::RegainBssIndicationCb ()
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                        btCoexSenseIndication()                          *
+ ****************************************************************************************
+DESCRIPTION:    Bt Coexistence Sense CB (In auto mode: whether we are active or not) 
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::btCoexSenseIndicationCb ( TUint8* buffer, TUint32 len)
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                        btCoexProtectiveIndication()                     *
+ ****************************************************************************************
+DESCRIPTION:    Bt Coexistence Protective mode CB (whether BT is in protective mode) 
+
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::btCoexProtectiveIndicationCb ( TUint8* buffer, TUint32 len)
+{
+    return;
+}
+
+
+/****************************************************************************************
+ *                        btCoexAvalancheIndication()                      *
+ ****************************************************************************************
+DESCRIPTION:    Bt Coexistence avalanche CB (Indicate that the quality of connection with the AP is 
+                reducing and we should reconnect) 
+INPUT:          
+
+OUTPUT:
+
+RETURN:         
+
+************************************************************************/
+void TIWha::btCoexAvalancheIndicationCb ( TUint8* buffer, TUint32 len)
+{
+    return;
+}
+
+
+/****************************************************************************
+ *                      TWD_StatisticsReadCB ()
+ ****************************************************************************
+ * DESCRIPTION: Interrogate Statistics from the wlan hardware
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+void TIWha::TWD_AvrRssiReadCB (TI_HANDLE hCb, TI_UINT16 MboxStatus, ACXRoamingStatisticsTable_t* roamingStatistics)
+{
+	/* Call MIB Response befor printing to release system while traffic */	
+    if( bErrorIndication == TI_FALSE)
+    {    
+        ((TIWha*)(hCb))->WhaCb()->CommandResponse(WHA::EWriteMIBResponse,TI_OK,((TIWha*)(hCb))->iUCommandResponseParams);    
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif      
+
+    #if TI_DBG
+        WLAN_OS_REPORT(("Avr beacon Rssi = %d\n", roamingStatistics->rssiBeacon));
+        WLAN_OS_REPORT(("Avr data Rssi = %d\n", roamingStatistics->rssiData));
+    #endif	
+}
+
+
+
+/****************************************************************************
+ *                      TWD_StatisticsReadCB ()
+ ****************************************************************************
+ * DESCRIPTION: Interrogate Statistics from the wlan hardware
+ *
+ * INPUTS:  None
+ *
+ * OUTPUT:  None
+ *
+ * RETURNS: TI_OK or TI_NOK
+ ****************************************************************************/
+void TIWha::TWD_StatisticsReadCB (TI_HANDLE hCb, TI_UINT16 MboxStatus, ACXStatistics_t* pElem)
+{
+	/* Call MIB Response befor printing to release system while traffic */	
+    if( bErrorIndication == TI_FALSE)
+    {    
+        ((TIWha*)(hCb))->WhaCb()->CommandResponse(WHA::EWriteMIBResponse,TI_OK,((TIWha*)(hCb))->iUCommandResponseParams);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif      
+            
+    /* 
+     *  Handle FW statistics endianess
+     *  ==============================
+     */
+
+    /* Ring */
+    pElem->ringStat.numOfTxProcs       = ENDIAN_HANDLE_LONG(pElem->ringStat.numOfTxProcs);
+    pElem->ringStat.numOfPreparedDescs = ENDIAN_HANDLE_LONG(pElem->ringStat.numOfPreparedDescs);
+    pElem->ringStat.numOfTxXfr         = ENDIAN_HANDLE_LONG(pElem->ringStat.numOfTxXfr);
+    pElem->ringStat.numOfTxDma         = ENDIAN_HANDLE_LONG(pElem->ringStat.numOfTxDma);
+    pElem->ringStat.numOfTxCmplt       = ENDIAN_HANDLE_LONG(pElem->ringStat.numOfTxCmplt);
+    pElem->ringStat.numOfRxProcs       = ENDIAN_HANDLE_LONG(pElem->ringStat.numOfRxProcs);
+    pElem->ringStat.numOfRxData        = ENDIAN_HANDLE_LONG(pElem->ringStat.numOfRxData);
+
+    /* Debug */
+    pElem->debug.debug1                = ENDIAN_HANDLE_LONG(pElem->debug.debug1);
+    pElem->debug.debug2                = ENDIAN_HANDLE_LONG(pElem->debug.debug2);
+    pElem->debug.debug3                = ENDIAN_HANDLE_LONG(pElem->debug.debug3);
+    pElem->debug.debug4                = ENDIAN_HANDLE_LONG(pElem->debug.debug4);
+    pElem->debug.debug5                = ENDIAN_HANDLE_LONG(pElem->debug.debug5);
+    pElem->debug.debug6                = ENDIAN_HANDLE_LONG(pElem->debug.debug6);
+
+    /* Isr */
+    pElem->isr.IRQs                    = ENDIAN_HANDLE_LONG(pElem->isr.IRQs);
+
+    /* Rx */
+    pElem->rx.RxDroppedFrame           = ENDIAN_HANDLE_LONG(pElem->rx.RxDroppedFrame);
+	pElem->rx.RxCompleteDroppedFrame   = ENDIAN_HANDLE_LONG(pElem->rx.RxCompleteDroppedFrame);
+    
+    pElem->rx.RxHdrOverflow            = ENDIAN_HANDLE_LONG(pElem->rx.RxHdrOverflow);
+    pElem->rx.RxHWStuck                = ENDIAN_HANDLE_LONG(pElem->rx.RxHWStuck);
+    pElem->rx.RxOutOfMem               = ENDIAN_HANDLE_LONG(pElem->rx.RxOutOfMem);
+    pElem->rx.RxAllocFrame             = ENDIAN_HANDLE_LONG(pElem->rx.RxAllocFrame);
+
+    /* Tx */
+    pElem->tx.numOfTxTemplatePrepared  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxTemplatePrepared);
+	pElem->tx.numOfTxDataPrepared  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxDataPrepared);
+	pElem->tx.numOfTxTemplateProgrammed = ENDIAN_HANDLE_LONG(pElem->tx.numOfTxTemplateProgrammed);
+	pElem->tx.numOfTxDataProgrammed  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxDataProgrammed);
+	pElem->tx.numOfTxBurstProgrammed  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxBurstProgrammed);
+	pElem->tx.numOfTxStarts  			= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxStarts);
+	pElem->tx.numOfTxImmResp  			= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxImmResp);
+	pElem->tx.numOfTxStartTempaltes  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxStartTempaltes);
+	pElem->tx.numOfTxStartIntTemplate  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxStartIntTemplate);
+	pElem->tx.numOfTxStartFwGen  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxStartFwGen);
+	pElem->tx.numOfTxStartData  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxStartData);
+	pElem->tx.numOfTxStartNullFrame  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxStartNullFrame);
+	pElem->tx.numOfTxExch  				= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxExch);
+	pElem->tx.numOfTxRetryTemplate  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxRetryTemplate);
+	pElem->tx.numOfTxRetryData  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxRetryData);
+	pElem->tx.numOfTxExchPending  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxExchPending);
+	pElem->tx.numOfTxExchExpiry  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxExchExpiry);
+	pElem->tx.numOfTxExchMismatch  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxExchMismatch);
+	pElem->tx.numOfTxDoneTemplate  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxDoneTemplate);
+	pElem->tx.numOfTxDoneData  			= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxDoneData);
+	pElem->tx.numOfTxDoneIntTemplate  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxDoneIntTemplate);
+	pElem->tx.numOfTxPreXfr  			= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxPreXfr);
+	pElem->tx.numOfTxXfr  				= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxXfr);
+	pElem->tx.numOfTxXfrOutOfMem  		= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxXfrOutOfMem);
+	pElem->tx.numOfTxDmaProgrammed  	= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxDmaProgrammed);
+	pElem->tx.numOfTxDmaDone  			= ENDIAN_HANDLE_LONG(pElem->tx.numOfTxDmaDone);
+
+    /* Dma */
+    pElem->dma.RxDMAErrors             = ENDIAN_HANDLE_LONG(pElem->dma.RxDMAErrors);
+    pElem->dma.TxDMAErrors             = ENDIAN_HANDLE_LONG(pElem->dma.TxDMAErrors);
+
+    /* Wep */
+    pElem->wep.WepAddrKeyCount         = ENDIAN_HANDLE_LONG(pElem->wep.WepAddrKeyCount);
+    pElem->wep.WepDefaultKeyCount      = ENDIAN_HANDLE_LONG(pElem->wep.WepDefaultKeyCount);
+    pElem->wep.WepKeyNotFound          = ENDIAN_HANDLE_LONG(pElem->wep.WepKeyNotFound);
+    pElem->wep.WepDecryptFail          = ENDIAN_HANDLE_LONG(pElem->wep.WepDecryptFail);
+    
+    /* AES */
+    pElem->aes.AesEncryptFail          = ENDIAN_HANDLE_LONG(pElem->aes.AesEncryptFail);     
+    pElem->aes.AesDecryptFail          = ENDIAN_HANDLE_LONG(pElem->aes.AesDecryptFail);     
+    pElem->aes.AesEncryptPackets       = ENDIAN_HANDLE_LONG(pElem->aes.AesEncryptPackets);  
+    pElem->aes.AesDecryptPackets       = ENDIAN_HANDLE_LONG(pElem->aes.AesDecryptPackets);  
+    pElem->aes.AesEncryptInterrupt     = ENDIAN_HANDLE_LONG(pElem->aes.AesEncryptInterrupt);
+    pElem->aes.AesDecryptInterrupt     = ENDIAN_HANDLE_LONG(pElem->aes.AesDecryptInterrupt);
+
+    /* Events */
+    pElem->event.calibration           = ENDIAN_HANDLE_LONG(pElem->event.calibration);
+    pElem->event.rxMismatch            = ENDIAN_HANDLE_LONG(pElem->event.rxMismatch); 
+    pElem->event.rxMemEmpty            = ENDIAN_HANDLE_LONG(pElem->event.rxMemEmpty); 
+
+    /* PS */
+    pElem->pwr.MissingBcnsCnt          	= ENDIAN_HANDLE_LONG(pElem->pwr.MissingBcnsCnt);
+    pElem->pwr.RcvdBeaconsCnt          	= ENDIAN_HANDLE_LONG(pElem->pwr.RcvdBeaconsCnt);
+    pElem->pwr.ConnectionOutOfSync     	= ENDIAN_HANDLE_LONG(pElem->pwr.ConnectionOutOfSync);
+    pElem->pwr.ContMissBcnsSpread[0]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[0]);
+    pElem->pwr.ContMissBcnsSpread[1]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[1]);
+    pElem->pwr.ContMissBcnsSpread[2]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[2]);
+    pElem->pwr.ContMissBcnsSpread[3]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[3]);
+    pElem->pwr.ContMissBcnsSpread[4]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[4]);
+    pElem->pwr.ContMissBcnsSpread[5]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[5]);
+    pElem->pwr.ContMissBcnsSpread[6]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[6]);
+    pElem->pwr.ContMissBcnsSpread[7]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[7]);
+    pElem->pwr.ContMissBcnsSpread[8]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[8]);
+    pElem->pwr.ContMissBcnsSpread[9]   	= ENDIAN_HANDLE_LONG(pElem->pwr.ContMissBcnsSpread[9]);
+
+    pElem->ps.psPollTimeOuts           	= ENDIAN_HANDLE_LONG(pElem->ps.psPollTimeOuts);
+    pElem->ps.upsdTimeOuts             	= ENDIAN_HANDLE_LONG(pElem->ps.upsdTimeOuts);
+    pElem->ps.upsdMaxAPturn            	= ENDIAN_HANDLE_LONG(pElem->ps.upsdMaxAPturn); 
+    pElem->ps.psPollMaxAPturn          	= ENDIAN_HANDLE_LONG(pElem->ps.psPollMaxAPturn);
+    pElem->ps.psPollUtilization        	= ENDIAN_HANDLE_LONG(pElem->ps.psPollUtilization);
+    pElem->ps.upsdUtilization          	= ENDIAN_HANDLE_LONG(pElem->ps.upsdUtilization);
+
+	pElem->rxFilter.arpFilter		   	= ENDIAN_HANDLE_LONG(pElem->rxFilter.arpFilter);
+	pElem->rxFilter.beaconFilter	   	= ENDIAN_HANDLE_LONG(pElem->rxFilter.beaconFilter);
+	pElem->rxFilter.dataFilter		   	= ENDIAN_HANDLE_LONG(pElem->rxFilter.dataFilter);
+	pElem->rxFilter.dupFilter		   	= ENDIAN_HANDLE_LONG(pElem->rxFilter.dupFilter);
+	pElem->rxFilter.MCFilter		   	= ENDIAN_HANDLE_LONG(pElem->rxFilter.MCFilter);
+	pElem->rxFilter.ibssFilter		   	= ENDIAN_HANDLE_LONG(pElem->rxFilter.ibssFilter);
+
+	pElem->radioCal.calStateFail	   	= ENDIAN_HANDLE_LONG(pElem->radioCal.calStateFail);
+	pElem->radioCal.initCalTotal	   	= ENDIAN_HANDLE_LONG(pElem->radioCal.initCalTotal);
+	pElem->radioCal.initRadioBandsFail 	= ENDIAN_HANDLE_LONG(pElem->radioCal.initRadioBandsFail);
+	pElem->radioCal.initRxIqMmFail		= ENDIAN_HANDLE_LONG(pElem->radioCal.initRxIqMmFail);
+	pElem->radioCal.initSetParams		= ENDIAN_HANDLE_LONG(pElem->radioCal.initSetParams);
+	pElem->radioCal.initTxClpcFail		= ENDIAN_HANDLE_LONG(pElem->radioCal.initTxClpcFail);
+	pElem->radioCal.tuneCalTotal		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneCalTotal);
+	pElem->radioCal.tuneDrpwChanTune	= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwChanTune);
+	pElem->radioCal.tuneDrpwLnaTank		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwLnaTank);
+	pElem->radioCal.tuneDrpwPdBufFail	= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwPdBufFail);
+	pElem->radioCal.tuneDrpwRTrimFail	= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwRTrimFail);
+	pElem->radioCal.tuneDrpwRxDac		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwRxDac);
+	pElem->radioCal.tuneDrpwRxIf2Gain	= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwRxIf2Gain);
+	pElem->radioCal.tuneDrpwRxTxLpf		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwRxTxLpf);
+	pElem->radioCal.tuneDrpwTaCal		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwTaCal);
+	pElem->radioCal.tuneDrpwTxMixFreqFail = ENDIAN_HANDLE_LONG(pElem->radioCal.tuneDrpwTxMixFreqFail);
+	pElem->radioCal.tuneRxAnaDcFail		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneRxAnaDcFail);
+	pElem->radioCal.tuneRxIqMmFail		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneRxIqMmFail);
+	pElem->radioCal.tuneTxClpcFail		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneTxClpcFail);
+	pElem->radioCal.tuneTxIqMmFail		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneTxIqMmFail);
+	pElem->radioCal.tuneTxLOLeakFail	= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneTxLOLeakFail);
+	pElem->radioCal.tuneTxPdetFail		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneTxPdetFail);
+	pElem->radioCal.tuneTxPPAFail		= ENDIAN_HANDLE_LONG(pElem->radioCal.tuneTxPPAFail);
+
+    #if TI_DBG
+        /* 
+         *  Print FW statistics 
+         *  ===================
+         */
+    
+        /* Ring */
+        WLAN_OS_REPORT(("------  Ring statistics  -------------------\n"));
+        WLAN_OS_REPORT(("numOfTxProcs       = %d\n", pElem->ringStat.numOfTxProcs));
+        WLAN_OS_REPORT(("numOfPreparedDescs = %d\n", pElem->ringStat.numOfPreparedDescs));
+        WLAN_OS_REPORT(("numOfTxXfr         = %d\n", pElem->ringStat.numOfTxXfr));
+        WLAN_OS_REPORT(("numOfTxDma         = %d\n", pElem->ringStat.numOfTxDma));
+        WLAN_OS_REPORT(("numOfTxCmplt       = %d\n", pElem->ringStat.numOfTxCmplt));
+        WLAN_OS_REPORT(("numOfRxProcs       = %d\n", pElem->ringStat.numOfRxProcs));
+        WLAN_OS_REPORT(("numOfRxData        = %d\n", pElem->ringStat.numOfRxData));
+    
+        /* Debug */
+        WLAN_OS_REPORT(("------  Debug statistics  -------------------\n"));
+        WLAN_OS_REPORT(("debug1 = %d\n", pElem->debug.debug1));
+        WLAN_OS_REPORT(("debug2 = %d\n", pElem->debug.debug2));
+        WLAN_OS_REPORT(("debug3 = %d\n", pElem->debug.debug3));
+        WLAN_OS_REPORT(("debug4 = %d\n", pElem->debug.debug4));
+        WLAN_OS_REPORT(("debug5 = %d\n", pElem->debug.debug5));
+        WLAN_OS_REPORT(("debug6 = %d\n", pElem->debug.debug6));
+    
+        /* Isr */
+        WLAN_OS_REPORT(("------  Isr statistics  -------------------\n"));
+        WLAN_OS_REPORT(("IRQs = %d\n", pElem->isr.IRQs));
+    
+        /* Rx */
+        WLAN_OS_REPORT(("------  Rx  statistics  -------------------\n"));
+        WLAN_OS_REPORT(("RxDroppedFrame    = %d\n", pElem->rx.RxDroppedFrame));
+        WLAN_OS_REPORT(("RxHdrOverflow     = %d\n", pElem->rx.RxHdrOverflow));
+        WLAN_OS_REPORT(("RxHWStuck         = %d\n", pElem->rx.RxHWStuck));
+        WLAN_OS_REPORT(("RxOutOfMem        = %d\n", pElem->rx.RxOutOfMem));
+        WLAN_OS_REPORT(("RxAllocFrame      = %d\n", pElem->rx.RxAllocFrame));
+    	WLAN_OS_REPORT(("pElem->rx.RxCompleteDroppedFrame = %d\n", pElem->rx.RxCompleteDroppedFrame)); 
+    
+        WLAN_OS_REPORT(("------  RxFilters statistics  --------------\n"));
+    	WLAN_OS_REPORT(("arpFilter    = %d\n", pElem->rxFilter.arpFilter));
+    	WLAN_OS_REPORT(("beaconFilter = %d\n", pElem->rxFilter.beaconFilter));
+    	WLAN_OS_REPORT(("dataFilter   = %d\n", pElem->rxFilter.dataFilter));
+    	WLAN_OS_REPORT(("dupFilter    = %d\n", pElem->rxFilter.dupFilter));
+    	WLAN_OS_REPORT(("MCFilter     = %d\n", pElem->rxFilter.MCFilter));
+    	WLAN_OS_REPORT(("ibssFilter   = %d\n", pElem->rxFilter.ibssFilter));
+    
+        /* Tx */
+        WLAN_OS_REPORT(("------  Tx  statistics  -------------------\n"));
+    	WLAN_OS_REPORT(("numOfTxTemplatePrepared    = %d\n", pElem->tx.numOfTxTemplatePrepared));
+    	WLAN_OS_REPORT(("numOfTxDataPrepared        = %d\n", pElem->tx.numOfTxDataPrepared));
+    	WLAN_OS_REPORT(("numOfTxTemplateProgrammed  = %d\n", pElem->tx.numOfTxTemplateProgrammed));
+    	WLAN_OS_REPORT(("numOfTxDataProgrammed      = %d\n", pElem->tx.numOfTxDataProgrammed));
+    	WLAN_OS_REPORT(("numOfTxBurstProgrammed     = %d\n", pElem->tx.numOfTxBurstProgrammed));
+    	WLAN_OS_REPORT(("numOfTxStarts              = %d\n", pElem->tx.numOfTxStarts));
+    	WLAN_OS_REPORT(("numOfTxImmResp             = %d\n", pElem->tx.numOfTxImmResp));
+    	WLAN_OS_REPORT(("numOfTxStartTempaltes      = %d\n", pElem->tx.numOfTxStartTempaltes));
+    	WLAN_OS_REPORT(("numOfTxStartIntTemplate    = %d\n", pElem->tx.numOfTxStartIntTemplate));
+    	WLAN_OS_REPORT(("numOfTxStartFwGen          = %d\n", pElem->tx.numOfTxStartFwGen));
+    	WLAN_OS_REPORT(("numOfTxStartData           = %d\n", pElem->tx.numOfTxStartData));
+    	WLAN_OS_REPORT(("numOfTxStartNullFrame      = %d\n", pElem->tx.numOfTxStartNullFrame));
+    	WLAN_OS_REPORT(("numOfTxExch                = %d\n", pElem->tx.numOfTxExch));
+    	WLAN_OS_REPORT(("numOfTxRetryTemplate       = %d\n", pElem->tx.numOfTxRetryTemplate));
+    	WLAN_OS_REPORT(("numOfTxRetryData           = %d\n", pElem->tx.numOfTxRetryData));
+    	WLAN_OS_REPORT(("numOfTxExchPending         = %d\n", pElem->tx.numOfTxExchPending));
+    	WLAN_OS_REPORT(("numOfTxExchExpiry          = %d\n", pElem->tx.numOfTxExchExpiry));
+    	WLAN_OS_REPORT(("numOfTxExchMismatch        = %d\n", pElem->tx.numOfTxExchMismatch));
+    	WLAN_OS_REPORT(("numOfTxDoneTemplate        = %d\n", pElem->tx.numOfTxDoneTemplate));
+    	WLAN_OS_REPORT(("numOfTxDoneData            = %d\n", pElem->tx.numOfTxDoneData));
+    	WLAN_OS_REPORT(("numOfTxDoneIntTemplate     = %d\n", pElem->tx.numOfTxDoneIntTemplate));
+    	WLAN_OS_REPORT(("numOfTxPreXfr              = %d\n", pElem->tx.numOfTxPreXfr));
+    	WLAN_OS_REPORT(("numOfTxXfr                 = %d\n", pElem->tx.numOfTxXfr));
+    	WLAN_OS_REPORT(("numOfTxXfrOutOfMem         = %d\n", pElem->tx.numOfTxXfrOutOfMem));
+    	WLAN_OS_REPORT(("numOfTxDmaProgrammed       = %d\n", pElem->tx.numOfTxDmaProgrammed));
+    	WLAN_OS_REPORT(("numOfTxDmaDone             = %d\n", pElem->tx.numOfTxDmaDone));
+    
+        /* Dma */
+        WLAN_OS_REPORT(("------  Dma  statistics  -------------------\n"));
+        WLAN_OS_REPORT(("RxDMAErrors  = %d\n", pElem->dma.RxDMAErrors));
+        WLAN_OS_REPORT(("TxDMAErrors  = %d\n", pElem->dma.TxDMAErrors));
+    
+        /* Wep */
+        WLAN_OS_REPORT(("------  Wep statistics  -------------------\n"));
+        WLAN_OS_REPORT(("WepAddrKeyCount   = %d\n", pElem->wep.WepAddrKeyCount));
+        WLAN_OS_REPORT(("WepDefaultKeyCount= %d\n", pElem->wep.WepDefaultKeyCount));
+        WLAN_OS_REPORT(("WepKeyNotFound    = %d\n", pElem->wep.WepKeyNotFound));
+        WLAN_OS_REPORT(("WepDecryptFail    = %d\n", pElem->wep.WepDecryptFail));
+    
+        /* AES */
+        WLAN_OS_REPORT(("------------  AES Statistics --------------\n"));
+        WLAN_OS_REPORT(("AesEncryptFail      = %d\n", pElem->aes.AesEncryptFail));
+        WLAN_OS_REPORT(("AesDecryptFail      = %d\n", pElem->aes.AesDecryptFail));
+        WLAN_OS_REPORT(("AesEncryptPackets   = %d\n", pElem->aes.AesEncryptPackets));
+        WLAN_OS_REPORT(("AesDecryptPackets   = %d\n", pElem->aes.AesDecryptPackets));
+        WLAN_OS_REPORT(("AesEncryptInterrupt = %d\n", pElem->aes.AesEncryptInterrupt));
+        WLAN_OS_REPORT(("AesDecryptInterrupt = %d\n", pElem->aes.AesDecryptInterrupt));
+    
+        /* Events */
+        WLAN_OS_REPORT(("------  Events  -------------------\n"));
+        WLAN_OS_REPORT(("Calibration   = %d\n", pElem->event.calibration));
+        WLAN_OS_REPORT(("rxMismatch    = %d\n", pElem->event.rxMismatch));
+        WLAN_OS_REPORT(("rxMemEmpty    = %d\n", pElem->event.rxMemEmpty));
+    
+       /* PsPoll/Upsd */ 
+        WLAN_OS_REPORT(("----------- PsPoll / Upsd -----------\n"));
+        WLAN_OS_REPORT(("psPollTimeOuts     = %d\n",pElem->ps.psPollTimeOuts));
+        WLAN_OS_REPORT(("upsdTimeOuts       = %d\n",pElem->ps.upsdTimeOuts));
+        WLAN_OS_REPORT(("upsdMaxAPturn      = %d\n",pElem->ps.upsdMaxAPturn));
+        WLAN_OS_REPORT(("psPollMaxAPturn    = %d\n",pElem->ps.psPollMaxAPturn));
+        WLAN_OS_REPORT(("psPollUtilization  = %d\n",pElem->ps.psPollUtilization));
+        WLAN_OS_REPORT(("upsdUtilization    = %d\n",pElem->ps.upsdUtilization));
+    
+    
+    
+    	/* Calibration */
+    	WLAN_OS_REPORT(("----------- Calibrations -------------\n"));
+    	WLAN_OS_REPORT(("calStateFail         	= %d\n", pElem->radioCal.calStateFail));
+    	WLAN_OS_REPORT(("initCalTotal   		= %d\n", pElem->radioCal.initCalTotal));   	 
+    	WLAN_OS_REPORT(("initRadioBandsFail   	= %d\n", pElem->radioCal.initRadioBandsFail));
+    	WLAN_OS_REPORT(("initRxIqMmFail   		= %d\n", pElem->radioCal.initRxIqMmFail));
+    	WLAN_OS_REPORT(("initSetParams   		= %d\n", pElem->radioCal.initSetParams));
+    	WLAN_OS_REPORT(("initTxClpcFail   		= %d\n", pElem->radioCal.initTxClpcFail));	
+    	WLAN_OS_REPORT(("tuneCalTotal   		= %d\n", pElem->radioCal.tuneCalTotal));	
+    	WLAN_OS_REPORT(("tuneDrpwChanTune		= %d\n", pElem->radioCal.tuneDrpwChanTune));
+    	WLAN_OS_REPORT(("tuneDrpwLnaTank		= %d\n", pElem->radioCal.tuneDrpwLnaTank));
+    	WLAN_OS_REPORT(("tuneDrpwPdBufFail		= %d\n", pElem->radioCal.tuneDrpwPdBufFail));
+    	WLAN_OS_REPORT(("tuneDrpwRTrimFail		= %d\n", pElem->radioCal.tuneDrpwRTrimFail));
+    	WLAN_OS_REPORT(("tuneDrpwRxDac			= %d\n", pElem->radioCal.tuneDrpwRxDac));
+    	WLAN_OS_REPORT(("tuneDrpwRxIf2Gain		= %d\n", pElem->radioCal.tuneDrpwRxIf2Gain));
+    	WLAN_OS_REPORT(("tuneDrpwRxTxLpf		= %d\n", pElem->radioCal.tuneDrpwRxTxLpf));
+    	WLAN_OS_REPORT(("tuneDrpwTaCal			= %d\n", pElem->radioCal.tuneDrpwTaCal));
+    	WLAN_OS_REPORT(("tuneDrpwTxMixFreqFail	= %d\n", pElem->radioCal.tuneDrpwTxMixFreqFail));
+    	WLAN_OS_REPORT(("tuneRxAnaDcFail   		= %d\n", pElem->radioCal.tuneRxAnaDcFail));		
+    	WLAN_OS_REPORT(("tuneRxIqMmFail   		= %d\n", pElem->radioCal.tuneRxIqMmFail));
+    	WLAN_OS_REPORT(("tuneTxClpcFail   		= %d\n", pElem->radioCal.tuneTxClpcFail));
+    	WLAN_OS_REPORT(("tuneTxIqMmFail   		= %d\n", pElem->radioCal.tuneTxIqMmFail));
+    	WLAN_OS_REPORT(("tuneTxLOLeakFail   	= %d\n", pElem->radioCal.tuneTxLOLeakFail));
+    	WLAN_OS_REPORT(("tuneTxPdetFail   		= %d\n", pElem->radioCal.tuneTxPdetFail));
+    	WLAN_OS_REPORT(("tuneTxPPAFail   		= %d\n", pElem->radioCal.tuneTxPPAFail)); 
+    
+    
+    
+    	/* Power Save Counters */
+        WLAN_OS_REPORT(("------  Power management  ----------\n"));
+        if(pElem->pwr.RcvdBeaconsCnt != 0)
+        {
+            WLAN_OS_REPORT(("MissingBcnsCnt    = %d (percentage <= %d) \n", 
+                    pElem->pwr.MissingBcnsCnt,
+                    ((pElem->pwr.MissingBcnsCnt * 100) / (pElem->pwr.RcvdBeaconsCnt + pElem->pwr.MissingBcnsCnt)) ));
+        }
+        else
+        {
+            WLAN_OS_REPORT(("MissingBcnsCnt    = %d (percentage = 0) \n", pElem->pwr.MissingBcnsCnt));
+        }
+        WLAN_OS_REPORT(("RcvdBeaconsCnt    = %d\n", pElem->pwr.RcvdBeaconsCnt));
+        WLAN_OS_REPORT(("ConnectionOutOfSync    = %d\n\n", pElem->pwr.ConnectionOutOfSync));
+        WLAN_OS_REPORT(("Single Missed Beacon           = %d\n", (pElem->pwr.ContMissBcnsSpread[0] & 0xFFFF)));
+        WLAN_OS_REPORT(("2 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[1] & 0xFFFF)));
+        WLAN_OS_REPORT(("3 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[2] & 0xFFFF)));
+        WLAN_OS_REPORT(("4 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[3] & 0xFFFF)));
+        WLAN_OS_REPORT(("5 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[4] & 0xFFFF)));
+        WLAN_OS_REPORT(("6 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[5] & 0xFFFF)));
+        WLAN_OS_REPORT(("7 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[6] & 0xFFFF)));
+        WLAN_OS_REPORT(("8 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[7] & 0xFFFF)));
+        WLAN_OS_REPORT(("9 Continuous Missed Beacons    = %d\n", (pElem->pwr.ContMissBcnsSpread[8] & 0xFFFF)));
+        WLAN_OS_REPORT((">=10 Continuous Missed Beacons = %d\n\n", (pElem->pwr.ContMissBcnsSpread[9] & 0xFFFF)));
+    
+        WLAN_OS_REPORT(("RcvdAwakeBeaconsCnt    = %d\n", pElem->pwr.RcvdAwakeBeaconsCnt));
+        WLAN_OS_REPORT(("Single Missed Beacon        [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[0] >> 16)));
+        WLAN_OS_REPORT(("2 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[1] >> 16)));
+        WLAN_OS_REPORT(("3 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[2] >> 16)));
+        WLAN_OS_REPORT(("4 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[3] >> 16)));
+        WLAN_OS_REPORT(("5 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[4] >> 16)));
+        WLAN_OS_REPORT(("6 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[5] >> 16)));
+        WLAN_OS_REPORT(("7 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[6] >> 16)));
+        WLAN_OS_REPORT(("8 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[7] >> 16)));
+        WLAN_OS_REPORT(("9 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[8] >> 16)));
+        WLAN_OS_REPORT((">=10 Continuous Missed Beacons [Awake] = %d\n", (pElem->pwr.ContMissBcnsSpread[9] >> 16)));
+    #endif    
+}
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaDef.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,506 @@
+/*
+ * TIWhaDef.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:      TIWhaDef.H*/
+/**/
+/* Purpose:     This module defines unified interface to use by the PhysicalChannel*/
+/**/
+/*--------------------------------------------------------------------------*/
+
+#ifndef _TIWhaDef_
+#define _TIWhaDef_
+
+#include "external_inc.h"
+#include "gendebug.h"
+
+#include <wlanwha.h>
+#include <wlanwha_types.h>
+#include <wlanspia.h>
+#include <wlanhpa.h>
+#include <wlanosa.h>
+
+/*******************************************************************************
+ * stuff for C file linking.                                                   *
+ *******************************************************************************/
+extern "C" 
+{
+#include "report.h"
+#include "tidef.h"
+#include "osApi.h"
+#include "TWDriverInternal.h"
+#include "TWDriverRate.h"
+#include "TWDriver.h"
+#include "802_11Defs.h" 
+#include "coreDefaultParams.h"
+}
+
+/* Device Name */
+
+#define DEVICE_NAME _L("wlan.phys")
+
+
+#include "TIWhaPLTDef.h"
+
+#ifdef GEM_SUPPORT
+    #include "TIWhaGemDef.h"
+#endif /* GEM_SUPPORT */
+
+
+/****************************** DEBUG MIBS *****************************************/
+#ifdef TI_TEST
+    #define SET_POWER_LEVEL             0x2003
+    #define TWD_FW_PRINT_STATISTICS     0x3100
+    #define QOS_CHANGE_QEUEU            0x4001
+    #define EMIBPltTest                 0x3001
+    #define AVR_RSSI                    0x3101
+#endif /* TI_TEST */
+/***********************************************************************************/
+
+
+/****************************************************************************
+*       Constants                                                           *
+*****************************************************************************/
+
+#define MAX_XFER_WAITING_PACKETS    50
+
+/* Stalling the CPU for 400Ms in case of a failure */
+#define STALL_ON_FAILURE 400000
+
+#define STALL_ON_RECONNECT 1000
+
+#ifdef ENHANCE_PROB_SCAN
+    #define PB_FACTOR_FOR_SG    3
+    #define MIN_TIME_FACTOR_FOR_SG  2
+    #define MAX_TIME_FACTOR_FOR_SG  2
+#endif
+
+/* Maximum num of ssid in scan*/
+#define TIWha_SCAN_MAX_SSID_NUM                                  1
+
+/* Max size of ReadMibResponse according to the structures that are used for the Mib results */
+#define TIWha_MAX_READ_MIB_BUFFER \
+    TI_MAX(sizeof(WHA::SstatisticsTable),TI_MAX (sizeof(WHA::Sdot11StationId),sizeof(WHA::SstatisticsTable)))
+
+/* Maximum driver version length */
+#define TIWha_MAX_DRV_VER_LEN                                    64
+
+/* Maximum firmware version length */
+#define TIWha_MAX_FRM_VER_LEN                                    32
+
+#define TIWha_NO_BUFFER_ALIGNMENT_SETTING                        1
+
+/* TIWha max table size of the security keys */
+#define TIWha_MAX_PRIVACY_KEY_INDEX                              9
+
+#define TIWha_MAX_SSID_LEN                                       32
+
+#define TIWha_MAX_RCPI_VAL                                       220
+
+#define TIWha_MIN_RCPI_VAL                                       0
+
+#define TIWha_MIN_RSSI_VAL                                       -110
+
+#define TIWha_MAX_RSSI_VAL                                       -45
+
+#define TRIGGER_LOW_RSSI_PACING                                  1000
+
+#define TIWha_DEFAULT_DTIM_PERIOD                   0x3
+
+/* An extra 4 bytes for alginment */
+#define PAYLOAD_ALIGN_PAD_BYTES     4
+
+/* 
+ * TIWha supported capabilities bit mask definition. 
+ * The bit mask is held in the SSettings table                                                      
+ */
+#define TIWha_RECEIVE_PACKET_BIT_MASK_SUPPORT                    0
+
+/* Multi Buffer */
+#ifdef MB_ENABLE
+    #define MAX_WHA_RX_BUFFERS                                       14
+#else
+    #define MAX_WHA_RX_BUFFERS                                       1
+#endif
+
+/* Used in order to signal the correct security bit of aFlags, that is sent to upper layer ReceivePacket() */
+#define WHA_WEP                                                 0x10000
+#define WHA_TKIP                                                0x20000
+#define WHA_AES                                                 0x30000
+#ifdef GEM_SUPPORT
+    #define WHA_GEM                                                 0x8000
+#endif
+
+#define TIWha_RATE_BIT_MASK_SUPPORT   ((WHA::KRate1Mbits)         | \
+                                                            (WHA::KRate2Mbits)         | \
+                                                            (WHA::KRate5_5Mbits)     | \
+                                                            (WHA::KRate6Mbits)         | \
+                                                            (WHA::KRate9Mbits)         | \
+                                                            (WHA::KRate11Mbits)        | \
+                                                            (WHA::KRate12Mbits)        | \
+                                                            (WHA::KRate18Mbits)        | \
+                                                            (WHA::KRate24Mbits)        | \
+                                                            (WHA::KRate36Mbits)        | \
+                                                            (WHA::KRate48Mbits)        | \
+                                                            (WHA::KRate54Mbits))       
+
+
+#define TIWha_CAPABILITY_BIT_MASK_SUPPORT   ((WHA::SSettings::KExpiryTimeParam)   | \
+                                                                    (WHA::SSettings::KDot11SlotTime)           | \
+                                                                    (WHA::SSettings::KRadioMeasurements)     | \
+                                                                    (WHA::SSettings::KWep16ByteKey)         | \
+                                                                    (WHA::SSettings::KScanChannelTimes))
+
+#ifdef GEM_SUPPORT
+    #define TIWha_CAPABILITY_GEM_SUPPORT        GemBit
+#endif /* GEM_SUPPORT */
+
+#ifdef MB_ENABLE
+    #define TIWha_CAPABILITY_MB_SUPPORT     WHA::SSettings::KMultipleRxBuffers
+#endif /* MB_ENABLE */
+
+
+#ifdef HT_SUPPORT
+    #define TIWha_CAPABILITY_HT_OPERATION       WHA::SSettings::KHtOperation
+    #define RX_QUEUE_WIN_SIZE               8
+    #define HT_CONTROL_FILED_SIZE           4
+
+    #define TID0    BIT_0
+    #define TID1    BIT_1
+    #define TID2    BIT_2
+    #define TID3    BIT_3
+    #define TID4    BIT_4
+    #define TID5    BIT_5
+    #define TID6    BIT_6
+    #define TID7    BIT_7
+
+#endif /* HT_SUPPORT */
+
+#define TIWha_CAPABILITY_AUTO_RATE          WHA::SSettings::KAutonomousRateAdapt
+
+#define TIWha_BAND_BIT_MASK_SUPPORT      ((WHA::KBand2dot4GHzMask) | (WHA::KBand5GHzMask))          
+
+/* max table size of the security keys */
+#define TIWLANWHA_MAX_PRIVACY_KEY_INDEX                              9
+
+
+#define     MAX_INFO_ELEMENT_LEN    (32)
+
+#ifndef BTCOEX_DEFAULT_PROFILE
+    #define BTCOEX_DEFAULT_PROFILE BtCoexProfData
+#endif
+
+#ifndef BTCOEX_DEFAULT_MODE
+    #define BTCOEX_DEFAULT_MODE SG_OPPORTUNISTIC
+#endif
+
+/* For connection phase we will use this parameter to make sure we can drop down the rates till 1Mbps */
+#define TIWHA_TX_FAIL_LOW_TH_FOR_CONNECTION 2
+
+/* After connection we use the default definition */
+#define TIWHA_TX_FAIL_LOW_TH_AFTER_CONNECTION RATE_MGMT_TX_FAIL_LOW_TH
+
+
+/********* Typedefs ********/
+
+/* Rx quality triggers indexes */
+typedef enum
+{
+    TRIGGER_EVENT_LOW_RSSI   = 0,
+    TRIGGER_EVENT_LOW_SNR    = 1,
+    TRIGGER_EVENT_HIGH_TX_PW = 2,
+    TRIGGER_EVENT_LOW_TX_PW  = 3,
+    TRIGGER_EVENT_BG_SCAN    = 4,
+    TRIGGER_EVENT_USER_0     = 5,
+    TRIGGER_EVENT_USER_1     = 6,
+    TRIGGER_EVENT_MAX        = 7
+
+}ETriggerEventIndex;
+
+typedef enum
+{
+    vendorSpecificConfig_idle,
+    vendorSpecificConfig_btCoexMode,
+    vendorSpecificConfig_btCoexEnabled,
+} vendorSpecificConfigEnum;
+
+
+typedef struct  
+{
+    void*   pFrame[MAX_XFER_WAITING_PACKETS];              /* Hold the last sent frame to TnetDrv                    */
+    TUint32  uCurrSend;              /* Hold the frame index that is going to be sent    (0/1) */
+    TUint32  uCurrHandle;            /* Hold the frame index that is going to be handled (0/1) */
+    TUint32  uHeaderToDataOffset[MAX_XFER_WAITING_PACKETS]; /* Gap between Header and Data due to security alignment  */
+    TBool    bIsQosHeader[MAX_XFER_WAITING_PACKETS];        /* determine whether we have 24 or 26 bytes of header     */
+} TTxAlign;
+
+
+struct TIFirmwareStructure
+{
+    const TUint8*   pFw;
+    TUint32             fwLength;
+    const TUint8*   pNvs;
+    TUint32             nvsLength;
+};
+
+
+typedef struct
+{
+    TUint8  eleId;
+    TUint8  eleLen;
+} TDot11InfoElemHdr; 
+
+
+typedef struct
+{
+    TDot11InfoElemHdr   hdr;    
+    TUint8              info[MAX_INFO_ELEMENT_LEN];             
+
+} TInformationElement; 
+
+
+struct TOsContext
+{
+    MWlanOsa* hOsa;
+    WlanSpia* hSpia;
+    WlanHpa* hHpa;
+};
+
+/* Use the next macros to get MWlanOsa /WlanSpia / WlanHpa from hOS */
+#define GET_OSA(hOS)  (((TOsContext*)(hOS))->hOsa)
+#define GET_SPIA(hOS) (((TOsContext*)(hOS))->hSpia)
+#define GET_HPA(hOS) (((TOsContext*)(hOS))->hHpa)
+
+
+struct TwdCtrl
+{
+    /* OS Module (contains both OSA and SPIA)*/
+    TOsContext         tOsContext;
+
+    /* HAL handles */
+    TI_HANDLE         hApp;
+    TI_HANDLE         hReport;
+    TI_HANDLE         hTWD;
+    TI_HANDLE         hContext;
+    TI_HANDLE         hTimer;
+    TI_HANDLE         hTxnQ;
+
+    /* The read MIB buffer to be copied to from HAL Cmd MBOX */
+    TUint8          readMIBBuf [MAX_CMD_PARAMS];
+    /* Current read MIB ID */
+    WHA::TMib       currentReadMibID;
+    /* Scan parameters */
+    TScanParams     scanParams;
+    /* TX power level table */
+    TInt8           txPowerLevelTable [RADIO_BAND_NUM_OF_BANDS][NUM_POWER_LEVELS];
+    /* Current radio band */
+    WHA::TBand      radioBand;
+    /* PLT specific test that is running right now */
+    ETestCmdID      ePlt;
+    /* Array of configured privacy keys */
+    TSecurityKeys   privacyKey [TIWLANWHA_MAX_PRIVACY_KEY_INDEX];
+    /* User configured sleep mode */
+    WHA::TSleepMode sleepMode;
+    /* Send response flag */
+    TBool           bResponse;
+    /* Tx frame parameters. used for security alignment */
+    TTxAlign        TxAlign;
+    /* Twd init parameters . used for setting the defaults for TWD */
+    TTwdInitParams  twdInitParams;
+    /* Report init parameters */
+    TReportInitParams  report_init;
+    /* mac address */
+    TMacAddr    	pMacAddr;
+    /* Add Scan parameters */
+    TScanParams     iScanParams; 
+
+    /* Save the last security mode configuration */
+    ECipherSuite ePairwiseKeyMode;
+    ECipherSuite eGroupKeyMode;
+
+    /* Save BSS type for Tx packets */
+    WHA::TOperationMode bssType;
+
+/***************************************************************************/
+
+
+} ;  
+
+
+/***************************** HT Definitions ******************************/
+
+#define MCS_TABLE   10
+
+/* MCS Rate for WHA */
+
+#define WHA_MCS_0   BIT_0
+#define WHA_MCS_1   BIT_1
+#define WHA_MCS_2   BIT_2
+#define WHA_MCS_3   BIT_3
+#define WHA_MCS_4   BIT_4
+#define WHA_MCS_5   BIT_5
+#define WHA_MCS_6   BIT_6
+#define WHA_MCS_7   BIT_7
+
+struct TApCapabilities
+{
+    TBool       iHTSupport;       /* 0 - HT disable, 1 - HT Enable */
+
+    TMacAddr    iMacAddr;        /* The MAC address of the peer station. This field is valid only in IBSS mode; 
+                                    in BSS mode, the host driver sets this field to 0xFFFFFFFFFFFF */
+
+    TUint8      iRxStbc;        /* STBC reception support: 0 - Not Supported, 1 - Supported for one spatial stream,
+                                   2 – Supported for one and two spatial streams, 3 – Supported for one, two and three spatial streams */
+
+    TUint8      iHtMaxAmpdu;    /* maximum A-MPDU size: 0 – 8191 octets. 1 – 16383 octets. 2 – 32767 octets. 3 – 65535 octets. */
+
+    TUint32     iHtCapabilities; /* bit mask for HT capabilities: */
+
+    TUint8      iHtMcsSet[MCS_TABLE]; /* A bit mask that defines the supported MCSs.
+                                        The least significant bit of the byte[0] corresponds to MCS 0,
+                                        the least significant bit of byte[1] corresponds to MCS 8 and so on */
+
+    TUint8      iHtAmpduSpacing;        /* the A-MPDU spacing: 0 – no restriction.
+                                        • 1 – ¼ microseconds.
+                                        • 2 – ½ microseconds.
+                                        • 3 – 1 microsecond.
+                                        • 4 – 2 microseconds.
+                                        • 5 – 4 microseconds.
+                                        • 6 – 8 microseconds.
+                                        • 7 – 16 microseconds. */
+
+    TUint8      iHtMcsFeedback;         /* the MCS feedback capability: 0 – no MCS feedback. 1 – reserved. 
+                                           2 – unsolicited MCS feedback only. 
+                                           3 – both solicited and unsolicted MCS feedback.*/
+
+    TUint32     iBeamFormingCapabilities; /* Transmit Beam Forming capabilities. */
+
+    TUint8      iAntennaSelection;        /* Antenna selection capabilities. */
+
+    TUint8      Padding[3];
+};
+
+
+struct THtInformation 
+{
+    TUint32     iHTInformation;     /* HT information bit mask.
+                                    Bit 0 Non-Greenfield HT STAs present in the BSS.
+                                    Bit 1 Transmit burst limited.
+                                    Bit 2 PCO active.
+                                    Bit 3 RIFS Permitted.
+                                    Bit 4 Dual CTS protection required.
+                                    Bit 5 Secondary beacon transmitted
+                                    Bit 6-31 Reserved. */
+
+
+    TUint8      iHtMcsSet[MCS_TABLE]; /* A bit mask that defines the supported MCSs.
+                                        The least significant bit of the byte[0] corresponds to MCS 0,
+                                        the least significant bit of byte[1] corresponds to MCS 8 and so on */
+
+    TUint8      iHtProtection;      /* the HT protection mode:
+                                    0 – operation mode 0. 1 – operation mode 1 (non-member protection mode).
+                                    2 – operation mode 2. 3 – operation mode 3 (mixed mode). */
+
+    TUint8      iHtSecChannelOffset; /* the secondary channel offset:
+                                     0 – no secondary channel. 1 – secondary channel is above the primary channel.
+                                     3 - secondary channel is below the primary channel. */
+
+    TUint8      iHtChannelWidth;    /* the channel width:
+                                    0 – only 20 MHz channel width supported or used.
+                                    1 – both 40 MHz and 20 MHz channel width supported or used. */
+
+    TUint8      Padding[3];
+};
+
+
+
+struct TBABitMask
+{
+    TUint8      iTxTidBASupport;    /* A bit-map containing the block ACK usage status for the tx direction */
+
+    TUint8      iRxTidBASupport;    /* A bit-map containing the block ACK usage status the rx direction */
+
+    TUint8      Padding[2];
+};
+
+
+#define GENERAL_RADIO_PARAM_LEN         58
+
+#define STATIC_RADIO_PARAM_LEN          17
+#define STATIC_RADIO_PARAM_OFFSET       58
+
+#define DYNAMIC_RADIO_PARAM_LEN         65
+#define FEM0_DYNAMIC_RADIO_PARAM_OFFSET 76
+#define FEM1_DYNAMIC_RADIO_PARAM_OFFSET 142
+
+
+
+typedef struct 
+{
+    IniFileGeneralParam   tGeneralParams;
+    TStatRadioParams      tStatRadioParams;
+    TDynRadioParams       tDynRadioParams[NUMBER_OF_FEM_TYPES_E];
+
+}TAutoRadioIniParams;  
+
+
+typedef struct 
+{
+	TUint8 len; //maximum length is 14
+	TInt8  upperLimit;
+	TInt8  values[14]; //this is the maximum length (in rows) of the error table
+}TSmartReflexErrTable;
+
+typedef struct
+{
+    TUint8  SmartReflexState;
+	TSmartReflexErrTable tErrorTable[3]; 
+}TSmartReflexConfigParams;
+
+typedef struct
+{	
+	TSmartReflexErrTable errorTable; 
+	unsigned short senN_P;
+	unsigned short senNRN;
+	unsigned short senPRN;
+	unsigned short senN_P_Gain;
+}TSmartReflexDebugParams;
+
+
+#endif /* _TIWhaDef_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaGemDef.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,75 @@
+/*
+ * TIWhaGemDef.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:      TIWhaDef.H*/
+/**/
+/* Purpose:     This module defines unified interface to use by the PhysicalChannel*/
+/**/
+/*--------------------------------------------------------------------------*/
+
+#ifndef _TIWhaGemDef_
+#define _TIWhaGemDef_
+
+
+#include <wlanwha_types.h>
+#include "osApi.h"
+
+extern "C" 
+{
+#include "TWDriver.h"
+}
+
+
+#define GEMGroupKey WHA::EWapiGroupKey
+#define GEMPairWiseKey WHA::EWapiPairWiseKey
+#define KGEMKeyLength WHA::KWapiKeyLength
+#define KGEMMicKeyLength WHA::KWapiMicKeyLength
+#define SGEMGroupKey WHA::SWapiGroupKey
+#define SGEMPairwiseKey WHA::SWapiPairwiseKey
+#define GemBit WHA::SSettings::KWapi
+
+
+#define GROUP_KEY_COPY(hOs,DestKey,SrcKey,Length)       os_memoryCopy(hOs,((void*)((TSecurityKeys*)(DestKey))->encKey),((void*)((SGEMGroupKey*)(SrcKey))->iWapiKey),Length);
+#define GROUP_MIC_COPY(hOs,DestMic,SrcMic,Length)       os_memoryCopy(hOs,((void*)((TSecurityKeys*)(DestMic))->micRxKey),((void*)((SGEMGroupKey*)(SrcMic))->iMicKey),Length);
+#define PAIRWISE_KEY_COPY(hOs,DestKey,SrcKey,Length)    os_memoryCopy(hOs,((void*)((TSecurityKeys*)(DestKey))->encKey),((void*)((SGEMPairwiseKey*)(SrcKey))->iWapiKey),Length);
+#define PAIRWISE_MIC_COPY(hOs,DestMic,SrcMic,Length)    os_memoryCopy(hOs,((void*)((TSecurityKeys*)(DestMic))->micRxKey),((void*)((SGEMPairwiseKey*)(SrcMic))->iMicKey),Length);
+
+#endif /* _TIWhaGemDef_ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaPLTDef.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,95 @@
+/*
+ * TIWhaPLTDef.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWhaPLTDef.h 
+ *  \brief  New API's - Should be located in Symbian ???
+ *
+ *  \see   
+ */
+
+#ifndef TIWhaPLT_DEF_H
+#define TIWhaPLT_DEF_H
+
+
+#define MAC_ADD_SIZE	24
+
+#define TX_TYPE         1
+#define TX_TYPE_INDEX	24
+#define TX_LEN_INDEX	25
+#define TX_LEN_MS       0x1
+#define TX_LEN_LS       0x99
+#define TX_VALUE_INDEX	27
+
+#define RX_TYPE         2
+#define RX_LEN          0x13
+#define RX_TYPE_INDEX	436
+#define RX_LEN_INDEX	437
+#define RX_VALUE_INDEX	439
+
+#define NVS_TYPE        0xAA
+#define NVS_TYPE_INDEX  458
+#define NVS_LEN         468
+
+
+typedef TestCmdID_enum ETestCmdID;
+
+struct SPLTResponse
+{
+	WHA::TStatus         aStatus;
+	ETestCmdID        aPlt;   
+	TUint32         aLength;
+	void            *aData;  
+};
+
+struct TMemoryAccess
+{
+	TI_UINT32	addr;      			// target (HW) address
+	TI_UINT32 	length;   			// length of transaction (in bytes) up to 256 bytes
+	TI_UINT8	buf8[256];		 
+};
+
+struct TPltTester
+{
+	ETestCmdID eTestCmd;
+	void	   *pTestCmdParams;
+};
+
+
+#endif /* TIWhaPLT_DEF_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaTxRx.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,963 @@
+/*
+ * TIWhaTxRx.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWhaTxRx.cpp 
+ *  \brief  Control the data path from UMAC and back to UMAC
+ *
+ *  \see   
+*/
+
+#include "TIWha.h"
+
+/*******************************************************************************
+ * stuff for C file linking.                                                   *
+ *******************************************************************************/
+
+extern "C" 
+{
+
+#include "tidef.h"
+#include "report.h"
+#include "timer.h"
+#include "TWDriver.h"
+#include "version.h"
+#include "osApi.h"
+#include "context.h"
+#include "BusDrv.h"
+#include "public_types.h"
+#define __FILE_ID__								FILE_ID_147
+}
+
+static const TI_UINT8 WMEQosAcToTid[MAX_NUM_OF_AC] = { 0, 2, 4, 6 };
+
+#define WORD_SIZE                       4
+#define WORD_ALIGN_MASK                 0xFFFC
+#define GET_EXTRA_BYTES(status)		( (status & 0xc0) >> 6)
+#define KEY_GEM_TYPE                    4
+#define QOS_PADDING_SIZE                4
+#define QOS_SHIFT_SIZE                  2
+
+
+/********************************************************************************
+*																				*
+*                       MACROS and INLINE FUNCTIONS           					*
+*																				*
+*********************************************************************************/
+/* Update packet length in the descriptor according to HW interface requirements */
+static inline TI_UINT16 TranslateLengthToFw (TTxCtrlBlk *pPktCtrlBlk)
+{
+    TI_UINT16 uPktLen      = pPktCtrlBlk->tTxDescriptor.length;
+    TI_UINT16 uLastWordPad = (4 - (uPktLen & 3)) & 0x3;  /* Find number of bytes needed to align */
+
+    uPktLen = (uPktLen + uLastWordPad) >> 2;     /* Add alignment bytes and convert to words */
+	pPktCtrlBlk->tTxDescriptor.length = ENDIAN_HANDLE_WORD(uPktLen);
+
+    return uLastWordPad;
+}
+
+/* Translate packet timestamp to FW time, and update also lifeTime and uDriverDelay */
+static inline void TranslateTimeToFw (TwdCtrl *iTwdCtrl, TTxCtrlBlk *pPktCtrlBlk, TI_UINT16 uLifeTime)
+{
+    TI_UINT32 uPktStartTime = pPktCtrlBlk->tTxDescriptor.startTime;  /* Contains host start time */
+
+    /* Save host packet handling time until this point (for statistics) */
+    pPktCtrlBlk->tTxPktParams.uDriverDelay = os_timeStampMs (iTwdCtrl->tOsContext.hOsa) - uPktStartTime;
+                                             
+    /* Translate packet timestamp to FW time and undate descriptor */
+    uPktStartTime = TWD_TranslateToFwTime (iTwdCtrl->hTWD, uPktStartTime); 
+	pPktCtrlBlk->tTxDescriptor.startTime = ENDIAN_HANDLE_LONG (uPktStartTime);
+	pPktCtrlBlk->tTxDescriptor.lifeTime  = ENDIAN_HANDLE_WORD (uLifeTime);
+}
+
+
+/** 
+ * \fn     RxMemFailTimerCb
+ * \brief  Call again the rxXfer module to handle all pending packets.
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::RxMemFailTimerCb ()
+{
+	TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "RxMemFailTimerCb uRxMemFailCount %d\n",uRxMemFailCount);
+
+    bRxMemFailTimerRunning = TI_FALSE;
+
+    /* if uRxMemFailCount == 0 it means that Rx allocation is back to life - no need to call RxXfer */
+    if (uRxMemFailCount)
+    {
+        TWD_rxXfer_Handle(iTwdCtrl.hTWD);
+    }
+}
+
+/** 
+ * \fn     RequestForBuffer
+ * \brief  member function. calls LDD
+ * 
+ * \note    
+ * \param  aLength - aligned length of packet.
+ * \return  
+ * \sa      
+ */ 
+ERxBufferStatus TIWha::RequestForBufferCb (void **pWbuf, TI_UINT16 aLength, TI_UINT32 uEncryptionFlag)
+{
+    /* Total security overhead to be asked for in RequestForBuffer ()  */
+    TI_UINT32 uExtraSecurityLength = 0; 
+    /* Offset to be used when returning the buffer pointer. It will be used shifting the header backwards */
+    TI_UINT32 uSecurityOffset	   = 0;	
+    ERxBufferStatus eBufferStatus;
+    TI_UINT8* pRequestedBuf = NULL;
+
+    /*
+     * We should manipulate the packet according to the security mode. See ReceivePacket() for
+     * more details. 
+     * We have 2 issues to deal with:
+     * 1) Add additional length to the buffer request.
+    	 * 2) Change the pointer such that it will point forward by the size that should be added after the header.
+     *   	It is done in order to pull back the header later in GWSI_AdaptCB_ReceivePacket() to support GWSI spec.
+     */
+
+    
+    switch (uEncryptionFlag) 
+    {
+        case KEY_NULL:		
+        	uExtraSecurityLength = 0;
+        	uSecurityOffset		 = 0;
+            break;
+    
+        case KEY_WEP:	
+            uExtraSecurityLength = IV_FIELD_SIZE + ICV_FIELD_SIZE;
+        	uSecurityOffset		 = IV_FIELD_SIZE;
+            break;
+    
+        case KEY_TKIP:
+        	uExtraSecurityLength = IV_FIELD_SIZE + EIV_FIELD_SIZE + MIC_FIELD_SIZE + ICV_FIELD_SIZE;
+        	uSecurityOffset		 = IV_FIELD_SIZE + EIV_FIELD_SIZE;
+            break;
+    
+        case KEY_AES:		
+        	uExtraSecurityLength = AES_AFTER_HEADER_FIELD_SIZE + MIC_FIELD_SIZE;
+        	uSecurityOffset		 = AES_AFTER_HEADER_FIELD_SIZE;
+            break;
+
+        #ifdef GEM_SUPPORT
+            case KEY_GEM_TYPE:
+                uExtraSecurityLength = GEM_AFTER_HEADER_FIELD_SIZE + GEM_MIC_FIELD_SIZE;
+            	uSecurityOffset		 = GEM_AFTER_HEADER_FIELD_SIZE + GEM_BUFFER_ALIGNMENT;
+                break;
+        #endif
+
+        default:
+            TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "RequestForBuffer: uEncryptionFlag = %d uExtraSecurityLength = %d\n", uEncryptionFlag, uExtraSecurityLength);
+            break;
+    }
+    
+
+    if (iRxPacketsAllocated < MAX_WHA_RX_BUFFERS)
+    {
+        /* 
+         * We are requesting extra bytes for security, but decreasing WSPI_PAD_LEN_READ since the spec indicates
+         *  that the Rx offset will be added any way 
+         */
+        if( bErrorIndication == TI_FALSE)
+        {    
+            pRequestedBuf = (TI_UINT8*) WhaCb()->RequestForBuffer(aLength - sizeof(RxIfDescriptor_t) + uExtraSecurityLength + QOS_PADDING_SIZE + PAYLOAD_ALIGN_PAD_BYTES);
+        }
+        #if TI_DBG
+            else
+            {
+                WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+            }
+        #endif	
+        
+        if ( pRequestedBuf == NULL )
+        { 
+            #ifdef PLT_TESTER
+                return RX_BUF_ALLOC_OUT_OF_MEM;
+            #endif
+                                  
+            uRxMemFailCount++;
+			/* In case no timer is running - start a new timer to call RxXfer later */
+			if (!bRxMemFailTimerRunning) 
+			{
+                #ifdef TI_DBG
+                if (uRxMemFailCount == 1)
+                {
+                    /* Print error only for the first time */
+                    TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "Start hRxMemFailTimer for the first time\n");
+                }
+                #endif
+                TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "Start hRxMemFailTimer uRxMemFailCount %d\n",uRxMemFailCount);
+                /* In case we fail too many times, just mark as OUT_OF_MEM so the Rx packet will be dropped */
+                if (uRxMemFailCount > MAX_CONSECUTIVE_RX_MEM_FAIL)
+                {
+                    return RX_BUF_ALLOC_OUT_OF_MEM;
+                }
+
+				bRxMemFailTimerRunning = TI_TRUE;
+                os_timerStart(&iTwdCtrl.tOsContext,hRxMemFailTimer,RX_ALLOC_FAIL_TIME_OUT);
+			}
+
+            /* In this case rxXfer will exit the loop and wait for someone to trigger the SM again */      
+			return RX_BUF_ALLOC_PENDING;
+        }
+
+        /* Increase the number of allocated buffers */
+        iRxPacketsAllocated++;
+    
+#ifdef TI_DBG
+        /* Just have a print in case we are out of the bad situation of RX_BUF_ALLOC_OUT_OF_MEM */
+        if (uRxMemFailCount)
+        {
+					TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "Rx allocation succeeded after %d times\n",uRxMemFailCount);
+        }
+#endif /* TI_DBG */
+
+        /* Rx allocation succeeded so set counter to zero */
+        uRxMemFailCount = 0;
+
+        TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "RequestForBuffer: uEncryptionFlag = %d uExtraSecurityLength = %d\n", uEncryptionFlag, uExtraSecurityLength);
+
+        TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "RequestForBuffer: len = %d OriginalPointer = 0x%x, allocatedBuffer#= %d \n", aLength, *pWbuf, iRxPacketsAllocated);
+
+        TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "RequestForBuffer: Pointer2Buffer= 0x%x, Buffer= 0x%x \n",pWbuf, *pWbuf);
+
+        /* The packet will be read as if it started uSecurityOffset bytes ahead and ReceivePacket() will take it back */
+        /* pWbuf points to the actual start of the data */
+        pRequestedBuf += uSecurityOffset + WSPI_PAD_LEN_READ;
+        
+        *pWbuf = (void*)pRequestedBuf;
+        
+        eBufferStatus = RX_BUF_ALLOC_COMPLETE;       
+    }
+    else
+    {
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_WARNING, "RequestForBuffer: RX_BUF_ALLOC_PENDING");
+        /* RxXfer will try to allocate the buffer again when other buffer will be released */ 
+        eBufferStatus = RX_BUF_ALLOC_PENDING;       
+    }
+    
+    return eBufferStatus;
+}
+
+ 
+/** 
+ * \fn     ReceivePacket
+ * \brief  member function. calls LDD
+ * 
+ * \note    
+ * \param  aStatus - not used but retrieved from RxIfDescriptor_t.
+ * \param  aBuf	   - pointer to start of RxIfDescriptor_t.
+ * \return  
+ * \sa      
+ */ 
+void TIWha::ReceivePacketCb (const void *aBuf)
+{
+	WHA::TStatus 		aStatus;
+	TUint16				aLength;
+	WHA::TRate			aRate;
+	WHA::TRcpi			aRcpi;
+	WHA::TChannelNumber aChannel;
+	TUint32 			aFlags;
+	/* move aBuf to begeinnig of MAC heder */
+	const void*			aFrame = (TI_UINT8*)aBuf + sizeof(RxIfDescriptor_t);
+    dot11_header_t      *pDot11Hdr = (dot11_header_t*)aFrame;
+	RxIfDescriptor_t*	pRxParams = (RxIfDescriptor_t*)aBuf;
+    TBool               bQos;
+
+    
+    
+	switch (pRxParams->status)
+	{
+	case RX_FAILURE_NONE:                     
+        aStatus = WHA::KSuccess;          
+        break;
+
+    case RX_FAILURE_MIC_ERROR:   
+        aStatus = WHA::KMicFailure; 
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR , "ReceivePacket MIC_FAILURE !!! \n");
+        break; 
+
+    case RX_FAILURE_DECRYPT:     
+        aStatus = WHA::KDecryptFailure;   
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR , "ReceivePacket DECRYPT_FAILURE !!! \n");
+        break; 
+
+    default: 
+    	TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR ,"ReceivePacketCb : WHA::KFailed");
+        aStatus = WHA::KFailed;
+	}
+
+    /* convert to LDD rate */
+	aRate	= TIWhaUtils::PolicyToWhaRate ((ETxRateClassId)pRxParams->rate);
+
+	/* calculate RCPI form RSSI */
+	if (pRxParams->rx_level >= 0)
+		aRcpi = 220;
+	else
+		if (pRxParams->rx_level <= -110)
+			aRcpi = 0;
+		else
+			aRcpi = (pRxParams->rx_level + 110)*2;
+
+	/* Channel of received frame */
+	aChannel = pRxParams->channel;
+
+    /* pRxParams->length refer to total length form MAC heder in bytes */
+	aLength = pRxParams->length*WORD_SIZE - pRxParams->extraBytes - sizeof(RxIfDescriptor_t);
+
+	/* flags description:
+	   1. bits 0 - 15 are optional
+	   2. bits 16 - 18 security TBD when security integrated
+	   3. bit 19 for more pending frames
+	   4. bit 20 packet was received during a measurement process or not
+     */
+    aFlags = 0;
+
+    /*
+	 * The next adaptation code is meant to align with the driver legacy operation of extra padding for security:
+	 *
+	 * WEP: 	TnetwDrv	 	HEADER - DATA
+	 *    		Upper layer		HEADER - IV (4) - DATA - ICV (4)
+	 *
+	 * TKIP: 	TnetwDrv	 	HEADER - DATA 
+	 *			Upper layer		HEADER - IV (4)  - EIV (4) - DATA - MIC (8) - ICV (4)
+	 *   		
+	 * AES: 	TnetwDrv	 	HEADER - DATA
+	 *			Upper layer		HEADER - RSN (8) - DATA - MIC (8) 	
+	 *
+     * GEM: 	TnetwDrv	 	HEADER - DATA
+	 *			Upper layer		HEADER - KeyIdx(1) - Reserved(1) - PN(16) - DATA - MIC (16) 	
+     *
+	 * Note: 	Adding the offset is done even if the packet status is error	
+	 */
+    bQos = IS_QOS_FRAME(pDot11Hdr->fc);
+    TUint8 shiftBytes = WSPI_PAD_LEN_READ; 
+    
+    switch (pRxParams->flags & RX_DESC_ENCRYPT_MASK)
+    {
+        case RX_DESC_ENCRYPT_WEP:
+            ALIGN_HEADER_TO_DATA_BACKWARD (aFrame, WEP_AFTER_HEADER_FIELD_SIZE, bQos)
+            shiftBytes += WEP_AFTER_HEADER_FIELD_SIZE;
+            /* Increase length size by 8 (IV + ICV) */
+            aLength += (WEP_AFTER_HEADER_FIELD_SIZE + ICV_FIELD_SIZE);
+            aFlags |= WHA_WEP;
+            break;
+        
+        case RX_DESC_ENCRYPT_TKIP:
+            ALIGN_HEADER_TO_DATA_BACKWARD (aFrame, TKIP_AFTER_HEADER_FIELD_SIZE, bQos)
+            shiftBytes += TKIP_AFTER_HEADER_FIELD_SIZE;
+            /* Increase length size by 20 (IV + EIV + MIC + ICV) */
+            aLength += (TKIP_AFTER_HEADER_FIELD_SIZE + MIC_FIELD_SIZE + ICV_FIELD_SIZE);
+            aFlags |= WHA_TKIP;
+            break;
+    
+        case RX_DESC_ENCRYPT_AES:
+            ALIGN_HEADER_TO_DATA_BACKWARD (aFrame, AES_AFTER_HEADER_FIELD_SIZE, bQos)
+            shiftBytes += AES_AFTER_HEADER_FIELD_SIZE;
+            /* Increase length size by 16 (AES(RSN padding) + MIC) */
+            aLength += (AES_AFTER_HEADER_FIELD_SIZE + MIC_FIELD_SIZE);
+            aFlags |= WHA_AES;
+            break;
+
+        #ifdef GEM_SUPPORT
+            case RX_DESC_ENCRYPT_GEM:
+                ALIGN_HEADER_TO_DATA_BACKWARD (aFrame, GEM_AFTER_HEADER_FIELD_SIZE, bQos)
+                shiftBytes += GEM_AFTER_HEADER_FIELD_SIZE + GEM_BUFFER_ALIGNMENT;
+                /* Increase length size by 34 ( GEM_KeyIdx(1) + GEM_Reserved(1) + GEM_PN(16) + GEM_MIC(16) ) */
+                aLength += (GEM_AFTER_HEADER_FIELD_SIZE + GEM_MIC_FIELD_SIZE);
+                aFlags |= WHA_GEM;
+                break;
+        #endif
+
+        default:
+            /* Do nothing */
+            break;
+    }
+
+	/*if QOS frame the pointer starts 2 bytes before so the shiftbytes will be 2 mor bytes*/
+	if (bQos)
+	{
+		shiftBytes += QOS_SHIFT_SIZE;
+	}
+
+
+
+    /* Call upper layer */
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->ReceivePacket (aStatus, 
+							aFrame, 
+							aLength, 
+							aRate, 
+							aRcpi, 
+							aChannel,
+							(TUint8*)aBuf - shiftBytes,  
+							aFlags);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+
+    /* Decrease the number of allocated buffers */
+    iRxPacketsAllocated--;
+
+    TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "end of ReceivePacket(), allocated buffer = %d\n", iRxPacketsAllocated);
+}
+
+
+/** 
+ * \fn     SendPacket
+ * \brief  member function. 
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+WHA::TStatus TIWha::SendPacket(
+								  const void* aFrame,
+								  TUint16 aLength,
+								  WHA::TQueueId aQueueId,
+								  TUint8 aTxRateClassId,
+								  WHA::TRate aMaxTransmitRate,
+								  TBool aMore,
+								  WHA::TPacketId aPacketId,
+								  WHA::TPowerLevel aPowerLevel,
+								  TUint32 aExpiryTime,
+								  void* aReserved )
+{    
+    TTxCtrlBlk *pPktCtrlBlk;
+    void* aData = (void*)aFrame;
+    WHA::TStatus whaStatus;
+    TI_STATUS tiStatus;
+
+    TRACE4(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " aFrame = 0x%x len = %d aQueue = %d rateClass = %d\n", aFrame, aLength, aQueueId, aTxRateClassId);
+
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " aMaxTransmitRate = 0x%x aPacketId = 0x%x aExpiryTime = %d \n",aMaxTransmitRate, aPacketId, aExpiryTime);
+    
+
+    AlignTxForTWD (aData, aLength);
+
+    /* 
+     * Prepare packet for transmision by filling up all the fields. 
+     */
+    
+     whaStatus = preparePktCtrlBlk ( &pPktCtrlBlk,
+                                     aData,
+                                     aLength,
+                                     aQueueId,
+                                     aTxRateClassId,
+                                     aMaxTransmitRate,
+                                     aMore,
+                                     aPacketId,
+                                     aPowerLevel,
+                                     aExpiryTime);
+
+    if ( whaStatus == WHA::KQueueFull)
+    {
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_WARNING , "****** KQueueFull ****** \n");
+        AlignTxSecurityForUMAC (TRUE);
+        return WHA::KQueueFull;
+    }
+
+   TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "aFrame=%x, Buffer= %x \n", aFrame, pPktCtrlBlk->tTxnStruct.aBuf[0]);
+
+    /*
+     *  Call the Tx-Xfer to start packet transfer to the FW and return its result.       
+     */
+
+    tiStatus  = TWD_txXfer_SendPacket ( iTwdCtrl.hTWD, pPktCtrlBlk);
+
+   TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, " status = %d \n", tiStatus);
+
+    switch (tiStatus)
+    {
+        case TXN_STATUS_COMPLETE:
+            /* TxXferCb () won't be called so Align Tx packet before */
+            AlignTxSecurityForUMAC (TRUE);
+            /* Mark that TxXferCb won't be called */
+            pPktCtrlBlk->tTxPktParams.uFlags = TX_CTRL_FLAG_XFER_DONE_ISSUED;
+            return WHA::KSuccessXfer;
+        case TXN_STATUS_OK:
+            pPktCtrlBlk->tTxPktParams.uFlags = 0;
+            if (whaStatus == WHA::KPending) {
+                return WHA::KPending;
+            }
+            return WHA::KSuccess;
+        case TXN_STATUS_PENDING:
+            /* The packet is pending in spi level and not in driver level */
+            pPktCtrlBlk->tTxPktParams.uFlags = 0;
+            if (whaStatus == WHA::KPending) {
+                return WHA::KPending;
+            }
+            return WHA::KSuccess;
+        case TXN_STATUS_ERROR:
+            /* TxXferCb () won't be called so Align Tx packet before */
+            AlignTxSecurityForUMAC (TRUE);
+            return WHA::KQueueFull;
+        default:
+            /* TxXferCb () won't be called so Align Tx packet before */
+            AlignTxSecurityForUMAC (TRUE);
+            return WHA::KFailed;
+    }
+}
+
+/** 
+ * \fn     preparePktCtrlBlk
+ * \brief  prepare the Ctrl Block with the given parameters
+ * 
+ * \note    
+ * \return   txCtrlBlkEntry_t*
+ * \sa      
+ */ 
+WHA::TStatus TIWha::preparePktCtrlBlk ( TTxCtrlBlk **pPktCtrlBlk,
+                                       const void* aFrame,
+                                       TUint16 aLength,
+                                       WHA::TQueueId aQueueId,
+                                       TUint8 aTxRateClassId,
+                                       WHA::TRate aMaxTransmitRate,
+                                       TBool aMore,
+                                       WHA::TPacketId aPacketId,
+                                       WHA::TPowerLevel aPowerLevel,
+                                       TUint32 aExpiryTime)
+{
+    TI_UINT16 txDescAttr; /* Tx-descriptor fields values. */
+    TI_UINT16 uLastWordPad;
+	TI_UINT8  uAligmentPad;
+    TI_UINT32 tempaFrame;    
+    *pPktCtrlBlk = NULL;
+    ETxHwQueStatus eHwQueStatus;
+
+    /* Allocates a Control-Block for the packet Tx parameters and descriptor. */
+    *pPktCtrlBlk = TWD_txCtrlBlk_Alloc (iTwdCtrl.hTWD);
+    
+    /* If null entry (not expected to happen) return ERROR. */
+    if (!*pPktCtrlBlk)
+    {
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, ": Tx Ctrl-Blk allocation failed!!!\n");
+        return WHA::KQueueFull;
+    }
+
+    /*  Save the aPacketId for use in TxXferCb & TxCompleteCb */
+    iPacketIdTable[(*pPktCtrlBlk)->tTxDescriptor.descID] = aPacketId;
+
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, ": iPacketIdTable[%d]= %d\n", (*pPktCtrlBlk)->tTxDescriptor.descID, aPacketId);
+
+    /*
+     *  Fill in parameters of  pPktCtrlBlk                                                                                   
+     */
+    /* Move aFrame back in order to leave room for the tx_descriptor */
+    tempaFrame = (TI_UINT32)aFrame - TX_DESCRIPTOR_SIZE;
+    aFrame = (void*)tempaFrame;
+    
+	uAligmentPad = ((4 -(aLength & 0x3)) & 0x3);
+    /* data is given with the header, this is different then full driver  */
+    (*pPktCtrlBlk)->tTxnStruct.aLen[0] =  aLength + TX_DESCRIPTOR_SIZE + uAligmentPad;
+    (*pPktCtrlBlk)->tTxnStruct.aBuf[0] = (TI_UINT8*)aFrame;
+    /* Not relevant since we are not incharge on the memory release */
+    (*pPktCtrlBlk)->tTxPktParams.uInputPktLen = 0;
+    (*pPktCtrlBlk)->tTxPktParams.pInputPkt = 0;
+
+    /* 
+     *  Build packet descriptor (for FW interface).  
+     */
+    (*pPktCtrlBlk)->tTxDescriptor.tid = WMEQosAcToTid[aQueueId];
+    (*pPktCtrlBlk)->tTxDescriptor.startTime = os_timeStampMs (iTwdCtrl.tOsContext.hOsa);
+    TranslateTimeToFw (&iTwdCtrl, (*pPktCtrlBlk), 2000/*aExpiryTime*/);
+
+   TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, ": aExpiryTime= %d, desc.startTime= %d, desc.lifeTime= %d \n", aExpiryTime, (*pPktCtrlBlk)->tTxDescriptor.startTime, (*pPktCtrlBlk)->tTxDescriptor.lifeTime);
+
+    /* Initialize tTxDescriptor.length with the real packet length in bytes */
+    (*pPktCtrlBlk)->tTxDescriptor.length = aLength + TX_DESCRIPTOR_SIZE;
+    
+     /* Call HwQueue for Hw resources allocation. If not available return NULL. */
+    eHwQueStatus = TWD_txHwQueue_AllocResources (iTwdCtrl.hTWD, (*pPktCtrlBlk));
+                   
+    if (eHwQueStatus == TX_HW_QUE_STATUS_STOP_CURRENT)
+    {
+        /* Free Ctrl block. */
+        TWD_txCtrlBlk_Free(iTwdCtrl.hTWD, (*pPktCtrlBlk));
+
+        TRACE0(iTwdCtrl.hReport, REPORT_SEVERITY_WARNING, ": Tx Hw resources allocation failed!!!\n");
+        return WHA::KQueueFull;
+    }
+
+    /* txCtrl_TranslateLengthToFw() will translate it to the length in FW format */
+    uLastWordPad = TranslateLengthToFw((*pPktCtrlBlk));
+
+    /* Upper layer is using '1' for first policy, while TnetwDrv is using '0' for it. */
+    txDescAttr = (aTxRateClassId - 1 ) << TX_ATTR_OFST_RATE_POLICY;
+    
+    /* if there is a security padding then the WLAN packet was stuffed with 2 extra bytes for alignment */
+    if (iSecurityPadding != 0) 
+    {        
+        txDescAttr |= TX_ATTR_HEADER_PAD;        
+    }
+    
+    txDescAttr |= uLastWordPad << TX_ATTR_OFST_LAST_WORD_PAD;
+        
+    (*pPktCtrlBlk)->tTxDescriptor.txAttr = txDescAttr; 
+    
+    /*
+     * Copy the descriptor parameters to the packet header.    
+     */
+    os_memoryCopy(iTwdCtrl.tOsContext.hOsa, const_cast<void*>(aFrame), (TxIfDescriptor_t*)&(*pPktCtrlBlk)->tTxDescriptor, sizeof(TxIfDescriptor_t));
+    
+    return eHwQueStatus == TX_HW_QUE_STATUS_STOP_NEXT ? WHA::KPending : WHA::KSuccess;    
+}
+
+/** 
+ * \fn     AlignTxForTWD
+ * \brief  Aligment header to TWD structure -- Check HT and Security. 
+ * 
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+WHA::TStatus TIWha::AlignTxForTWD (void*& aFrame,TUint16& aLength)    
+{
+    /* Use the header to retrieve the frame ctrl of the packet */
+    dot11_header_t  *pDot11Hdr = (dot11_header_t*)aFrame; 
+    TI_UINT32 tempaFrame;
+
+    /* By default we won't handle any alignment */
+    iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrSend] = 0;
+	#ifdef HT_SUPPORT
+		if (IS_HT_FRAME(pDot11Hdr->fc))
+		{
+		iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrSend] = HT_CONTROL_FILED_SIZE;
+		aLength -= HT_CONTROL_FILED_SIZE;
+		}
+	#endif /* HT_SUPPORT */
+    	
+	/* Qos heaser is needed to determine the WLAN Header size  */
+    	iTwdCtrl.TxAlign.bIsQosHeader[iTwdCtrl.TxAlign.uCurrSend] = IS_QOS_FRAME(pDot11Hdr->fc);
+    
+    /* zero iSecurityPadding for every new packet */
+      iSecurityPadding = 0;
+    
+    /* Check if using security. If so we should convert the packet format as the description below */
+    if (IS_WEP_ON(pDot11Hdr->fc))
+    {
+    	TI_UINT8* pMac;
+        ECipherSuite eSecurityMode;
+
+        pMac = &pDot11Hdr->address1[0]; /* hold the first mac address */
+
+    	/* Use group key on Multicast/broadcast. else use pairwise */
+        if (MAC_MULTICAST(pMac))
+        {
+            eSecurityMode = iTwdCtrl.eGroupKeyMode;
+        }
+        else
+        {
+            eSecurityMode = iTwdCtrl.ePairwiseKeyMode;
+        }
+         
+    	/*
+    	 * The next adaptation code is meant to align with the driver legacy operation of extra padding for security:
+    	 *
+    	 * WEP: 	Upper layer		HEADER - IV (4) - DATA - ICV (4)
+    	 *   		TnetwDrv	 	HEADER - DATA
+    	 *
+    	 * TKIP: 	Upper layer		HEADER - IV (4)  - EIV (4) - DATA - MIC (8) - ICV (4)
+    	 *   		TnetwDrv	 	HEADER - EIV (4) - DATA 
+    	 *
+    	 * AES: 	Upper layer		HEADER - RSN (8) - DATA - MIC (8)
+    	 *   		TnetwDrv	 	HEADER - RSN (8) - DATA
+    	 */
+    				 	
+        TRACE4(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "SendPacket(): send = %d Handle = %d, QoS = %d, encryption = %d\n",iTwdCtrl.TxAlign.uCurrSend, iTwdCtrl.TxAlign.uCurrHandle, 
+            iTwdCtrl.TxAlign.bIsQosHeader[iTwdCtrl.TxAlign.uCurrSend], eSecurityMode);
+
+        switch (eSecurityMode) 
+    	{
+        case TWD_CIPHER_WEP:
+            /* Mark the offset between header and data */
+            iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrSend] += WEP_AFTER_HEADER_FIELD_SIZE;
+            /* Decrease length size by 8 (IV + ICV) */
+            aLength -= (IV_FIELD_SIZE + ICV_FIELD_SIZE);
+            break;
+
+    	case TWD_CIPHER_TKIP:
+            /* Mark the offset between header and data */
+            iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrSend] += IV_FIELD_SIZE;
+            /* Decrease length size by 16 (IV + MIC + ICV) */
+            aLength -= (IV_FIELD_SIZE + MIC_FIELD_SIZE + ICV_FIELD_SIZE);
+            break;
+
+    	case TWD_CIPHER_AES_WRAP:
+    	case TWD_CIPHER_AES_CCMP:
+    		/* Decrease length size by 8 (MIC) */
+    		aLength -=  MIC_FIELD_SIZE;
+    		break;
+        #ifdef GEM_SUPPORT
+            case TWD_CIPHER_GEM:
+                /* Mark the offset between header and data */
+                iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrSend] += GEM_AFTER_HEADER_FIELD_SIZE;
+                /* Decrease length size by 34 bytes (KEY_IDX_FIELD_SIZE + RESERVED_FIELD_SIZE + PN_FIELD_SIZE + MIC) */
+        		aLength -=  (GEM_AFTER_HEADER_FIELD_SIZE + GEM_MIC_FIELD_SIZE);
+                /* Add padding of two bytes before wlan header, */
+                /* because it will be unaligned after the header will be moved 18 bytes */
+                iSecurityPadding = GEM_AFTER_HEADER_PAD;
+                break;
+        #endif
+        
+    	default:
+    		/* Unknown security with Encryption ON. return ERROR */
+                TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR, "SendPacket(): Encryption ON but unknown security mode = %d\n",     			 eSecurityMode);
+    		return WHA::KFailed;
+    	}
+    }
+
+	/* Check if the header packet should move */
+    if (iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrSend] > 0)
+    {
+        ALIGN_HEADER_TO_DATA_FORWARD (aFrame, iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrSend], 
+                                     iTwdCtrl.TxAlign.bIsQosHeader[iTwdCtrl.TxAlign.uCurrSend])
+    }
+
+    /* Move the frame iSecurityPadding (2 bytes) backward */    
+    tempaFrame = (TI_UINT32)aFrame - iSecurityPadding;
+    aFrame = (void*)tempaFrame;
+    /* Increase the length by size of iSecurityPadding (2 bytes) */
+    aLength+= iSecurityPadding;
+    /* Mark the current packet - Note that it is needed only when we have security */
+    iTwdCtrl.TxAlign.pFrame[iTwdCtrl.TxAlign.uCurrSend] = (void*)aFrame;
+    /* For the next packet to be send */
+    
+    iTwdCtrl.TxAlign.uCurrSend++;
+    iTwdCtrl.TxAlign.uCurrSend %= MAX_XFER_WAITING_PACKETS;
+
+    return WHA::KSuccess;
+}
+
+
+/** 
+ * \fn     AlignTxSecurityForUMAC
+ * \brief  security alignment. 
+ *
+ * Handle packet alignment after Xfer done
+ *               It is done here after the pointer was changed in TIWha::SendPacket()
+ *               and at this point the pointer is not needed any more.
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::AlignTxSecurityForUMAC (TBool aQFull)
+{
+    TRACE5(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "AlignTxSecurityForUMAC(): send = %d Handle = %d, QoS = %d, Offset = %d pFrame = %p\n",iTwdCtrl.TxAlign.uCurrSend, iTwdCtrl.TxAlign.uCurrHandle,iTwdCtrl.TxAlign.bIsQosHeader[iTwdCtrl.TxAlign.uCurrHandle], 
+        iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrHandle],iTwdCtrl.TxAlign.pFrame[iTwdCtrl.TxAlign.uCurrHandle]);
+
+    if (aQFull) {
+        
+        iTwdCtrl.TxAlign.uCurrSend = iTwdCtrl.TxAlign.uCurrSend > 0? iTwdCtrl.TxAlign.uCurrSend - 1 : 49;
+        TRACE5(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "AlignTxSecurityForUMAC() -- ** aQFull **: send = %d Handle = %d, QoS = %d, Offset = %d pFrame = %p\n",iTwdCtrl.TxAlign.uCurrSend, iTwdCtrl.TxAlign.uCurrHandle,iTwdCtrl.TxAlign.bIsQosHeader[iTwdCtrl.TxAlign.uCurrHandle], 
+            iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrHandle],iTwdCtrl.TxAlign.pFrame[iTwdCtrl.TxAlign.uCurrHandle]);
+
+        ALIGN_HEADER_TO_DATA_BACKWARD (iTwdCtrl.TxAlign.pFrame[iTwdCtrl.TxAlign.uCurrSend], 
+            iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrSend], 
+            iTwdCtrl.TxAlign.bIsQosHeader[iTwdCtrl.TxAlign.uCurrSend])
+        return;
+    }
+
+    /* Check if the packet should be aligned */
+    if (iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrHandle])
+    {
+        ALIGN_HEADER_TO_DATA_BACKWARD (iTwdCtrl.TxAlign.pFrame[iTwdCtrl.TxAlign.uCurrHandle], 
+            iTwdCtrl.TxAlign.uHeaderToDataOffset[iTwdCtrl.TxAlign.uCurrHandle], 
+            iTwdCtrl.TxAlign.bIsQosHeader[iTwdCtrl.TxAlign.uCurrHandle])
+    }
+
+    /* For the next packet to be handled */
+    iTwdCtrl.TxAlign.uCurrHandle++;
+    iTwdCtrl.TxAlign.uCurrHandle %= MAX_XFER_WAITING_PACKETS;
+}
+
+
+/** 
+ * \fn     TxXferCb
+ * \brief  
+ *    Called by the TNETW driver upon Xfer-Done of transmitted packet.
+ *   Calls the UMAC Xfer-Done handler.
+ *
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::TxXferCb ( TTxCtrlBlk *pPktCtrlBlk)
+{
+    TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION,  "TxXferCb(): packetId=0x%x flags = 0x%x\n",iPacketIdTable[pPktCtrlBlk->tTxDescriptor.descID], pPktCtrlBlk->tTxPktParams.uFlags);
+        
+#ifdef TI_DBG
+    /* If the pointed entry is already free, print error and exit (not expected to happen). */
+    if (pPktCtrlBlk->pNextFreeEntry != NULL)
+    {
+        TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TxXferCb(): Pkt already free!!, DescID=%d, flags=%d, packetId=0x%x\n",pPktCtrlBlk->tTxDescriptor.descID, pPktCtrlBlk->tTxPktParams.uFlags,iPacketIdTable[pPktCtrlBlk->tTxDescriptor.descID]);
+    
+        return;
+    }
+#endif
+
+    /* Check If this is the second time we call TxXferCb for this packet (i.e. TxCompleteCb called it explicitly) */
+    if (pPktCtrlBlk->tTxPktParams.uFlags &  TX_CTRL_FLAG_XFER_DONE_ISSUED)
+    {
+        
+        /* TRACE2(iTwdCtrl.hReport, REPORT_SEVERITY_ERROR,  TIWLANWHA_MODULE_LOG, MSG_2262, "TxXferCb(): already called for this packet!!, DescID=%d, flags=%d, packetId=0x%x\n",pPktCtrlBlk->tTxDescriptor.descID, pPktCtrlBlk->tTxPktParams.uFlagsiPacketIdTable[pPktCtrlBlk->tTxDescriptor.descID]); */        
+    }
+    else /* TxXferCB called for the first time. call UMAC */
+    {
+        pPktCtrlBlk->tTxPktParams.uFlags |= TX_CTRL_FLAG_XFER_DONE_ISSUED;
+        
+        AlignTxSecurityForUMAC ();
+
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TxXferCb(): call WhaCb()->SendPacketTransfer, descID= %d\n", pPktCtrlBlk->tTxDescriptor.descID);
+        TRACE1(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TxXferCb(): call WhaCb()->SendPacketTransfer, PacketID= %d\n", iPacketIdTable[pPktCtrlBlk->tTxDescriptor.descID]);
+       
+        if( bErrorIndication == TI_FALSE)
+        {    
+            WhaCb()->SendPacketTransfer ((WHA::TPacketId)iPacketIdTable[pPktCtrlBlk->tTxDescriptor.descID]);
+        }
+        #if TI_DBG
+            else
+            {
+                WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+            }
+        #endif	
+    }
+}
+
+/** 
+ * \fn     TxCompleteCb
+ * \brief      Called upon Tx-complete of transmitted packet.
+ *    Handles it as follows:
+ *    1) Update the HwQueue to free queue resources.
+ *    2) Call the upper driver's tx-complete handler.
+ *    3) Free the packet's Control-Block if Xfer-Done already occured.
+ *
+ * \note    
+ * \return  
+ * \sa      
+ */ 
+void TIWha::TxCompleteCb ( TxResultDescriptor_t *pTxResultInfo, TI_UINT32 backpressure)
+{
+    /* Get the packet's control block pointer by the descId index. */
+    TTxCtrlBlk *pPktCtrlBlk = TWD_txCtrlBlk_GetPointer(iTwdCtrl.hTWD, pTxResultInfo->descID);
+    WHA::TStatus status;
+    
+    TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TxCompleteCb(): DescID=%d, flags=%d, packetId=0x%x\n", 
+        pTxResultInfo->descID, pPktCtrlBlk->tTxPktParams.uFlags, 
+        iPacketIdTable[pPktCtrlBlk->tTxDescriptor.descID]);
+
+#ifdef TI_DBG
+    /* If the pointed entry is already free, print error and exit (not expected to happen). */
+    if (pPktCtrlBlk->pNextFreeEntry != NULL)
+    {
+       TRACE3(iTwdCtrl.hReport, REPORT_SEVERITY_INFORMATION, "TxCompleteCb(): Pkt already free!!, DescID=%d, flags=%d, packetId=0x%x\n", 
+            pPktCtrlBlk->tTxDescriptor.descID, pPktCtrlBlk->tTxPktParams.uFlags, 
+            iPacketIdTable[pPktCtrlBlk->tTxDescriptor.descID]);
+       
+        return;
+    }
+#endif
+
+
+    /* Check if TxXferCb was called for this packet */
+    if ((pPktCtrlBlk->tTxPktParams.uFlags & TX_CTRL_FLAG_XFER_DONE_ISSUED) == 0)
+    {
+        /* Xfer was not  called, so call it here. Note that once TxComplete was called, there will be no TxXfer */
+        TxXferCb (pPktCtrlBlk);
+    }
+
+    /* We return Success on every tx result because of stange behaviour in the upper layer */
+    /* It seems that on results other than success the OS closes the socket */
+    switch (pTxResultInfo->status)
+    {
+        case TX_SUCCESS:
+            status = WHA::KSuccess;
+            break;
+        case TX_RETRY_EXCEEDED:
+            status = WHA::KErrorRetryExceeded;
+            WLAN_OS_REPORT(("ERROR: TxCompletewith status = %d",pTxResultInfo->status));
+            break;
+        case TX_TIMEOUT:
+            status = WHA::KErrorLifetimeExceeded;
+            WLAN_OS_REPORT(("ERROR: TxCompletewith status = %d",pTxResultInfo->status));
+            break;
+        case TX_PEER_NOT_FOUND:
+            status = WHA::KErrorNoLink;
+            WLAN_OS_REPORT(("ERROR: TxCompletewith status = %d",pTxResultInfo->status));
+            break;
+        case TX_DISABLED:
+            status = WHA::KErrorMacNotResponding;
+            WLAN_OS_REPORT(("ERROR: TxCompletewith status = %d",pTxResultInfo->status));
+            break;
+        default:
+            status = WHA::KFailed;
+            WLAN_OS_REPORT(("ERROR: TxCompletewith status = %d",pTxResultInfo->status));
+            break;
+    }
+
+    /* Call the UMAC tx-complete handler */
+    if( bErrorIndication == TI_FALSE)
+    {    
+        WhaCb()->SendPacketComplete(     status,
+								(WHA::TPacketId)iPacketIdTable[pPktCtrlBlk->tTxDescriptor.descID],
+								TIWhaUtils::PolicyToWhaRate ((ETxRateClassId)pTxResultInfo->rate),
+								pTxResultInfo->mediumDelay, /* aPacketQueueDelay */
+								pTxResultInfo->fwHandlingTime, /* aMediaDelay */
+			 					pTxResultInfo->ackFailures);
+    }
+    #if TI_DBG
+        else
+        {
+            WLAN_OS_REPORT(("%s : CommandResponse Block call to LDD response \n",__FUNCTION__));
+        }
+    #endif	
+
+    /* Free Ctrl block. */
+    TWD_txCtrlBlk_Free(iTwdCtrl.hTWD, pPktCtrlBlk);
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaUtils.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,291 @@
+/*
+ * TIWhaUtils.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWhaUtils.cpp 
+ *  \brief  Utilities used by TIWha layer only
+ *
+ *  \see   
+*/
+
+#include "TIWhaUtils.h"
+#define __FILE_ID__								FILE_ID_148
+
+/** 
+* \fn     WhaToTwdFrameType
+*  
+* \return   
+* \sa     
+*/ 
+EMibTemplateType TIWhaUtils::WhaToTwdFrameType(WHA::TTemplateType aFrameType) 
+{
+    switch (aFrameType)
+    {
+        case WHA::KBeaconTemplate: return TEMPLATE_TYPE_BEACON;
+        case WHA::KProbeRequestTemplate: return TEMPLATE_TYPE_PROBE_REQUEST;
+        case WHA::KNullDataTemplate: return TEMPLATE_TYPE_NULL_FRAME;
+        case WHA::KProbeResponseTemplate: return TEMPLATE_TYPE_PROBE_RESPONSE;
+        case WHA::KQosNullDataTemplate: return TEMPLATE_TYPE_QOS_NULL_FRAME;
+        case WHA::KPSPollTemplate: return TEMPLATE_TYPE_PS_POLL;
+        default:
+            WLAN_OS_REPORT (("ERROR: %s aFrameType = %d\n",__FUNCTION__,aFrameType)); 
+            return  TEMPLATE_TYPE_BEACON;
+    }
+}
+
+/** 
+* \fn     WhaToTwdRate
+*  
+* \return   
+* \sa     
+*/ 
+ERate TIWhaUtils::WhaToTwdRate (WHA::TRate aRate)
+{
+    /*Important Note: aRate = 0 - means don't care. Use 1M rate same as the default rate.
+	UMAC sets probe req template with rate = 0, as it doesn't care for probe req rate*/
+    switch (aRate)
+    {
+		case 0:
+        case WHA::KRate1Mbits:   return  DRV_RATE_1M; 
+        case WHA::KRate2Mbits:   return  DRV_RATE_2M;  
+        case WHA::KRate5_5Mbits: return  DRV_RATE_5_5M;
+        case WHA::KRate6Mbits:   return  DRV_RATE_6M; 
+        case WHA::KRate9Mbits:   return  DRV_RATE_9M; 
+        case WHA::KRate11Mbits:  return  DRV_RATE_11M;  
+        case WHA::KRate12Mbits:  return  DRV_RATE_12M;  
+        case WHA::KRate18Mbits:  return  DRV_RATE_18M;  
+        case WHA::KRate22Mbits:  return  DRV_RATE_22M;  
+        case WHA::KRate24Mbits:  return  DRV_RATE_24M;  
+        case WHA::KRate36Mbits:  return  DRV_RATE_36M;  
+        case WHA::KRate48Mbits:  return  DRV_RATE_48M;  
+        case WHA::KRate54Mbits:  return  DRV_RATE_54M;  
+        default:      
+            WLAN_OS_REPORT (("ERROR: %s aRate = %d\n",__FUNCTION__,aRate)); 
+            return  DRV_RATE_1M;
+    }
+}
+
+/** 
+* \fn     PolicyToWhaRate
+*  
+* \param ePolicyRate 
+* \return  TRate 
+* \sa     
+*/ 
+WHA::TRate TIWhaUtils::PolicyToWhaRate (ETxRateClassId ePolicyRate)
+{
+    switch (ePolicyRate)
+    {
+#ifdef HT_SUPPORT
+        case     txPolicyMcs7:      return  WHA::KRate1Mbits;
+        case     txPolicyMcs6:      return  WHA::KRate1Mbits;
+        case     txPolicyMcs5:      return  WHA::KRate1Mbits;
+        case     txPolicyMcs4:      return  WHA::KRate1Mbits;
+        case     txPolicyMcs3:      return  WHA::KRate1Mbits;
+        case     txPolicyMcs2:      return  WHA::KRate1Mbits;
+        case     txPolicyMcs1:      return  WHA::KRate1Mbits;
+        case     txPolicyMcs0:      return  WHA::KRate1Mbits;
+#endif /* HT_SUPPORT */
+        case     txPolicy54:        return  WHA::KRate54Mbits;  
+        case     txPolicy48:        return  WHA::KRate48Mbits;  
+        case     txPolicy36:        return  WHA::KRate36Mbits;  
+        case     txPolicy24:        return  WHA::KRate24Mbits;  
+        case     txPolicy22:        return  WHA::KRate22Mbits;  
+        case     txPolicy18:        return  WHA::KRate18Mbits;  
+        case     txPolicy12:        return  WHA::KRate12Mbits;  
+        case     txPolicy11:        return  WHA::KRate11Mbits;  
+        case     txPolicy9:     return  WHA::KRate9Mbits; 
+        case     txPolicy6:     return  WHA::KRate6Mbits; 
+        case     txPolicy5_5:       return  WHA::KRate5_5Mbits;
+        case     txPolicy2:     return  WHA::KRate2Mbits;  
+        case     txPolicy1:     return  WHA::KRate1Mbits;
+
+        default:      
+            WLAN_OS_REPORT (("ERROR: %s aRate = %d\n",__FUNCTION__,ePolicyRate)); 
+            return  WHA::KRate1Mbits;
+    }
+}
+
+/** 
+ * \fn     WhaToMaskRate
+ * \brief  Rate mask to convert the TIWha rates
+ * 
+ *  
+ * 
+ * \note    
+ * \param  TIWhaRate 
+  * \return  rateNask_e - corosponding aRate
+ * \sa      
+ */ 
+TI_UINT32  TIWhaUtils::WhaToMaskRate (WHA::TRate aRate)
+{
+
+    TI_UINT32 rateMask =0;
+    
+        
+    (aRate& WHA::KRate1Mbits )  ? rateMask |= DRV_RATE_MASK_1_BARKER :   NULL;
+    (aRate& WHA::KRate2Mbits )  ? rateMask |= DRV_RATE_MASK_2_BARKER :   NULL;
+    (aRate& WHA::KRate5_5Mbits )? rateMask |= DRV_RATE_MASK_5_5_CCK  :   NULL;
+    (aRate& WHA::KRate6Mbits )  ? rateMask |= DRV_RATE_MASK_6_OFDM   :   NULL;
+    (aRate& WHA::KRate9Mbits )  ? rateMask |= DRV_RATE_MASK_9_OFDM   :   NULL;
+    (aRate& WHA::KRate11Mbits ) ? rateMask |= DRV_RATE_MASK_11_CCK   :   NULL;
+    (aRate& WHA::KRate12Mbits ) ? rateMask |= DRV_RATE_MASK_12_OFDM  :   NULL;
+    (aRate& WHA::KRate18Mbits ) ? rateMask |= DRV_RATE_MASK_18_OFDM  :   NULL;
+    (aRate& WHA::KRate22Mbits ) ? rateMask |= DRV_RATE_MASK_22_PBCC  :   NULL;
+    (aRate& WHA::KRate24Mbits ) ? rateMask |= DRV_RATE_MASK_24_OFDM  :   NULL;
+    (aRate& WHA::KRate33Mbits ) ? rateMask |= DRV_RATE_MASK_1_BARKER :   NULL;
+    (aRate& WHA::KRate36Mbits ) ? rateMask |= DRV_RATE_MASK_36_OFDM  :   NULL;
+    (aRate& WHA::KRate48Mbits ) ? rateMask |= DRV_RATE_MASK_48_OFDM  :   NULL;
+    (aRate& WHA::KRate54Mbits ) ? rateMask |= DRV_RATE_MASK_54_OFDM  :   NULL;
+
+    if (rateMask == 0)
+	{
+                 WLAN_OS_REPORT (("ERROR: %s aRate = %d\n",__FUNCTION__,aRate)); 
+        rateMask|= DRV_RATE_MASK_1_BARKER; // as default
+}
+
+    return rateMask;
+ }
+
+
+/** 
+ * \fn     HTWhaToMaskRate
+ * \brief  HT Rate mask to convert the TIWha rates
+ * 
+ *  
+ * 
+ * \note    
+ * \param  TIWhaRate 
+ * \param  THtMcsSet
+  * \return  rateNask_e - corosponding aRate
+ * \sa      
+ */ 
+#ifdef HT_SUPPORT
+TI_UINT32  TIWhaUtils::HTWhaToMaskRate (WHA::TRate aRate,WHA::THtMcsSet	aMcsRates)
+{
+	TI_UINT32 rateMask =0;
+    
+        
+    (aRate& WHA::KRate1Mbits )  ? rateMask |= DRV_RATE_MASK_1_BARKER :   NULL;
+    (aRate& WHA::KRate2Mbits )  ? rateMask |= DRV_RATE_MASK_2_BARKER :   NULL;
+    (aRate& WHA::KRate5_5Mbits )? rateMask |= DRV_RATE_MASK_5_5_CCK  :   NULL;
+    (aRate& WHA::KRate6Mbits )  ? rateMask |= DRV_RATE_MASK_6_OFDM   :   NULL;
+    (aRate& WHA::KRate9Mbits )  ? rateMask |= DRV_RATE_MASK_9_OFDM   :   NULL;
+    (aRate& WHA::KRate11Mbits ) ? rateMask |= DRV_RATE_MASK_11_CCK   :   NULL;
+    (aRate& WHA::KRate12Mbits ) ? rateMask |= DRV_RATE_MASK_12_OFDM  :   NULL;
+    (aRate& WHA::KRate18Mbits ) ? rateMask |= DRV_RATE_MASK_18_OFDM  :   NULL;
+    (aRate& WHA::KRate22Mbits ) ? rateMask |= DRV_RATE_MASK_22_PBCC  :   NULL;
+    (aRate& WHA::KRate24Mbits ) ? rateMask |= DRV_RATE_MASK_24_OFDM  :   NULL;
+    (aRate& WHA::KRate33Mbits ) ? rateMask |= DRV_RATE_MASK_1_BARKER :   NULL;
+    (aRate& WHA::KRate36Mbits ) ? rateMask |= DRV_RATE_MASK_36_OFDM  :   NULL;
+    (aRate& WHA::KRate48Mbits ) ? rateMask |= DRV_RATE_MASK_48_OFDM  :   NULL;
+    (aRate& WHA::KRate54Mbits ) ? rateMask |= DRV_RATE_MASK_54_OFDM  :   NULL;
+
+	/* MCS Rates */
+	(aMcsRates[0] & WHA_MCS_0)	? rateMask |= DRV_RATE_MASK_MCS_0_OFDM : NULL;
+	(aMcsRates[0] & WHA_MCS_1)	? rateMask |= DRV_RATE_MASK_MCS_1_OFDM : NULL;
+	(aMcsRates[0] & WHA_MCS_2)	? rateMask |= DRV_RATE_MASK_MCS_2_OFDM : NULL;
+	(aMcsRates[0] & WHA_MCS_3)	? rateMask |= DRV_RATE_MASK_MCS_3_OFDM : NULL;
+	(aMcsRates[0] & WHA_MCS_4)	? rateMask |= DRV_RATE_MASK_MCS_4_OFDM : NULL;
+	(aMcsRates[0] & WHA_MCS_5)	? rateMask |= DRV_RATE_MASK_MCS_5_OFDM : NULL;
+	(aMcsRates[0] & WHA_MCS_6)	? rateMask |= DRV_RATE_MASK_MCS_6_OFDM : NULL;
+	(aMcsRates[0] & WHA_MCS_7)	? rateMask |= DRV_RATE_MASK_MCS_7_OFDM : NULL;
+
+	if (rateMask == 0)
+	{
+        WLAN_OS_REPORT (("ERROR: %s aRate = %d\n",__FUNCTION__,aRate)); 
+        rateMask|= DRV_RATE_MASK_1_BARKER; // as default
+	}
+	return rateMask;
+}
+#endif /* HT_SUPPORT */
+
+
+TI_UINT32 TIWhaUtils::WhaRateToRatePolicy(WHA::StxAutoRatePolicy* pTxAutoRatePolicy)
+{
+	TI_UINT32	aRateMask = 0;
+	/* B/G Rates */
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate1Mbits) 	? aRateMask |= HW_BIT_RATE_1MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate2Mbits) 	? aRateMask |= HW_BIT_RATE_2MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate5_5Mbits)	? aRateMask |= HW_BIT_RATE_5_5MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate6Mbits) 	? aRateMask |= HW_BIT_RATE_6MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate9Mbits) 	? aRateMask |= HW_BIT_RATE_9MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate11Mbits) 	? aRateMask |= HW_BIT_RATE_11MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate12Mbits) 	? aRateMask |= HW_BIT_RATE_12MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate18Mbits) 	? aRateMask |= HW_BIT_RATE_18MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate22Mbits) 	? aRateMask |= HW_BIT_RATE_22MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate24Mbits) 	? aRateMask |= HW_BIT_RATE_24MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate36Mbits) 	? aRateMask |= HW_BIT_RATE_36MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate48Mbits) 	? aRateMask |= HW_BIT_RATE_48MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate54Mbits) 	? aRateMask |= HW_BIT_RATE_54MBPS	: NULL;
+    
+	return aRateMask;
+}
+
+#ifdef HT_SUPPORT
+TI_UINT32 TIWhaUtils::HTWhaRateToRatePolicy(WHA::StxAutoRatePolicy* pTxAutoRatePolicy)
+{
+	TI_UINT32	aRateMask = 0;
+	/* B/G Rates */
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate1Mbits) 	? aRateMask |= HW_BIT_RATE_1MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate2Mbits) 	? aRateMask |= HW_BIT_RATE_2MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate5_5Mbits)	? aRateMask |= HW_BIT_RATE_5_5MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate6Mbits) 	? aRateMask |= HW_BIT_RATE_6MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate9Mbits) 	? aRateMask |= HW_BIT_RATE_9MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate11Mbits) 	? aRateMask |= HW_BIT_RATE_11MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate12Mbits) 	? aRateMask |= HW_BIT_RATE_12MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate18Mbits) 	? aRateMask |= HW_BIT_RATE_18MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate22Mbits) 	? aRateMask |= HW_BIT_RATE_22MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate24Mbits) 	? aRateMask |= HW_BIT_RATE_24MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate36Mbits) 	? aRateMask |= HW_BIT_RATE_36MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate48Mbits) 	? aRateMask |= HW_BIT_RATE_48MBPS	: NULL;
+	(pTxAutoRatePolicy->iBAndGRates & WHA::KRate54Mbits) 	? aRateMask |= HW_BIT_RATE_54MBPS	: NULL;
+
+	/* 11n Rates */
+	(pTxAutoRatePolicy->iMcsSet[0] & WHA_MCS_0) 			? aRateMask |= HW_BIT_RATE_MCS_0	: NULL;
+	(pTxAutoRatePolicy->iMcsSet[0] & WHA_MCS_1) 			? aRateMask |= HW_BIT_RATE_MCS_1	: NULL;
+	(pTxAutoRatePolicy->iMcsSet[0] & WHA_MCS_2) 			? aRateMask |= HW_BIT_RATE_MCS_2	: NULL;
+	(pTxAutoRatePolicy->iMcsSet[0] & WHA_MCS_3) 	   	 	? aRateMask |= HW_BIT_RATE_MCS_3	: NULL;
+	(pTxAutoRatePolicy->iMcsSet[0] & WHA_MCS_4) 	   	 	? aRateMask |= HW_BIT_RATE_MCS_4	: NULL;
+	(pTxAutoRatePolicy->iMcsSet[0] & WHA_MCS_5) 			? aRateMask |= HW_BIT_RATE_MCS_5	: NULL;
+	(pTxAutoRatePolicy->iMcsSet[0] & WHA_MCS_6) 			? aRateMask |= HW_BIT_RATE_MCS_6	: NULL;
+	(pTxAutoRatePolicy->iMcsSet[0] & WHA_MCS_7) 			? aRateMask |= HW_BIT_RATE_MCS_7	: NULL;
+
+	return aRateMask;
+}
+#endif /* HT_SUPPORT */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/WVSS/src/wha/TIWhaUtils.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,122 @@
+/*
+ * TIWhaUtils.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  TIWhaUtils.h 
+ *  \brief  Utilities used by TIWha layer only
+ *
+ *  \see   
+ */
+
+#ifndef TI_WHA_UITLS_H
+#define TI_WHA_UITLS_H
+
+#include "TIWhaDef.h" 
+
+/**
+ * TIWhaUtils class
+ */
+class TIWhaUtils
+{
+public:  
+	static EMibTemplateType WhaToTwdFrameType(WHA::TTemplateType aFrameType); 
+	static ERate WhaToTwdRate (WHA::TRate aRate);
+	static WHA::TRate PolicyToWhaRate (ETxRateClassId aRate);
+	static TI_UINT32		WhaToMaskRate (WHA::TRate aRate);
+    static TI_UINT32		WhaRateToRatePolicy(WHA::StxAutoRatePolicy* pTxAutoRatePolicy);
+#ifdef HT_SUPPORT
+	static TI_UINT32		HTWhaRateToRatePolicy(WHA::StxAutoRatePolicy* pTxAutoRatePolicy);
+	static TI_UINT32  		HTWhaToMaskRate (WHA::TRate aRate,WHA::THtMcsSet	aMcsRates);
+#endif /* HT_SUPPORT */
+};
+
+
+/* Align header to data: HEADER - OFFSET - DATA --> HEADER - DATA                            */
+/* pOriginalFrame points to the original place. It will change to point offset bytes ahead   */
+#define ALIGN_HEADER_TO_DATA_FORWARD(pOriginalFrame, uOffset, bQos) \
+{   \
+    TI_INT32 i;    \
+    TI_UINT16 *pNewFrame = ((TI_UINT16*)pOriginalFrame) + (uOffset / sizeof(TI_UINT16)); \
+    if (bQos)   \
+    {   \
+        *((TI_UINT16*)pNewFrame + (WLAN_HDR_LEN / sizeof(TI_UINT16))) =    \
+        *((TI_UINT16*)pOriginalFrame + (WLAN_HDR_LEN / sizeof(TI_UINT16)));   \
+    }   \
+    for (i = ((WLAN_HDR_LEN / sizeof(TI_UINT16)) - 1) ; i >= 0 ; i--) \
+    {   \
+		pNewFrame[i] = *((TI_UINT16*)pOriginalFrame + i); \
+    }   \
+    pOriginalFrame = pNewFrame; \
+}
+
+/* Align header to data: HEADER - DATA --> HEADER - OFFSET - DATA                            */
+/* pOriginalFrame points to the original place. It will change to point offset bytes before  */
+#define ALIGN_HEADER_TO_DATA_BACKWARD(pOriginalFrame, uOffset, bQos) \
+{   \
+    TI_INT32 i;    \
+    TI_UINT16 *pNewFrame = ((TI_UINT16*)pOriginalFrame) - (uOffset / sizeof(TI_UINT16));  \
+    for (i = 0 ; i < WLAN_HDR_LEN / sizeof(TI_UINT16) ; i++)    \
+    {   \
+        pNewFrame[i] = *((TI_UINT16*)pOriginalFrame + i); \
+    }   \
+    if (bQos)   \
+    {   \
+        *((TI_UINT16*)pNewFrame + (WLAN_HDR_LEN / sizeof(TI_UINT16))) =    \
+        *((TI_UINT16*)pOriginalFrame + (WLAN_HDR_LEN / sizeof(TI_UINT16)));   \
+    }   \
+    pOriginalFrame = pNewFrame; \
+}
+
+
+#define CONVERT_TU_2_MICRO(tu)               (tu) * 1024
+
+/* 
+* Small macro to convert Dbm units into Dbm/10 units. This macro is important
+* in order to avoid over-flow of Dbm units bigger than 25
+*/
+
+#define DBM2DBMDIV10(uTxPower) \
+	((uTxPower) > (MAX_TX_POWER / DBM_TO_TX_POWER_FACTOR) ? \
+		MAX_TX_POWER : (uTxPower) * DBM_TO_TX_POWER_FACTOR)		
+
+
+
+
+#endif /* TI_WHA_UITLS_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/bwinscw/wlanhwinitu.def	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,9 @@
+EXPORTS
+	??1CWlanHwInit@@UAE@XZ @ 1 NONAME ; CWlanHwInit::~CWlanHwInit(void)
+	?GetHwInitData@CWlanHwInit@@UAEXPAPBEAAI01@Z @ 2 NONAME ; void CWlanHwInit::GetHwInitData(unsigned char const * *, unsigned int &, unsigned char const * *, unsigned int &)
+	?GetHwTestData@CWlanHwInit@@UAEHIAAVTDes8@@@Z @ 3 NONAME ; int CWlanHwInit::GetHwTestData(unsigned int, class TDes8 &)
+	?GetHwTestInitData@CWlanHwInit@@UAEXPAPBEAAI01@Z @ 4 NONAME ; void CWlanHwInit::GetHwTestInitData(unsigned char const * *, unsigned int &, unsigned char const * *, unsigned int &)
+	?GetMacAddress@CWlanHwInit@@UAEHAAUTMacAddr@@@Z @ 5 NONAME ; int CWlanHwInit::GetMacAddress(struct TMacAddr &)
+	?NewL@CWlanHwInit@@SAPAV1@XZ @ 6 NONAME ; class CWlanHwInit * CWlanHwInit::NewL(void)
+	?SetHwTestData@CWlanHwInit@@UAEHIAAVTDesC8@@@Z @ 7 NONAME ; int CWlanHwInit::SetHwTestData(unsigned int, class TDesC8 &)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/eabi/wlanhwinitu.def	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,16 @@
+EXPORTS
+	_ZN11CWlanHwInit13GetHwInitDataEPPKhRjS2_S3_ @ 1 NONAME
+	_ZN11CWlanHwInit13GetHwTestDataEjR5TDes8 @ 2 NONAME
+	_ZN11CWlanHwInit13GetMacAddressER8TMacAddr @ 3 NONAME
+	_ZN11CWlanHwInit13SetHwTestDataEjR6TDesC8 @ 4 NONAME
+	_ZN11CWlanHwInit17GetHwTestInitDataEPPKhRjS2_S3_ @ 5 NONAME
+	_ZN11CWlanHwInit4NewLEv @ 6 NONAME
+	_ZN11CWlanHwInitD0Ev @ 7 NONAME
+	_ZN11CWlanHwInitD1Ev @ 8 NONAME
+	_ZN11CWlanHwInitD2Ev @ 9 NONAME
+	_ZThn4_N11CWlanHwInit13GetHwInitDataEPPKhRjS2_S3_ @ 10 NONAME ; #<thunk>#
+	_ZThn4_N11CWlanHwInit13GetHwTestDataEjR5TDes8 @ 11 NONAME ; #<thunk>#
+	_ZThn4_N11CWlanHwInit13GetMacAddressER8TMacAddr @ 12 NONAME ; #<thunk>#
+	_ZThn4_N11CWlanHwInit13SetHwTestDataEjR6TDesC8 @ 13 NONAME ; #<thunk>#
+	_ZThn4_N11CWlanHwInit17GetHwTestInitDataEPPKhRjS2_S3_ @ 14 NONAME ; #<thunk>#
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/group/bld.inf	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,51 @@
+/*
+ * bld.inf
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+// Export iby file
+../rom/TI_wlanhwinit.iby                          CORE_ADAPT_LAYER_IBY_EXPORT_PATH(TI_wlanhwinit.iby)
+
+PRJ_MMPFILES
+wlanhwinit.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/group/wlanhwinit.mmp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,76 @@
+/*
+ * wlanhwinit.mmp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 <platform_paths.hrh>
+
+TARGET          TI_wlanhwinit.dll
+TARGETTYPE      dll
+UID             0x1000008d 0x10207267
+LINKAS          wlanhwinit.dll
+MACRO					WLAN_SDIO
+#define					WLAN_SDIO
+
+CAPABILITY      CAP_GENERAL_DLL
+VENDORID        VID_DEFAULT
+
+MACRO  _DEBUG
+MACRO  _FW_FROMFILE
+MACRO  LOAD_FW_FROM_MMC
+MACRO  LOAD_NVS_FROM_MMC
+
+
+#if defined( ARMCC )
+DEFFILE         ../eabi/
+#elif defined( WINSCW )
+DEFFILE         ../bwinscw/
+#elif defined( WINS )
+DEFFILE         ../bwins/
+#else
+DEFFILE         ../bmarm/
+#endif
+LIBRARY         efile.lib efsrv.lib euser.lib hal.lib
+
+SOURCEPATH      ..\src 
+SOURCE          wlanhwinit.cpp
+SOURCE          wlanhwinitmain.cpp
+
+
+USERINCLUDE     ..\inc
+USERINCLUDE   ../../WVSS\src\utils
+OS_LAYER_SYSTEMINCLUDE
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/inc/radio_ini.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,175 @@
+/*
+ * radio_ini.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  radio_ini.h 
+ *  \brief This file is a draft version and it contains the parameters needed for the Radio ini configuration
+ *		   User must fill the TAutoRadioIniParams structure and append it in the aData structure
+ *  \see   
+ */
+
+
+/////////////////////////////////////////////////////////////////////////
+// Database:	IniFileGeneralParam
+// Command:		TEST_CMD_INI_FILE_GENERAL_PARAM
+/////////////////////////////////////////////////////////////////////////
+
+#define MAX_SMART_REFLEX_PARAM 16
+ 
+typedef struct 
+{
+	unsigned char RefClk;                                 
+	unsigned char SettlingTime;                                                                 
+	unsigned char ClockValidOnWakeup;                      
+	unsigned char DC2DCMode;                               
+	unsigned char Single_Dual_Band_Solution;               
+
+	unsigned char	TXBiPFEMAutoDetect;
+	unsigned char	TXBiPFEMManufacturer; 
+    unsigned char   GeneralSettings;
+
+    unsigned char   SRState;
+    char  SRF1[MAX_SMART_REFLEX_PARAM];
+    char  SRF2[MAX_SMART_REFLEX_PARAM];
+    char  SRF3[MAX_SMART_REFLEX_PARAM];
+
+    unsigned char padding[2];
+
+}IniFileGeneralParam;  
+
+typedef enum 
+{		
+	FEM_MANUAL_DETECT_MODE_E,
+	FEM_AUTO_DETECT_MODE_E
+
+}FEM_DETECT_MODE_ENM;
+
+typedef enum 
+{		
+
+	FEM_RFMD_TYPE_E,
+	FEM_TRIQUINT_TYPE_E,
+	NUMBER_OF_FEM_TYPES_E
+
+}FEM_TYPE_ENM;
+
+typedef enum 
+{		
+	REF_CLK_19_2_E,
+	REF_CLK_26_E,
+	REF_CLK_38_4_E,
+	REF_CLK_52_E
+
+}REF_CLK_ENM;
+
+typedef enum 
+{		
+	REF_CLK_NOT_VALID_E,
+	REF_CLK_VALID_AND_STABLE_E
+
+}CLK_VALID_ON_WAKEUP_ENM;
+
+typedef enum 
+{		
+	BT_SPI_IS_NOT_USED_E,
+	MUX_DC2DC_TO_BT_FUNC2_E
+
+}DC2DC_MODE_ENM;
+
+typedef enum 
+{		
+	SINGLE_BAND_SOLUTION_E,
+	DUAL_BAND_SOLUTION_E
+
+}SINGLE_DUAL_BAND_SOLUTION_ENM;
+
+/////////////////////////////////////////////////////////////////////////
+// Database:	IniFileRadioParam
+// Command:		TEST_CMD_INI_FILE_RADIO_PARAM
+/////////////////////////////////////////////////////////////////////////
+
+#define RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE   (15)
+#define NUMBER_OF_SUB_BANDS_IN_5G_BAND_E           (7) 
+#define NUMBER_OF_RATE_GROUPS_E                    (6)
+#define NUMBER_OF_2_4_G_CHANNELS                   (14)
+#define NUMBER_OF_5G_CHANNELS                      (35)
+
+typedef struct 
+{	
+	unsigned char RxTraceInsertionLoss_2_4G;																							
+	unsigned char TXTraceLoss_2_4G;																							
+	char  RxRssiAndProcessCompensation_2_4G[RSSI_AND_PROCESS_COMPENSATION_TABLE_SIZE];						
+
+    unsigned char padding;
+    
+}TStatRadioParams;  
+
+typedef struct 
+{
+	// SECTION 1: 2.4G parameters
+	short TXBiPReferencePDvoltage_2_4G;
+	char  TxBiPReferencePower_2_4G;
+	char  TxBiPOffsetdB_2_4G;
+	char  TxPerRatePowerLimits_2_4G_Normal[NUMBER_OF_RATE_GROUPS_E];
+	char  TxPerRatePowerLimits_2_4G_Degraded[NUMBER_OF_RATE_GROUPS_E];
+    char  TxPerRatePowerLimits_2_4G_Extreme[NUMBER_OF_RATE_GROUPS_E];
+	char  TxPerChannelPowerLimits_2_4G_11b[NUMBER_OF_2_4_G_CHANNELS];
+	char  TxPerChannelPowerLimits_2_4G_OFDM[NUMBER_OF_2_4_G_CHANNELS];
+	char  TxPDVsRateOffsets_2_4G[NUMBER_OF_RATE_GROUPS_E];
+	unsigned char TxIbiasTable_2_4G[NUMBER_OF_RATE_GROUPS_E];
+	unsigned char RxFemInsertionLoss_2_4G;
+    unsigned char DegradedLowToNormalThr_2_4G;
+    unsigned char NormalToDegradedHighThr_2_4G;
+    
+    unsigned char padding;
+     
+}TDynRadioParams;  
+
+
+/////////////////////////////////////////////////////////////////////////
+// Addition to: WHA and TRIOSCOPE (not public_radion.h !!!)
+/////////////////////////////////////////////////////////////////////////
+
+typedef struct 
+{
+ IniFileGeneralParam  tGeneralParams;
+ TStatRadioParams	  tStatRadioParams;
+ TDynRadioParams	  tDynRadioParams[NUMBER_OF_FEM_TYPES_E];
+
+}TAutoRadioIniParams;  
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/inc/wlanhwinitmain.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,188 @@
+/*
+ * wlanhwinitmain.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+/**********************************************************************************************************************
+
+  FILENAME:       wlanhwinitmain.h
+*/
+
+#ifndef WLANHWINITMAIN_H
+#define WLANHWINITMAIN_H
+
+#include <e32base.h>
+#include <wlanhwinit.h>
+#include <e32std.h>
+
+//#include "wlanhwinittypes.h"
+#include "wlanhwinitinterface.h"
+
+
+/**
+* This class implements the actual HW specific initialization functionality.
+*/
+NONSHARABLE_CLASS( CWlanHwInitMain ): public CBase, public MWlanHwInitInterface
+    {
+    public:  
+        /* constructor */
+        static CWlanHwInitMain* NewL();
+
+        /* Destructor */
+        virtual ~CWlanHwInitMain();
+
+       /** 
+       * \fn     GetHwInitData
+       * \brief  From MWlanHwInitInterface Get pointer to hardware specific initialization data
+       * (reference wlanhwinit.h) 
+       *          
+       * \note    
+       * \param aInitData Pointer to initialization data, NULL if none.  
+       * \param aInitLength Length of initialization data. 
+       * \param aFwData Pointer to firmware data, NULL if none.
+       * \param FwLength Length of firmware data.
+       * \return 
+       * \sa      
+       */ 
+        void GetHwInitData(const TUint8** aInitData, TUint& aInitLength, const TUint8** aFwData, TUint& aFwLength);
+
+        /** 
+        * \fn     GetMacAddress
+        * \brief  
+        * (reference wlanhwinit.h) 
+        *          
+        * \note    
+        * \param aMacAddress MAC address of the device.  
+        * \return A Symbian error code.
+        * \sa      
+        */ 
+        TInt GetMacAddress(TMacAddr& aMacAddress);
+
+       /** 
+        * \fn     GetHwTestInitData
+        * \brief  Get pointer to hardware specific initialization data for production testing.
+        * (reference wlanhwinit.h) 
+        *          
+        * \note    
+        * \param aInitData Pointer to initialization data, NULL if none.
+        * \param aInitLength Length of initialization data.
+        * \param aFwData Pointer to firmware data, NULL if none.
+        * \param aFwLength Length of firmware data.
+        * \return
+        * \sa      
+        */ 
+        void GetHwTestInitData(const TUint8** aInitData, TUint& aInitLength, const TUint8** aFwData, TUint& aFwLength);
+
+        /** 
+         * \fn     GetHwTestInitData
+         * \brief  Get hardware specific production testing data.
+         * (reference wlanhwinit.h) 
+         *          
+         * \note    
+         * \param aId Id of the parameter to read.
+         * \param aData Buffer for read data.
+         * \return A Symbian error code.
+         * \sa      
+         */ 
+        TInt GetHwTestData(TUint aId, TDes8& aData);
+
+        /** 
+         * \fn     SetHwTestData
+         * \brief  Set hardware specific production testing data.
+         * (reference wlanhwinit.h) 
+         *          
+         * \note    
+         * \param aId Id of the parameter to store.
+         * \param aData Data to be stored.
+         * \return A Symbian error code.
+         * \sa      
+         */ 
+        TInt SetHwTestData(TUint aId, TDesC8& aData);
+
+    private:
+
+        CWlanHwInitMain();
+
+        void ConstructL();
+
+        void GetMacAddressL(TMacAddr& aMacAddress);
+
+        void GetTuningDataL(TDes8& aTuningData);
+
+        void SetTuningDataL(TDesC8& aTuningData);
+                     
+        void FillRadioData(TUint8 *bob10mradio);
+
+    private:    
+
+        TUint8* ipaData;
+        
+        /**
+        * Checks if a firmware file can be found from
+        * the memory card.
+        * return False if not found or error occured, True if 
+        * the firmware was successfully read.
+        * The firmware is loaded only once.
+        */
+        TBool IsMMCFirmwareFound();
+ 
+ 
+      /** 
+     * \fn     IsMMCNvsFound() 
+     * \brief  Checks if a NVS file can be found from the memory card.
+     * 
+     * To success read the NVS file from a card the NVS bin file should be
+     * in nvs directory in the root of the card
+     * 
+     * \param  None
+     * \return false if not found or error occured, True if 
+     * the nvs was successfully read.
+     * The nvs is loaded only once.
+     * \sa     IsMMCNvsFound
+     */ 
+        TBool IsMMCNvsFound();
+ 
+ 
+        /** Buffer for possible firmware loaded from MC. */
+        HBufC8* iFirmwareMC;
+        
+        /** Buffer for possible NVS loaded from MC. */
+        HBufC8* pNvsMC;
+        
+    };
+
+#endif // WLANHWINITMAIN_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/inc/wlanhwinittypes.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,84 @@
+/*
+ * wlanhwinittypes.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+/**********************************************************************************************************************
+
+  FILENAME:       wlanhwinittypes.cpp
+*/
+
+#ifndef WLANHWINITTYPES_H
+#define WLANHWINITTYPES_H
+
+
+//  INCLUDES
+#ifdef __PACKED
+#undef __PACKED
+#endif
+
+#define __PACKED
+
+/**
+* Length of the MAC address
+*/
+const TUint8 KMacAddrLength = 6;
+
+/**
+* The one and only MAC address struct
+*/
+#pragma pack( 1 )
+struct TMacAddr
+    {
+    /** the MAC address */
+    TUint8 iMacAddress[KMacAddrLength];
+    } __PACKED; // 6 bytes
+
+/**
+* Broadcast MAC Address.
+*/
+const TMacAddr KBroadcastMacAddr = {{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }};
+
+/**
+* MAC address that all zeros
+*/
+const TMacAddr KZeroMacAddr = {{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }};
+
+
+#endif      // WLANHWINITTYPES_H   
+            
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/rom/TI_wlanhwinit.iby	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,46 @@
+/*
+ * TI_wlanhwinit.iby
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 WLANHWINIT_IBY
+#define WLANHWINIT_IBY
+
+file= ABI_DIR\BUILD_DIR\TI_wlanhwinit.dll          SHARED_LIB_DIR\wlanhwinit.dll
+extension[VARID]= ABI_DIR\BUILD_DIR\TI_wlanpdd.pdd SHARED_LIB_DIR\wlanpdd.pdd
+
+#endif // WLANHWINIT_IBY
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/src/wlanhwinit.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,144 @@
+/*
+ * wlanhwinit.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  wlanhwinit.c 
+ *  \brief TI WLAN Hardware init Driver
+ *
+ */
+
+#include <wlanhwinit.h>
+#include "WiLink6_nvs.h"
+#include "wilink6_firmware.h"
+#include "wlanhwinitmain.h"
+#include "radio_ini.h"
+#define __FILE_ID__								FILE_ID_135
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+CWlanHwInit::CWlanHwInit() :
+    iMain( NULL )
+    {
+    }
+
+void CWlanHwInit::ConstructL()
+    {
+		/* create hwInitMain private class implemantion*/
+		iMain = CWlanHwInitMain::NewL();
+		
+    }
+
+EXPORT_C CWlanHwInit* CWlanHwInit::NewL()
+    {
+    CWlanHwInit* self = new( ELeave ) CWlanHwInit;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop();
+
+    return self;
+    }
+    
+EXPORT_C CWlanHwInit::~CWlanHwInit()
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanHwInit::GetHwInitData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CWlanHwInit::GetHwInitData(
+    const TUint8** aInitData,
+    TUint& aInitLength,
+    const TUint8** aFwData,
+    TUint& aFwLength )
+    {
+    
+	/* Call the CHWInitMain  Class sicne all private members and method can only be stored there */
+	 iMain->GetHwInitData( aInitData, aInitLength, aFwData, aFwLength );
+
+
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanHwInit::GetMacAddress
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CWlanHwInit::GetMacAddress(
+    TMacAddr& aMacAddress )
+    {
+	  return iMain->GetMacAddress(aMacAddress);
+    }
+
+
+
+// -----------------------------------------------------------------------------
+// CWlanHwInit::GetHwTestInitData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CWlanHwInit::GetHwTestInitData(
+    const TUint8** aInitData,
+    TUint& aInitLength,
+    const TUint8** aFwData,
+    TUint& aFwLength )
+    {
+    *aInitData = NULL;
+    aInitLength = 0;
+    *aFwData = NULL;
+    aFwLength = 0;    
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanHwInit::GetHwTestData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CWlanHwInit::GetHwTestData(
+    TUint /*aId*/,
+    TDes8& /*aData*/ )
+    {
+    return KErrNotSupported;
+    }
+
+// -----------------------------------------------------------------------------
+// CWlanHwInit::SetHwTestData
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt CWlanHwInit::SetHwTestData(
+    TUint /*aId*/,
+    TDesC8& /*aData*/ )
+    {
+    return KErrNotSupported;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/Symbian/wlanhwinit_stub/src/wlanhwinitmain.cpp	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,765 @@
+/*
+ * wlanhwinitmain.cpp
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+
+/**********************************************************************************************************************
+
+  FILENAME:       wlanhwinitmain.cpp
+*/
+
+
+#include "WiLink6_nvs.h"
+#ifdef _FW_FROMFILE
+#include "wilink6_firmware.h"
+#endif
+#include "radio_ini.h"
+#include "gendebug.h"
+
+#include <e32base.h>
+#include <d32dbms.h> // RDbStoreDatabase
+#include <f32file.h> // RFs
+#include <s32file.h> // CFileStore
+
+#include "wlanhwinitmain.h"
+#define __FILE_ID__								FILE_ID_136
+
+#define NVS_LEN     468
+#define RADIO_LEN   208
+
+/****************************************************************************
+ *                      CWlanHwInitMain::CWlanHwInitMain()
+ ****************************************************************************
+ * DESCRIPTION: class constructor
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+
+CWlanHwInitMain::CWlanHwInitMain() :
+	ipaData ( 0 )
+{
+//	TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:CWlanHwInitMain()" ) ) );
+}
+
+/****************************************************************************
+ *                      CWlanHwInitMain::ConstructL()
+ ****************************************************************************
+ * DESCRIPTION: class constructor
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+void CWlanHwInitMain::ConstructL()
+{
+
+}
+
+/****************************************************************************
+ *                      CWlanHwInitMain::NewL()
+ ****************************************************************************
+ * DESCRIPTION: create CWlanHwInitMain 
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+CWlanHwInitMain* CWlanHwInitMain::NewL()
+{
+	CWlanHwInitMain* self = new( ELeave ) CWlanHwInitMain;
+	CleanupStack::PushL( self );
+	self->ConstructL();
+	CleanupStack::Pop( self );
+	return self;
+
+}
+    
+/****************************************************************************
+ *                      ~CWlanHwInitMain()
+ ****************************************************************************
+ * DESCRIPTION: class deconstructor
+ * 
+ * INPUTS:  None    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+CWlanHwInitMain::~CWlanHwInitMain()
+{
+//	TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:~CWlanHwInitMain()" ) ) );
+	delete ipaData; 
+}
+
+/****************************************************************************
+ *                   GetHwTestInitData
+ ****************************************************************************
+ * DESCRIPTION: 
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/   
+void CWlanHwInitMain::GetHwTestInitData(const TUint8** aInitData, TUint& aInitLength, const TUint8** aFwData, TUint& aFwLength)
+{
+	//TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:GetMacAddressL()" ) ) );   
+	
+    /* Update the pointer to the whole FW data (NVS + FW file) */
+   /* *aFwData = ipNvsData;
+    aFwLength = sizeof(WiLink6m_nvs);*/
+	
+	//TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:GetHwTestInitData()" ) ) );
+}
+
+
+
+/****************************************************************************
+ *                    GetHwTestData
+ ****************************************************************************
+ * DESCRIPTION: 
+ * 
+ * INPUTS:  
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+TInt CWlanHwInitMain::GetHwTestData(TUint aId, TDes8& aData)
+{
+//	TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:GetHwTestData()" ) ) );
+	
+	return KErrNone;
+}
+
+/****************************************************************************
+ *                     SetHwTestData
+ ****************************************************************************
+ * DESCRIPTION: 
+ * 
+ * INPUTS:   
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+
+TInt CWlanHwInitMain::SetHwTestData(TUint aId, TDesC8& aData)
+{
+
+	return KErrNone;
+}
+
+/** 
+ * \fn     IsMMCFirmwareFound() 
+ * \brief  Checks if a firmware file can be found from
+* the memory card.
+ * 
+ * To success read the FW file from a card the FW bin file should be
+ * in firmware directory in the root of the card
+ * 
+ * \param  None
+ * \return alse if not found or error occured, True if 
+ * the firmware was successfully read.
+ * The firmware is loaded only once.
+ * \sa     IsMMCFirmwareFound
+ */ 
+TBool CWlanHwInitMain::IsMMCFirmwareFound()
+{
+#ifdef LOAD_FW_FROM_MMC
+   TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain::IsMMCFirmwareFound()" ) ) );
+   
+   _LIT(KSearchPath,"E:\\firmware\\*.*");
+   _LIT(KFilePath,"E:\\firmware\\");
+   
+   // Check if the firmware is already loaded,
+   // free the memory and continue
+   
+   if (iFirmwareMC)
+   {
+    TraceDump( INFO_LEVEL, ( _L( "Memory for MMC Firmware already reserved" ) ) );
+    return ETrue;
+   }
+   
+   // Init store
+   /* Define file only if FW is not loaded */
+   RFs fs;
+   RFile file;
+   CDir* dirList;
+   TInt fileSize = -1;
+   TBuf<60> fileName;
+   fileName = KFilePath;
+   
+    
+   // Connect to the file system 
+   if ( fs.Connect() != KErrNone)
+   {
+	TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() fs.Connect()" ) ) );
+    return EFalse;
+   }
+   
+   // If returns an error, the folder is not found
+   // -> return false;
+   if (fs.GetDir(KSearchPath,
+                 KEntryAttMaskSupported,
+                 ESortByName,
+                  dirList) != KErrNone )
+	{
+		TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() fs.GetDir" ) ) );  	
+		fs.Close();
+		delete dirList;
+		return EFalse;
+	}
+                
+    // If no file is not found, return false.
+   if (dirList->Count() == 0)
+	{
+		TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() No file found" ) ) );  	
+		fs.Close();
+		delete dirList;
+		return EFalse;
+	}         
+      
+      // Take the first file in the list, further files
+      // are not handled
+   fileName.Append ((*dirList)[0].iName);  // Assume there is enough space, otherwise panics...
+   
+   // Try to open the firmware file
+   if ( file.Open(fs, fileName, EFileStream) != KErrNone)
+   {
+		TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() can't open file" ) ) );  	
+		fs.Close();
+		delete dirList;
+		return EFalse;
+   }
+    
+   // Get the size of the file 
+   if (file.Size(fileSize) != KErrNone)
+   {
+       TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() can't Get File size" ) ) ); 
+    file.Close();
+    fs.Close();
+       delete dirList;
+    return EFalse;
+   }
+    
+    // Reserve memory from heap for it
+    TRAPD(err, iFirmwareMC = HBufC8::NewL(fileSize));
+    if (err != KErrNone)
+    {
+		TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() can't reserve heap memory" ) ) );  	
+     file.Close();
+      fs.Close();
+        delete dirList;
+     return EFalse;
+    }
+ 
+    // Get a pointer and read the contents
+    // of the file.
+   TPtr8 pBuf = iFirmwareMC->Des();
+   if (file.Read(pBuf) != KErrNone)
+   {
+	   TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() can't read file" ) ) );  	
+     file.Close();
+      fs.Close();
+       delete dirList;
+     return EFalse;
+   }
+   
+   // Successful
+   TraceDump( CRIT_LEVEL, ( _L( "IsMMCFirmwareFound() Success" ) ) );  	
+   
+   file.Close();
+    fs.Close();
+    delete dirList;
+   return ETrue; 
+#else
+ /* In case we are not supporting read file from card */
+ return EFalse;
+#endif // LOAD_FW_FROM_MMC
+}
+
+
+
+/** 
+ * \fn     IsMMCNvsFound() 
+ * \brief  Checks if a NVS file can be found from the memory card.
+ * 
+ * To success read the NVS file from a card the NVS bin file should be
+ * in nvs directory in the root of the card
+ * 
+ * In case that the NVS is taken from MMC card it will contain
+ * only the NVS parameters without the Radio parameters
+ * therefor the Radio parmeters will be taken from the extend NVS array
+ * that include from the WiLink_nvs.h file
+ * 
+ * \param  None
+ * \return false if not found or error occured, True if 
+ * the nvs was successfully read.
+ * The nvs is loaded only once.
+ * \sa     IsMMCNvsFound
+ */ 
+TBool CWlanHwInitMain::IsMMCNvsFound()
+{
+#ifdef LOAD_NVS_FROM_MMC
+   TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain::IsMMCNvsFound()" ) ) );
+   
+   _LIT(KSearchPath,"E:\\nvs\\*.*");
+   _LIT(KFilePath,"E:\\nvs\\");
+   
+   /* 
+    * Check if the nvs is already loaded,
+    * free the memory and continue 
+    */
+   if (pNvsMC)
+   {
+    TraceDump( INFO_LEVEL, ( _L( "Memory for MMC NVS already reserved" ) ) );
+    return ETrue;
+   }
+   
+   /* Init store */
+   /* Define file only if NVS is not loaded */
+   RFs cFs;
+   RFile cFile;
+   CDir* pDirList;
+   TInt iFileSize = -1;
+   TBuf<60> aFileName;
+   aFileName = KFilePath;
+   
+   /* Connect to the file system */
+   if ( cFs.Connect() != KErrNone)
+   {
+	TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() cFs.Connect()" ) ) );
+    return EFalse;
+   }
+   
+   /* If returns an error, the folder is not found */
+   /* -> return false; */
+   if (cFs.GetDir(KSearchPath,
+                 KEntryAttMaskSupported,
+                 ESortByName,
+                  pDirList) != KErrNone )
+	{
+		TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() cFs.GetDir" ) ) );  	
+		cFs.Close();
+		delete pDirList;
+		return EFalse;
+	}
+                
+    /* If no file is not found, return false. */
+   if (pDirList->Count() == 0)
+	{
+		TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() No file found" ) ) );  	
+		cFs.Close();
+		delete pDirList;
+		return EFalse;
+	}         
+      
+   /* Take the first file in the list, further files are not handled */
+   aFileName.Append ((*pDirList)[0].iName);  /* Assume there is enough space, otherwise panics... */
+   
+   /* Try to open the NVS file */
+   if ( cFile.Open(cFs, aFileName, EFileStream) != KErrNone)
+   {
+		TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() can't open file" ) ) );  	
+		cFs.Close();
+		delete pDirList;
+		return EFalse;
+   }
+    
+   /* Get the size of the file */
+   if (cFile.Size(iFileSize) != KErrNone)
+   {
+       TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() can't Get File size" ) ) ); 
+       cFile.Close();
+       cFs.Close();
+       delete pDirList;
+       return EFalse;
+   }
+    
+    /* Reserve memory from heap for it */
+    TRAPD(err, pNvsMC = HBufC8::NewL(iFileSize));
+    if (err != KErrNone)
+    {
+        TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() can't reserve heap memory" ) ) );  	
+        cFile.Close();
+        cFs.Close();
+        delete pDirList;
+        return EFalse;
+    }
+ 
+    /* Get a pointer and read the contents */
+    /* of the file. */
+   TPtr8 pBuf = pNvsMC->Des();
+   if (cFile.Read(pBuf) != KErrNone)
+   {
+	   TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() can't read file" ) ) );  	
+       cFile.Close();
+       cFs.Close();
+       delete pDirList;
+       return EFalse;
+   }
+   
+   /* Successful */
+   TraceDump( CRIT_LEVEL, ( _L( "IsMMCNvsFound() Success" ) ) );  	
+   
+   cFile.Close();
+   cFs.Close();
+   delete pDirList;
+   return ETrue; 
+#else
+ /* In case we are not supporting read file from card */
+ return EFalse;
+#endif /* LOAD_FW_FROM_MMC */
+}
+
+
+
+/****************************************************************************
+ *                     GetHwInitData()
+ ****************************************************************************
+ * DESCRIPTION: init data NVS, Radio , FW file pointer
+ * 
+ * INPUTS:  data pointer    
+ * 
+ * OUTPUT:  None
+ * 
+ * RETURNS: 
+ ****************************************************************************/
+void CWlanHwInitMain::GetHwInitData(const TUint8** ppConfigData, TUint& configLength, const TUint8** ppNvsData, TUint& nvsLength )
+{
+	/*TraceDump( INFO_LEVEL, ( _L( "CWlanHwInitMain:GetHwInitData()" ) ) );*/
+
+	/* Update Config data pointer */
+	*ppConfigData = NULL;
+	configLength = 0;
+
+	/* Temporary pointer for firmware */
+	const TUint8*   pWiLink6fw;
+	TUint32		WiLink6fwSize = 0;
+	const TUint8*   pWiLink6nvs;
+	TUint32		WiLink6nvsSize = 0 ;
+    TUint8*         pWiLink6radio;
+    TUint32		WiLink6radioSize = 0 ;
+    TUint8*         pWiLink6NvsRadio;
+
+    #ifdef _FW_FROMFILE
+	if (IsMMCFirmwareFound())
+	{
+		TraceDump( CRIT_LEVEL, ( _L( "CWlanHwInitMain::GetHwInitData(): Firmware loaded from MMC card !!!" ) ) ); 
+		pWiLink6fw = reinterpret_cast<const TUint8*>( iFirmwareMC->Ptr() );
+		WiLink6fwSize = iFirmwareMC->Length(); 
+	}
+	else
+	{
+	    /* Init FW pointer & FW size */
+		pWiLink6fw = reinterpret_cast<const TUint8*>( wilink6_firmware);
+        WiLink6fwSize = sizeof( wilink6_firmware );
+	} 
+    #else
+        WiLink6fwSize = 0;
+    #endif
+  
+
+    if (IsMMCNvsFound()) {
+		TraceDump( CRIT_LEVEL, ( _L( "CWlanHwInitMain::GetHwInitData(): NVS loaded from MMC card !!!" ) ) ); 
+        pWiLink6nvs = reinterpret_cast<const TUint8*>( pNvsMC->Ptr() );
+        WiLink6nvsSize = pNvsMC->Length(); 
+    }
+    else
+    {
+        /* Init NVS pointer & size */
+        pWiLink6nvs = reinterpret_cast<const TUint8*>( WiLink6_nvs );
+        /* Chaged from: sizeof(WiLink6_nvs) */
+        WiLink6nvsSize = NVS_LEN;
+    }
+    pWiLink6NvsRadio = (TUint8*)reinterpret_cast<const TUint8*>( WiLink6_nvs ) + NVS_LEN;
+
+    /* Init Radio pointer & size */
+    /* Chaged from: sizeof(TAutoRadioIniParams) */
+    WiLink6radioSize = RADIO_LEN;
+
+    /* 
+    aData structue :
+    ____________________________________________________________________________________________
+    |         |               |            |              |          |                          |
+    |NVS Len  | NVS File      |  Radio Len | Radio File   | FW Len   |  FW File                 |
+    |4 Bytes  | WiLink6_nvs.h | 4 Bytes    | radio_ini.h  | 4 Bytes  |  wilink6_firmware.h      |
+    |_________|_______________|____________|______________|__________|__________________________|
+
+    */
+    
+    /* Alloc lenght for the whole FW Data that is composed of 1 DWORD for NVS len + 1 DWORD for FW Len  + NVS array + FW Array + Radio len + Radio params*/
+	nvsLength  = sizeof(TUint32) + WiLink6nvsSize + sizeof(TUint32) + WiLink6radioSize + sizeof(TUint32) + WiLink6fwSize;
+	
+	/* Reserve memory if it has not yet already been reserved */	
+	if (ipaData == NULL)
+	{
+		ipaData = (TUint8*)User::Alloc(nvsLength); 
+
+		if (!ipaData)
+		{
+			/* Out of memory*/
+			ASSERT(0);
+		}	
+	}	
+    /* Length of NVS*/
+    TUint8   *TempPtr = ipaData + 4;
+	
+    /*Write Nvs Length*/    
+    *(TUint32*)ipaData = WiLink6nvsSize;
+
+    /* Copy NVS data to correct position*/
+    Mem::Copy(ipaData + sizeof(TUint32), pWiLink6nvs, WiLink6nvsSize);
+  	
+    TempPtr +=  WiLink6nvsSize;
+
+    /*Write Radio length*/
+    *(TUint32*)TempPtr = WiLink6radioSize;
+    TempPtr+= 4;
+    /* Get Radio position pointer*/
+    pWiLink6radio = ipaData + 2*sizeof(TUint32)+ WiLink6nvsSize;
+    /*This values need to be impoerted from  Radio module team*/
+    /* Changed from: FillRadioData(pWiLink6radio); */
+    Mem::Copy(pWiLink6radio, pWiLink6NvsRadio, WiLink6radioSize);
+
+    TempPtr += WiLink6radioSize;
+
+    /*Write FW length*/
+    *(TUint32*)TempPtr = WiLink6fwSize;
+    TempPtr+= 4;
+       
+	/* Copy Firmware to correct position*/
+    if (WiLink6fwSize != 0)
+    {
+    Mem::Copy(ipaData + 3*sizeof(TUint32) + WiLink6nvsSize + WiLink6radioSize, pWiLink6fw, WiLink6fwSize);
+    }
+    
+    /* Updated given pointer to just built pointer */
+	*ppNvsData = ipaData;
+}
+
+
+/****************************************************************************
+ *                     GetMacAddress
+ ****************************************************************************
+ * DESCRIPTION: get MAC address from NVS 
+ * 
+ * INPUTS:   
+ * 
+ * OUTPUT:  MacAddress
+ * 
+ * RETURNS: OK
+ ****************************************************************************/
+TInt CWlanHwInitMain::GetMacAddress(TMacAddr& aMacAddress)
+{
+    const TUint8*   pWiLink6nvs;
+
+     if (IsMMCNvsFound()) 
+     {
+         pWiLink6nvs = reinterpret_cast<const TUint8*>( pNvsMC->Ptr() );    
+     }
+     else
+     {  
+         pWiLink6nvs = WiLink6_nvs;
+     }
+
+    aMacAddress.iMacAddress[0] = pWiLink6nvs[11];
+    aMacAddress.iMacAddress[1] = pWiLink6nvs[10];
+    aMacAddress.iMacAddress[2] = pWiLink6nvs[6];
+    aMacAddress.iMacAddress[3] = pWiLink6nvs[5];
+    aMacAddress.iMacAddress[4] = pWiLink6nvs[4];
+    aMacAddress.iMacAddress[5] = pWiLink6nvs[3];
+
+	return KErrNone;
+}
+
+
+/****************************************************************************
+ *                     FillRadioData
+ ****************************************************************************
+ * DESCRIPTION: fill Radio params , in future will be done by Radio scope
+ * 
+ * INPUTS:   
+ * 
+ * OUTPUT:  radio params
+ * 
+ * RETURNS: OK
+ ****************************************************************************/
+void CWlanHwInitMain::FillRadioData(TUint8 *WiLink6radio)
+{
+TAutoRadioIniParams *pRadioParams;
+
+   pRadioParams = (TAutoRadioIniParams*)(WiLink6radio);
+
+   pRadioParams->tGeneralParams.TXBiPFEMAutoDetect = FEM_AUTO_DETECT_MODE_E;
+   pRadioParams->tGeneralParams.TXBiPFEMManufacturer = FEM_TRIQUINT_TYPE_E;   
+
+   pRadioParams->tGeneralParams.RefClk = REF_CLK_38_4_E;                                 
+   pRadioParams->tGeneralParams.SettlingTime = 5;                                                                 
+   pRadioParams->tGeneralParams.ClockValidOnWakeup = REF_CLK_NOT_VALID_E;                      
+   pRadioParams->tGeneralParams.DC2DCMode = BT_SPI_IS_NOT_USED_E;                               
+   pRadioParams->tGeneralParams.Single_Dual_Band_Solution = SINGLE_BAND_SOLUTION_E;  
+   
+   pRadioParams->tStatRadioParams.RxTraceInsertionLoss_2_4G = 0;
+   pRadioParams->tStatRadioParams.TXTraceLoss_2_4G  = 0;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[0] = 0xEC;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[1] = 0xF6;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[2] = 0x00;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[3] = 0x0C;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[4] = 0x18;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[5] = 0xF8;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[6] = 0xFC;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[7] = 0x00;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[8] = 0x08;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[9] = 0x10;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[10] = 0xF0;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[11] = 0xF8;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[12] = 0x00;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[13] = 0x0A;
+   pRadioParams->tStatRadioParams.RxRssiAndProcessCompensation_2_4G[14] = 0x14;
+   
+/* RMFD deafult value */
+   if (pRadioParams->tGeneralParams.Single_Dual_Band_Solution == DUAL_BAND_SOLUTION_E)
+   {   
+        pRadioParams->tDynRadioParams[0].TXBiPReferencePDvoltage_2_4G = 0 ;									
+        pRadioParams->tDynRadioParams[0].TxBiPReferencePower_2_4G = 0;																				
+        pRadioParams->tDynRadioParams[0].TxBiPOffsetdB_2_4G = 0;																							
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29;							
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25;							
+        for (int i=0; i<NUMBER_OF_2_4_G_CHANNELS;i++)
+        {
+            pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50;
+            pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50;
+        }
+           
+        pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20;
+        pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20;
+        memset(&pRadioParams->tDynRadioParams[0].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E);												
+        for (int i=0; i<NUMBER_OF_RATE_GROUPS_E;i++)
+        {
+            pRadioParams->tDynRadioParams[0].TxIbiasTable_2_4G[i] = 0x0E;
+        }
+        pRadioParams->tDynRadioParams[0].TxIbiasTable_2_4G[5] = 0x17;
+        pRadioParams->tDynRadioParams[0].RxFemInsertionLoss_2_4G = 0x0D;    								
+   }
+   else
+   {
+        pRadioParams->tDynRadioParams[0].TXBiPReferencePDvoltage_2_4G =0x24E ;									
+        pRadioParams->tDynRadioParams[0].TxBiPReferencePower_2_4G = 0x78;																				
+        pRadioParams->tDynRadioParams[0].TxBiPOffsetdB_2_4G = 0;																							
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29;							
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24;
+        pRadioParams->tDynRadioParams[0].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25;							
+        for (int i =0;i<NUMBER_OF_2_4_G_CHANNELS;i++)
+        {
+            pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50;
+            pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50;
+        }
+        pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20;
+        pRadioParams->tDynRadioParams[0].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20;   
+        memset(&pRadioParams->tDynRadioParams[0].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E);	
+        for (int i = 0 ;i <NUMBER_OF_RATE_GROUPS_E;i++) 
+        {
+            pRadioParams->tDynRadioParams[0].TxIbiasTable_2_4G[i] = 0x1A;
+        }
+       
+        pRadioParams->tDynRadioParams[0].TxIbiasTable_2_4G[5] = 0x2F;
+        pRadioParams->tDynRadioParams[0].RxFemInsertionLoss_2_4G = 0;	
+    
+        /* TriQuint default value */
+        pRadioParams->tDynRadioParams[1].TXBiPReferencePDvoltage_2_4G= 0x168;									
+        pRadioParams->tDynRadioParams[1].TxBiPReferencePower_2_4G= 0x83;																				
+        pRadioParams->tDynRadioParams[1].TxBiPOffsetdB_2_4G=0;																							
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[0] = 0x1E;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[1] = 0x1F;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[2] = 0x22;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[3] = 0x24;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[4] = 0x28;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Normal[5] = 0x29;							
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[0] = 0x1B;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[1] = 0x1C;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[2] = 0x1E;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[3] = 0x20;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[4] = 0x24;
+        pRadioParams->tDynRadioParams[1].TxPerRatePowerLimits_2_4G_Degraded[5] = 0x25;	
+        for (int i =0;i<NUMBER_OF_2_4_G_CHANNELS;i++)
+        {
+            pRadioParams->tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_11b[i] = 0x50;
+            pRadioParams->tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[i] = 0x50;
+        }
+        pRadioParams->tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[0] = 0x20;
+        pRadioParams->tDynRadioParams[1].TxPerChannelPowerLimits_2_4G_OFDM[10] = 0x20;  
+        memset(&pRadioParams->tDynRadioParams[1].TxPDVsRateOffsets_2_4G[0],0,NUMBER_OF_RATE_GROUPS_E); 
+         for (int i = 0 ;i <NUMBER_OF_RATE_GROUPS_E;i++) 
+        {
+            pRadioParams->tDynRadioParams[1].TxIbiasTable_2_4G[i] = 0x11;
+        }
+      
+        pRadioParams->tDynRadioParams[1].TxIbiasTable_2_4G[5] = 0x12; 													
+        pRadioParams->tDynRadioParams[1].RxFemInsertionLoss_2_4G = 0x12;  
+   }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/common/inc/IPCKernelApi.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,50 @@
+/*
+ * IPCKernelApi.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/common/inc/WlanDrvCommon.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,120 @@
+/*
+ * WlanDrvCommon.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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_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;
+
+    /* 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__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/common/inc/cli_cu_common.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,105 @@
+/*
+ * cli_cu_common.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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"
+
+#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
+
+
+#ifndef print_err
+# define print_err(fmt, arg...) fprintf(stderr, fmt, ##arg)
+#endif
+
+
+#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 */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/common/inc/osApi.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,625 @@
+/*
+ * osApi.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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"
+#include "OsApiDepend.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;
+
+#define OS_PAGE_SIZE 4096
+#define MAX_MESSAGE_SIZE        500
+#define MICROSECOND_IN_SECONDS  1000000
+
+/****************************************************************************************
+						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);
+
+/****************************************************************************************
+ *						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,TI_BOOL MemoryType);
+
+/** \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_INT32 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);
+
+#ifdef DRIVER_PROFILING
+/** \brief  OS Profile
+ * 
+ * \param  OsContext 	- Handle to the OS object
+ * \param  fn 			- 
+ * \param  par 			- 
+ * \return void
+ * 
+ * \par Description
+ * 
+ * \sa
+ */
+  void _os_profile (TI_HANDLE OsContext, TI_UINT32 fn, TI_UINT32 par);
+  #define os_profile(hos,fn,par) _os_profile (hos, fn, par)
+#else
+  #define os_profile(hos,fn,par)
+#endif
+
+
+/****************************************************************************************
+						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);
+
+/****************************************************************************************
+						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 Send Packet
+ * 
+ * \param  OsContext 	- Handle to the OS object
+ * \param  pPacket 		- Pointer to sent packet data
+ * \param  Length 		- Length of sent packet
+ * \return TI_TRUE on Success	;	TI_FALSE on Failure
+ * 
+ * \par Description
+ * This function transfers a packet from OS to WLAN driver
+ * 
+ * \sa
+ */
+TI_INT32 os_sendPacket (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);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __OS_API_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/common/inc/osDebug.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,144 @@
+/*
+ * osDebug.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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
+#define DbgPrint printf
+
+
+#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_*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/common/inc/osRgstry.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,82 @@
+/*
+ * osRgstry.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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
+    );
+
+void regReadParameters (TWlanDrvIfObjPtr pAdapter);
+
+
+#ifdef TI_DBG
+
+void
+regReadLastDbgState(
+    TWlanDrvIfObjPtr pAdapter
+    );
+
+
+#endif
+
+#endif      /* __OSRGSTRY_H_*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/common/inc/spi_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,92 @@
+/*
+ * spi_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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
+ *
+ * Copyright (C) 2006 Texas Instruments, Inc.
+ *
+ * Acknowledgements:
+ *   None
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation version 2.
+ *
+ * This program is distributed “as is” WITHOUT ANY WARRANTY of any kind,
+ * whether express or implied; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ */
+
+#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 */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/platforms/os/common/inc/tracebuf_api.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,85 @@
+/*
+ * tracebuf_api.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/802_11Defs.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1227 @@
+/*
+ * 802_11Defs.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  802_11Defs.h
+ *   PURPOSE: Contains 802.11 defines/structures
+ *
+ ****************************************************************************/
+
+#ifndef _802_11_INFO_DEFS_H
+#define _802_11_INFO_DEFS_H
+
+#include "tidef.h"
+#include "osDot11.h"
+#ifdef XCC_MODULE_INCLUDED
+#include "osdot11XCC.h"
+#endif
+
+#define DOT11_OUI_LEN                       3
+#define DOT11_COUNTRY_STRING_LEN            3
+#define DOT11_MAX_SUPPORTED_RATES           32
+
+/* Maximum size of beacon or probe-request information element */
+#define DOT11_WSC_PROBE_REQ_MAX_LENGTH 80
+
+
+typedef enum
+{
+    DOT11_B_MODE    = 1,
+    DOT11_A_MODE    = 2,
+    DOT11_G_MODE    = 3,
+    DOT11_DUAL_MODE = 4,
+    DOT11_N_MODE    = 5,
+
+    DOT11_MAX_MODE
+
+} EDot11Mode;
+
+
+/* FrameControl field of the 802.11 header  */
+
+/**/
+/* bit 15    14     13     12     11     10      9     8     7-4     3-2      1-0*/
+/* +-------+-----+------+-----+-------+------+------+----+---------+------+----------+*/
+/* | Order | WEP | More | Pwr | Retry | More | From | To | Subtype | Type | Protocol |*/
+/* |       |     | Data | Mgmt|       | Frag | DS   | DS |         |      | Version  |*/
+/* +-------+-----+------+-----+-------+------+------+----+---------+------+----------+*/
+/*     1      1      1     1      1       1      1     1       4       2        2*/
+
+
+#define DOT11_FC_PROT_VERSION_MASK   ( 3 << 0 )
+#define DOT11_FC_PROT_VERSION        ( 0 << 0 )
+
+#define DOT11_FC_TYPE_MASK           ( 3 << 2 )
+typedef enum
+{
+  DOT11_FC_TYPE_MGMT         = ( 0 << 2 ),
+  DOT11_FC_TYPE_CTRL         = ( 1 << 2 ),
+  DOT11_FC_TYPE_DATA         = ( 2 << 2 )
+} dot11_Fc_Type_e;
+
+#define DOT11_FC_SUB_MASK           ( 0x0f << 4 )
+typedef enum
+{
+  /* Management subtypes */
+  DOT11_FC_SUB_ASSOC_REQ     = (    0 << 4 ),
+  DOT11_FC_SUB_ASSOC_RESP    = (    1 << 4 ),
+  DOT11_FC_SUB_REASSOC_REQ   = (    2 << 4 ),
+  DOT11_FC_SUB_REASSOC_RESP  = (    3 << 4 ),
+  DOT11_FC_SUB_PROBE_REQ     = (    4 << 4 ),
+  DOT11_FC_SUB_PROBE_RESP    = (    5 << 4 ),
+  DOT11_FC_SUB_BEACON        = (    8 << 4 ),
+  DOT11_FC_SUB_ATIM          = (    9 << 4 ),
+  DOT11_FC_SUB_DISASSOC      = (   10 << 4 ),
+  DOT11_FC_SUB_AUTH          = (   11 << 4 ),
+  DOT11_FC_SUB_DEAUTH        = (   12 << 4 ),
+  DOT11_FC_SUB_ACTION        = (   13 << 4 ),
+
+  /* Control subtypes */
+  DOT11_FC_SUB_BAR                    = (    8 << 4 ),
+  DOT11_FC_SUB_BA                     = (    9 << 4 ),
+  DOT11_FC_SUB_PS_POLL                = (   10 << 4 ),
+  DOT11_FC_SUB_RTS                    = (   11 << 4 ),
+  DOT11_FC_SUB_CTS                    = (   12 << 4 ),
+  DOT11_FC_SUB_ACK                    = (   13 << 4 ),
+  DOT11_FC_SUB_CF_END                 = (   14 << 4 ),
+  DOT11_FC_SUB_CF_END_CF_ACK          = (   15 << 4 ),
+
+  /* Data subtypes */
+  DOT11_FC_SUB_DATA                   = (    0 << 4 ),
+  DOT11_FC_SUB_DATA_CF_ACK            = (    1 << 4 ),
+  DOT11_FC_SUB_DATA_CF_POLL           = (    2 << 4 ),
+  DOT11_FC_SUB_DATA_CF_ACK_CF_POLL    = (    3 << 4 ),
+  DOT11_FC_SUB_NULL_FUNCTION          = (    4 << 4 ),
+  DOT11_FC_SUB_CF_ACK                 = (    5 << 4 ),
+  DOT11_FC_SUB_CF_POLL                = (    6 << 4 ),
+  DOT11_FC_SUB_CF_ACK_CF_POLL         = (    7 << 4 ),
+  DOT11_FC_SUB_DATA_QOS               = (    8 << 4 ),
+  DOT11_FC_SUB_DATA_NULL_QOS          = (   12 << 4 )
+} dot11_Fc_Sub_Type_e;
+
+#define  DOT11_FC_TYPESUBTYPE_MASK    ( DOT11_FC_TYPE_MASK | DOT11_FC_SUB_MASK )
+typedef enum
+{
+  DOT11_FC_ASSOC_REQ           = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_ASSOC_REQ           ),
+  DOT11_FC_ASSOC_RESP          = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_ASSOC_RESP          ),
+  DOT11_FC_REASSOC_REQ         = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_REASSOC_REQ         ),
+  DOT11_FC_REASSOC_RESP        = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_REASSOC_RESP        ),
+  DOT11_FC_PROBE_REQ           = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_PROBE_REQ           ),
+  DOT11_FC_PROBE_RESP          = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_PROBE_RESP          ),
+  DOT11_FC_BEACON              = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_BEACON              ),
+  DOT11_FC_ATIM                = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_ATIM                ),
+  DOT11_FC_DISASSOC            = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_DISASSOC            ),
+  DOT11_FC_AUTH                = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_AUTH                ),
+  DOT11_FC_DEAUTH              = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_DEAUTH              ),
+  DOT11_FC_ACTION              = ( DOT11_FC_TYPE_MGMT | DOT11_FC_SUB_ACTION              ),
+  DOT11_FC_PS_POLL             = ( DOT11_FC_TYPE_CTRL | DOT11_FC_SUB_PS_POLL             ),
+  DOT11_FC_RTS                 = ( DOT11_FC_TYPE_CTRL | DOT11_FC_SUB_RTS                 ),
+  DOT11_FC_CTS                 = ( DOT11_FC_TYPE_CTRL | DOT11_FC_SUB_CTS                 ),
+  DOT11_FC_ACK                 = ( DOT11_FC_TYPE_CTRL | DOT11_FC_SUB_ACK                 ),
+  DOT11_FC_CF_END              = ( DOT11_FC_TYPE_CTRL | DOT11_FC_SUB_CF_END              ),
+  DOT11_FC_CF_END_CF_ACK       = ( DOT11_FC_TYPE_CTRL | DOT11_FC_SUB_CF_END_CF_ACK       ),
+  DOT11_FC_DATA                = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_DATA                ),
+  DOT11_FC_DATA_CF_ACK         = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_DATA_CF_ACK         ),
+  DOT11_FC_DATA_CF_POLL        = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_DATA_CF_POLL        ),
+  DOT11_FC_DATA_CF_ACK_CF_POLL = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_DATA_CF_ACK_CF_POLL ),
+  DOT11_FC_DATA_NULL_FUNCTION  = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_NULL_FUNCTION       ),
+  DOT11_FC_CF_ACK              = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_CF_ACK              ),
+  DOT11_FC_CF_POLL             = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_CF_POLL             ),
+  DOT11_FC_CF_ACK_CF_POLL      = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_CF_ACK_CF_POLL      ),
+  DOT11_FC_DATA_QOS            = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_DATA_QOS            ),
+  DOT11_FC_DATA_NULL_QOS       = ( DOT11_FC_TYPE_DATA | DOT11_FC_SUB_DATA_NULL_QOS       )
+} dot11_Fc_Type_Sub_Type_e;
+
+typedef enum
+{
+  DOT11_FC_TO_DS               = ( 1 << 8  ),
+  DOT11_FC_FROM_DS             = ( 1 << 9  ),
+  DOT11_FC_MORE_FRAG           = ( 1 << 10 ),
+  DOT11_FC_RETRY               = ( 1 << 11 ),
+  DOT11_FC_PWR_MGMT            = ( 1 << 12 ),
+  DOT11_FC_MORE_DATA           = ( 1 << 13 ),
+  DOT11_FC_WEP                 = ( 1 << 14 ),
+  DOT11_FC_ORDER               = ( 1 << 15 )
+} dot11_Fc_Other_e;
+
+typedef enum
+{
+  DOT11_CAPABILITY_ESS               = ( 1 ),
+  DOT11_CAPABILITY_IESS              = ( 1 << 1 ),
+  DOT11_CAPABILITY_CF_POLLABE        = ( 1 << 2 ),
+  DOT11_CAPABILITY_CF_POLL_REQ       = ( 1 << 3 ),
+  DOT11_CAPABILITY_PRIVACY           = ( 1 << 4 ),
+  DOT11_CAPABILITY_PREAMBLE          = ( 1 << 5 ),
+  DOT11_CAPABILITY_PBCC              = ( 1 << 6 ),
+  DOT11_CAPABILITY_AGILE             = ( 1 << 7 )
+} dot11_Capability_e;
+
+#define  DOT11_FC_TO_DS_SHIFT        8
+#define  DOT11_FC_FROM_DS_SHIFT      9
+#define  DOT11_FC_MORE_FRAG_SHIFT   10
+#define  DOT11_FC_RETRY_SHIFT       11
+#define  DOT11_FC_PWR_MGMT_SHIFT    12
+#define  DOT11_FC_MORE_DATA_SHIFT   13
+#define  DOT11_FC_WEP_SHIFT         14
+#define  DOT11_FC_ORDER_SHIFT       15
+
+#define IS_WEP_ON(fc)       ((1 << DOT11_FC_WEP_SHIFT) & (fc))
+#define IS_DATA(fc)         (((DOT11_FC_TYPE_MASK) & (fc)) == DOT11_FC_TYPE_DATA)
+#define IS_CTRL(fc)         (((DOT11_FC_TYPE_MASK) & (fc)) == DOT11_FC_TYPE_CTRL)
+#define IS_MGMT(fc)         (((DOT11_FC_TYPE_MASK) & (fc)) == DOT11_FC_TYPE_MGMT)
+#define IS_LEGACY_DATA(fc)  (((DOT11_FC_TYPESUBTYPE_MASK) & (fc)) == DOT11_FC_DATA)
+#define IS_AUTH(fc)         (((DOT11_FC_AUTH) & (fc)) == DOT11_FC_AUTH)
+#define IS_QOS_FRAME(fc)    ((((fc) & (DOT11_FC_TYPESUBTYPE_MASK)) == DOT11_FC_DATA_QOS)   ||   \
+                             (((fc) & (DOT11_FC_TYPESUBTYPE_MASK)) == DOT11_FC_DATA_NULL_QOS) )
+#define IS_HT_FRAME(fc)     ((fc) & (DOT11_FC_ORDER))
+
+
+
+#define TUs_TO_MSECs(x)     (((x) << 10) / 1000)
+
+#define TIME_STAMP_LEN  8
+
+/* SequenceControl field of the 802.11 header */
+/**/
+/* bit    15 - 4           3 - 0*/
+/* +-------------------+-----------+*/
+/* |  Sequence Number  | Fragment  |*/
+/* |                   |  Number   |*/
+/* +-------------------+-----------+*/
+/*         12                4*/
+
+typedef enum
+{
+  DOT11_SC_FRAG_NUM_MASK = ( 0xf   << 0 ),
+  DOT11_SC_SEQ_NUM_MASK  = ( 0xfff << 4 )
+} dot11_Sc_t;
+
+/* QoS Control field of the 802.11 header */
+#define DOT11_QOS_CONTROL_FIELD_TID_BITS    0x000f
+#define DOT11_QOS_CONTROL_FIELD_A_MSDU_BITS 0x0080
+
+#define DOT11_QOS_CONTROL_ACK        0x0000
+#define DOT11_QOS_CONTROL_DONT_ACK   0x0020
+
+typedef struct
+{
+  TI_UINT16        fc;
+  TI_UINT16        duration;
+  TMacAddr         address1;
+  TMacAddr         address2;
+  TMacAddr         address3;
+  TI_UINT16        seqCtrl;
+  TI_UINT16        qosControl;
+/*  TMacAddr    address4;*/
+}  dot11_header_t;
+
+typedef struct
+{
+  TI_UINT16        fc;
+  TI_UINT16        duration;
+  TMacAddr         address1;
+  TMacAddr         address2;
+  TMacAddr         address3;
+  TI_UINT16        seqCtrl;
+} legacy_dot11_header_t;
+
+
+
+typedef struct
+{
+  TI_UINT16        fc;
+  TI_UINT16        duration;
+  TMacAddr         DA;
+  TMacAddr         SA;
+  TMacAddr         BSSID;
+  TI_UINT16        seqCtrl;
+} dot11_mgmtHeader_t;
+
+typedef struct
+{
+  TI_UINT8     DSAP;
+  TI_UINT8     SSAP;
+  TI_UINT8     Control;
+  TI_UINT8     OUI[3];
+  TI_UINT16    Type;
+} Wlan_LlcHeader_T;
+
+typedef struct
+{
+  TI_UINT16        fc;
+  TI_UINT16        AID;
+  TMacAddr         BSSID;
+  TMacAddr         TA;
+} dot11_PsPollFrameHeader_t;
+
+typedef struct
+{
+  TI_UINT16        fc;
+  TI_UINT16        duration;
+  TMacAddr         RA;
+  TMacAddr         TA;
+} dot11_BarFrameHeader_t;
+
+
+#define FCS_SIZE    4
+
+#define WLAN_HDR_LEN                            24
+#define WLAN_HT_HDR_LEN                         28
+#define WLAN_QOS_HDR_LEN                        26
+#define WLAN_QOS_HT_HDR_LEN                     30
+#define WLAN_QOS_HT_CONTROL_FIELD_LEN           4
+#define WLAN_SNAP_HDR_LEN                       8
+#define WLAN_WITH_SNAP_HEADER_MAX_SIZE          (WLAN_HDR_LEN + WLAN_SNAP_HDR_LEN)
+#define WLAN_WITH_SNAP_QOS_HEADER_MAX_SIZE      (WLAN_QOS_HDR_LEN + WLAN_SNAP_HDR_LEN)
+#define HT_CONTROL_SIZE							4
+
+#define GET_MAX_HEADER_SIZE(macHeaderPointer,headerSize)    \
+    if (IS_QOS_FRAME(*(TI_UINT16*)(macHeaderPointer)))      \
+    {\
+       if (IS_HT_FRAME(*(TI_UINT16*)(macHeaderPointer)))    \
+           *headerSize = WLAN_QOS_HT_HDR_LEN;               \
+       else                                                 \
+           *headerSize = WLAN_QOS_HDR_LEN;                  \
+     }\
+     else                                                   \
+     {\
+       if (IS_HT_FRAME(*(TI_UINT16*)(macHeaderPointer)))    \
+           *headerSize = WLAN_HT_HDR_LEN;                   \
+       else                                                 \
+           *headerSize = WLAN_HDR_LEN;                      \
+     }
+
+/****************************************************************************************
+    The next table is defined in 802.11 spec section 7.2.2 for the address field contents :
+    To DS   From DS     Address 1    Address 2  Address 3    Address 4
+    -------------------------------------------------------------------
+    0           0           DA          SA          BSSID       N/A
+    0           1           DA          BSSID       SA          N/A
+    1           0           BSSID       SA          DA          N/A
+    1           1           RA          TA          DA          SA         
+    
+NOTE: We only support packets coming from within the DS (i.e. From DS = 0)
+*****************************************************************************************/
+/* return the destination address used in *dot11_header_t */
+#define GET_DA_FROM_DOT11_HEADER_T(pDot11Hdr)   ((pDot11Hdr->fc & DOT11_FC_TO_DS) ? (pDot11Hdr->address3) : (pDot11Hdr->address1)) 
+
+
+/*
+ * MANAGEMENT
+ * -----------------
+ */
+
+/* mgmt body max length */
+#define MAX_MGMT_BODY_LENGTH                2312
+/* maximal length of beacon body - note that actual beacons may actually be longer
+   than this size, at least according to the spec, but so far no larger beacon was seen */
+#define MAX_BEACON_BODY_LENGTH              350
+
+/* general mgmt frame structure */
+typedef struct
+{
+    dot11_mgmtHeader_t  hdr;
+    TI_UINT8                body[MAX_MGMT_BODY_LENGTH];
+} dot11_mgmtFrame_t;
+
+/* Capabilities Information Field - IN THE AIR */
+/**/
+/*  bit  15      14       13         12        11         10      9      8      7   -   0*/
+/* +----------+------+----------+---------+----------+---------+------+-----+---------------+*/
+/* |  Channel |      |  Short   | Privacy | CF Poll  |   CF    |      |     |   RESERVED    |   */
+/* |  Agility | PBCC | Preamble |         | Request  | Pollable| IBSS | ESS |               |*/
+/* +----------+------+----------+---------+----------+---------+------+-----+---------------+   */
+/*       1        1       1          1         1          1       1      1*/
+
+
+/* Capabilities Information Field - IN THE MGMT SOFTWARE AFTER THE SWAP */
+/**/
+/* bit 15 - 8         7        6       5          4         3          2       1      0*/
+/* +------------+----------+------+----------+---------+----------+---------+------+-----+*/
+/* |            |  Channel |      |  Short   | Privacy | CF Poll  |   CF    |      |     |*/
+/* |  Reserved  |  Agility | PBCC | Preamble |         | Request  | Pollable| IBSS | ESS |*/
+/* +------------+----------+------+----------+---------+----------+---------+------+-----+*/
+/*       8            1        1       1          1         1          1       1      1*/
+
+
+
+typedef enum
+{ 
+  DOT11_CAPS_ESS             = ( 1 << 0 ),
+  DOT11_CAPS_IBSS            = ( 1 << 1 ),
+  DOT11_CAPS_CF_POLLABLE     = ( 1 << 2 ),
+  DOT11_CAPS_CF_POLL_REQUEST = ( 1 << 3 ),
+  DOT11_CAPS_PRIVACY         = ( 1 << 4 ),
+  DOT11_CAPS_SHORT_PREAMBLE  = ( 1 << 5 ),
+  DOT11_CAPS_PBCC            = ( 1 << 6 ),
+  DOT11_CAPS_CHANNEL_AGILITY = ( 1 << 7 ),
+  DOT11_SPECTRUM_MANAGEMENT  = ( 1 << 8 ),
+  DOT11_CAPS_QOS_SUPPORTED   = ( 1 << 9 ),
+  DOT11_CAPS_SHORT_SLOT_TIME = (1  << 10),
+
+  DOT11_CAPS_APSD_SUPPORT    = ( 1 << 11),
+
+  DOT11_CAPS_DELAYED_BA      = ( 1 << 14),
+  DOT11_CAPS_IMMEDIATE_BA    = ( 1 << 15)
+
+} dot11_capabilities_e;
+
+typedef enum 
+{
+    /* ESS */
+    CAP_ESS_MASK            = 1,
+    CAP_ESS_SHIFT           = 0,
+
+    /* IBSS */
+    CAP_IBSS_MASK           = 1,
+    CAP_IBSS_SHIFT          = 1,
+
+    /* CF Pollable */
+    CAP_CF_POLL_MASK        = 1,
+    CAP_CF_POLL_SHIFT       = 2,
+    
+    /* CF Poll request */
+    CAP_CF_REQ_MASK         = 1,
+    CAP_CF_REQ_SHIFT        = 3,
+    
+    /* Privacy */
+    CAP_PRIVACY_MASK        = 1,
+    CAP_PRIVACY_SHIFT       = 4,
+
+    /* Short Preamble*/
+    CAP_PREAMBLE_MASK       = 1,
+    CAP_PREAMBLE_SHIFT      = 5,
+    
+    /* PBCC */
+    CAP_PBCC_MASK           = 1,
+    CAP_PBCC_SHIFT          = 6,
+    
+    /* Agile */
+    CAP_AGILE_MASK          = 1,
+    CAP_AGILE_SHIFT         = 7,
+
+    /* Slot time */
+    CAP_SLOT_TIME_MASK      = 1,
+    CAP_SLOT_TIME_SHIFT     = 10,
+
+    /* APSD */
+    CAP_APSD_MASK           = 1,
+    CAP_APSD_SHIFT          = 11
+
+
+} wdrv_mgmtCapabilities_e;
+
+
+/*
+ * 802.11 Information elements
+ * ---------------------------
+ */
+
+typedef TI_UINT8 dot11_eleHdr_t[2];  /* Byte-0: IE-ID,  Byte-1: IE-Length  */
+
+/* fixed fields lengths, except of currentAP & timestamp*/
+#define FIX_FIELD_LEN       2
+
+/* SSID Information Element */
+#define DOT11_SSID_ELE_ID   0
+
+/* Max SSID length */
+#define DOT11_SSID_MAX_LEN  32
+
+typedef struct 
+{
+  dot11_eleHdr_t    hdr;
+  char              serviceSetId[DOT11_SSID_MAX_LEN];
+}  dot11_SSID_t;
+
+
+/* Supportted rates Information Element */
+#define DOT11_SUPPORTED_RATES_ELE_ID        1
+#define DOT11_EXT_SUPPORTED_RATES_ELE_ID        50
+typedef struct 
+{
+  dot11_eleHdr_t hdr;
+  TI_UINT8 rates[DOT11_MAX_SUPPORTED_RATES];
+}  dot11_RATES_t;
+
+
+#define ERP_IE_NON_ERP_PRESENT_MASK         0x1
+#define ERP_IE_USE_PROTECTION_MASK          0x2
+#define ERP_IE_BARKER_PREAMBLE_MODE_MASK    0x4
+#define DOT11_ERP_IE_ID 42
+typedef struct
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           ctrl;
+}  dot11_ERP_t;
+
+/* RSN Information Element */
+#define MAX_RSN_IE                          3
+#define DOT11_RSN_MAX                       255 
+typedef struct 
+{
+  dot11_eleHdr_t hdr;
+  TI_UINT8 rsnIeData[DOT11_RSN_MAX];
+}  dot11_RSN_t;
+
+/* General definitions needed by rsn.c */
+#define IV_FIELD_SIZE   4 
+#define ICV_FIELD_SIZE  4
+#define MIC_FIELD_SIZE  8 
+#define EIV_FIELD_SIZE  4
+#ifdef GEM_SUPPORT
+    #define GEM_KEY_IDX_FIELD_SIZE   1
+    #define GEM_RESERVED_FIELD_SIZE  1
+    #define GEM_PN_FIELD_SIZE   16
+    #define GEM_MIC_FIELD_SIZE  16
+#endif
+#define WEP_AFTER_HEADER_FIELD_SIZE  IV_FIELD_SIZE
+#define TKIP_AFTER_HEADER_FIELD_SIZE (IV_FIELD_SIZE + EIV_FIELD_SIZE)
+#define AES_AFTER_HEADER_FIELD_SIZE  8
+#ifdef GEM_SUPPORT
+    #define GEM_AFTER_HEADER_FIELD_SIZE (GEM_KEY_IDX_FIELD_SIZE + GEM_RESERVED_FIELD_SIZE + GEM_PN_FIELD_SIZE)
+    #define GEM_AFTER_HEADER_PAD    2
+    #define GEM_BUFFER_ALIGNMENT    2
+
+#endif
+
+
+/* DS params Information Element */
+#define DOT11_DS_PARAMS_ELE_ID      3
+#define DOT11_DS_PARAMS_ELE_LEN     1
+typedef struct 
+{
+  dot11_eleHdr_t hdr;
+  TI_UINT8  currChannel;
+}  dot11_DS_PARAMS_t;
+
+
+/* DS params Information Element */
+#define DOT11_IBSS_PARAMS_ELE_ID    6
+#define DOT11_IBSS_PARAMS_ELE_LEN   2
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT16          atimWindow;
+} dot11_IBSS_PARAMS_t;
+
+#define DOT11_FH_PARAMS_ELE_ID      2
+#define DOT11_FH_PARAMS_ELE_LEN     5
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT16          dwellTime;
+    TI_UINT8           hopSet;
+    TI_UINT8           hopPattern;
+    TI_UINT8           hopIndex;
+}  dot11_FH_PARAMS_t;
+
+/* tim Information Element */
+#define DOT11_TIM_ELE_ID    5
+#define DOT11_PARTIAL_VIRTUAL_BITMAP_MAX    251
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           dtimCount;
+    TI_UINT8           dtimPeriod;
+    TI_UINT8           bmapControl;
+    TI_UINT8           partialVirtualBmap[DOT11_PARTIAL_VIRTUAL_BITMAP_MAX];
+}  dot11_TIM_t;
+
+/* tim Information Element */
+#define DOT11_CF_ELE_ID             4
+#define DOT11_CF_PARAMS_ELE_LEN     6
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           cfpCount;
+    TI_UINT8           cfpPeriod;
+    TI_UINT16          cfpMaxDuration;
+    TI_UINT16          cfpDurRemain;
+} dot11_CF_PARAMS_t;
+
+/* Challenge text Information Element */
+#define DOT11_CHALLENGE_TEXT_ELE_ID     16
+#define DOT11_CHALLENGE_TEXT_MAX        253
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           text[ DOT11_CHALLENGE_TEXT_MAX ];
+}  dot11_CHALLENGE_t;
+
+
+#define DOT11_NUM_OF_MAX_TRIPLET_CHANNEL    32
+
+typedef struct
+{
+    TI_UINT8           firstChannelNumber;
+    TI_UINT8           numberOfChannels;
+    TI_UINT8           maxTxPowerLevel;
+} dot11_TripletChannel_t;
+
+typedef struct
+{
+    TI_UINT8                CountryString[DOT11_COUNTRY_STRING_LEN];
+    dot11_TripletChannel_t  tripletChannels[DOT11_NUM_OF_MAX_TRIPLET_CHANNEL];
+} dot11_countryIE_t;
+
+
+/* Country Inforamtion Element */
+#define DOT11_COUNTRY_ELE_ID        7
+#define DOT11_COUNTRY_ELE_LEN_MAX   ( ((DOT11_NUM_OF_MAX_TRIPLET_CHANNEL+1)*3) + !((DOT11_NUM_OF_MAX_TRIPLET_CHANNEL&0x1)))
+typedef struct 
+{
+    dot11_eleHdr_t    hdr;
+    dot11_countryIE_t countryIE;
+}  dot11_COUNTRY_t;
+
+
+/* Power Constraint Information Element */
+#define DOT11_POWER_CONSTRAINT_ELE_ID       (32)
+#define DOT11_POWER_CONSTRAINT_ELE_LEN      (1)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           powerConstraint;
+}  dot11_POWER_CONSTRAINT_t;
+
+
+
+/* Power Capability Information Element */
+#define DOT11_CAPABILITY_ELE_ID         (33)
+#define DOT11_CAPABILITY_ELE_LEN        (2)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           minTxPower;
+    TI_UINT8           maxTxPower;
+} dot11_CAPABILITY_t;
+
+/* TPC request Information Element */
+#define DOT11_TPC_REQUEST_ELE_ID        (34)
+#define DOT11_TPC_REQUEST_ELE_LEN       (0)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+}  dot11_TPC_REQUEST_t;
+
+/* TPC report Information Element */
+#define DOT11_TPC_REPORT_ELE_ID         (35)
+#define DOT11_TPC_REPORT_ELE_LEN        (2)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           transmitPower;
+    TI_UINT8           linkMargin;
+} dot11_TPC_REPORT_t;
+
+
+#ifdef  XCC_MODULE_INCLUDED
+
+/* Cell Transmit Power Information Element */
+#define DOT11_CELL_TP_ELE_ID            (150)
+#define DOT11_CELL_TP_ELE_LEN           (6)
+
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           oui[4];
+    TI_UINT8           power;
+    TI_UINT8           reserved;
+} dot11_CELL_TP_t;
+
+#define   DOT11_CELL_TP \
+    dot11_CELL_TP_t         *cellTP;
+    
+#else   /* XCC_MODULE_INCLUDED */
+
+#define   DOT11_CELL_TP
+
+#endif  /* XCC_MODULE_INCLUDED */
+
+
+/* Channel Supported Information Element */
+#define DOT11_CHANNEL_SUPPORTED_ELE_ID  (36)
+#define DOT11_CHANNEL_SUPPORTED_ELE_LEN (26)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           supportedChannel[DOT11_CHANNEL_SUPPORTED_ELE_LEN];
+
+} dot11_CHANNEL_SUPPORTED_t;
+
+/* Channel Switch Announcement Information Element */
+#define DOT11_CHANNEL_SWITCH_ELE_ID     (37)
+#define DOT11_CHANNEL_SWITCH_ELE_LEN    (3)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           channelSwitchMode;
+    TI_UINT8           channelNumber;
+    TI_UINT8           channelSwitchCount;
+}  dot11_CHANNEL_SWITCH_t;
+
+#define MAX_NUM_REQ (16)
+
+/* Measurement request Information Element */
+#define DOT11_MEASUREMENT_REQUEST_ELE_ID        (38)
+#define DOT11_MEASUREMENT_REQUEST_LEN           (2)
+#define DOT11_MEASUREMENT_REQUEST_ELE_LEN       (3 + DOT11_MEASUREMENT_REQUEST_LEN*MAX_NUM_REQ)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           measurementToken;
+    TI_UINT8           measurementMode;
+    TI_UINT8           measurementType;
+    TI_UINT8           measurementRequests[DOT11_MEASUREMENT_REQUEST_LEN*MAX_NUM_REQ];
+}  dot11_MEASUREMENT_REQUEST_t;
+
+
+/* Quiet Information Element */
+#define DOT11_QUIET_ELE_ID              (40)
+#define DOT11_QUIET_ELE_LEN             (6)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           quietCount;
+    TI_UINT8           quietPeriod;
+    TI_UINT16          quietDuration;
+    TI_UINT16          quietOffset;
+} dot11_QUIET_t;
+
+
+/* QoS Capability Information Element */
+#define DOT11_QOS_CAPABILITY_ELE_ID     (46)
+#define DOT11_QOS_CAPABILITY_ELE_LEN    (1)
+
+#define AC_APSD_FLAGS_MASK              (1)
+#define Q_ACK_BITG_MASK                 (1)
+#define MAX_SP_LENGTH_MASK              (3)
+#define MORE_DATA_ACK_MASK              (1)
+
+#define AC_VO_APSD_FLAGS_SHIFT          (0)
+#define AC_VI_APSD_FLAGS_SHIFT          (1)
+#define AC_BK_APSD_FLAGS_SHIFT          (2)
+#define AC_BE_APSD_FLAGS_SHIFT          (3)
+#define Q_ACK_FLAGS_SHIFT               (4)
+#define MAX_SP_LENGTH_SHIFT             (5)
+#define MORE_DATA_ACK_SHIFT             (7)
+
+#define QOS_CONTROL_UP_SHIFT            (0)
+
+#define AP_QOS_INFO_UAPSD_MASK          (1)
+#define AP_QOS_INFO_UAPSD_SHIFT         (7)
+
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           QosInfoField;
+}  dot11_QOS_CAPABILITY_IE_t;
+
+/* WPS Information Element */
+#define DOT11_WPS_ELE_ID    (221)
+#define DOT11_WPS_OUI       {0x00, 0x50, 0xF2, 0x04}
+#define DOT11_WPS_OUI_LEN   4
+
+/* WME Information Element */
+#define DOT11_WME_ELE_ID                (221)
+#define DOT11_WME_ELE_LEN               (7)
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           OUI[3];
+    TI_UINT8           OUIType;
+    TI_UINT8           OUISubType;
+    TI_UINT8           version;
+    TI_UINT8           ACInfoField;
+}  dot11_WME_IE_t;
+
+
+typedef struct
+{
+    TI_UINT8           ACI_AIFSN;
+    TI_UINT8           ECWmin_ECWmax;
+    TI_UINT16          TXOPLimit;
+} dot11_QOS_AC_IE_ParametersRecord_t;
+
+typedef struct
+{
+    dot11_QOS_AC_IE_ParametersRecord_t        ACBEParametersRecord;
+    dot11_QOS_AC_IE_ParametersRecord_t        ACBKParametersRecord;
+    dot11_QOS_AC_IE_ParametersRecord_t        ACVIParametersRecord;
+    dot11_QOS_AC_IE_ParametersRecord_t        ACVOParametersRecord;
+} dot11_ACParameters_t;
+
+
+/* WME Parameter Information Element */
+#define DOT11_WME_PARAM_ELE_ID          (221)
+#define DOT11_WME_PARAM_ELE_LEN         (24)
+typedef struct 
+{
+    dot11_eleHdr_t      hdr;
+    TI_UINT8               OUI[3];
+    TI_UINT8               OUIType;
+    TI_UINT8               OUISubType;
+    TI_UINT8               version;
+    TI_UINT8               ACInfoField;
+    TI_UINT8               reserved;
+    dot11_ACParameters_t   WME_ACParameteres;
+}  dot11_WME_PARAM_t;
+
+
+/* 802.11n HT Information Element */
+#define DOT11_HT_CAPABILITIES_ELE_LEN    (26)
+#define DOT11_HT_INFORMATION_ELE_LEN    (22)
+
+#define DOT11_HT_CAPABILITIES_MCS_RATE_OFFSET   (3)
+#define DOT11_HT_INFORMATION_MCS_RATE_OFFSET    (6)
+
+typedef struct 
+{
+    dot11_eleHdr_t  tHdr;
+    TI_UINT8        aHtCapabilitiesIe[DOT11_HT_CAPABILITIES_ELE_LEN];   /* HT capabilities IE unparsed */
+}  Tdot11HtCapabilitiesUnparse;
+
+typedef struct 
+{
+    dot11_eleHdr_t  tHdr;
+    TI_UINT8        aHtInformationIe[DOT11_HT_INFORMATION_ELE_LEN];     /* HT Information IE unparsed */
+}  Tdot11HtInformationUnparse;
+
+/* BA session bits mask */
+#define DOT11_BAR_CONTROL_FIELD_TID_BITS            0xf000
+#define DOT11_BA_PARAMETER_SET_FIELD_TID_BITS       0x003C
+#define DOT11_BA_PARAMETER_SET_FIELD_WINSIZE_BITS   0xffC0
+#define DOT11_DELBA_PARAMETER_FIELD_TID_BITS        0xf000
+
+/* action field BA frames */
+typedef enum
+{
+    DOT11_BA_ACTION_ADDBA           = 0,
+    DOT11_BA_ACTION_DELBA           = 2
+} Edot11BaAction;
+
+
+/* WiFi Simple Config Information Element */
+#define DOT11_WSC_PARAM_ELE_ID          (221)
+
+#define DOT11_WSC_SELECTED_REGISTRAR_CONFIG_METHODS      0x1053
+#define DOT11_WSC_SELECTED_REGISTRAR_CONFIG_METHODS_PIN  0xC
+#define DOT11_WSC_SELECTED_REGISTRAR_CONFIG_METHODS_PBC  0x80
+
+#define DOT11_WSC_DEVICE_PASSWORD_ID      0x1012
+#define DOT11_WSC_DEVICE_PASSWORD_ID_PIN  0x0000
+#define DOT11_WSC_DEVICE_PASSWORD_ID_PBC  0x0004
+
+/* WiFi Simple Config Parameter Information Element */
+#define DOT11_WSC_PROBE_REQ_PARAM_ELE_LEN           (22)
+#define DOT11_WSC_BEACON_MAX_LENGTH 160
+
+typedef struct 
+{
+    dot11_eleHdr_t              hdr;
+    TI_UINT8                        OUI[3];
+    TI_UINT8                        OUIType;
+    TI_UINT8 WSCBeaconOrProbIE[DOT11_WSC_BEACON_MAX_LENGTH];
+}  dot11_WSC_t;
+
+#define dot11_WPA_OUI_TYPE                  (1)
+#define dot11_WME_OUI_TYPE                  (2)
+#define dot11_WSC_OUI_TYPE                  (4)
+#define dot11_WME_OUI_SUB_TYPE_IE           (0)
+#define dot11_WME_OUI_SUB_TYPE_PARAMS_IE    (1)
+#define dot11_WME_VERSION                   (1)
+#define dot11_WME_ACINFO_MASK               0x0f
+
+/* -------------------- TSPEC ----------------- */
+
+typedef struct
+{
+    TI_UINT8   tsInfoArr[3];
+
+}  tsInfo_t;
+
+
+
+/* This structure is part of the TSPEC structure. It was seperated since there are some cases (such as DEL_TS), which we dont need
+to send ALL the TSPEC structure, but only as far as TsInfo. The TSPEC structure contains this smaller structure */
+typedef struct
+{
+    dot11_eleHdr_t  hdr;
+    
+    TI_UINT8   OUI[3];
+    TI_UINT8   oui_type;
+    TI_UINT8   oui_subtype;
+    TI_UINT8   version;
+
+    tsInfo_t tsInfoField;
+}  dot11_WME_TSPEC_IE_hdr_t;
+
+typedef struct
+{
+
+    dot11_WME_TSPEC_IE_hdr_t tHdr;
+
+    TI_UINT16  nominalMSDUSize;
+    TI_UINT16  maximumMSDUSize;
+    TI_UINT32  minimumServiceInterval;
+    TI_UINT32  maximumServiceInterval;
+    TI_UINT32  inactivityInterval;
+    TI_UINT32  suspensionInterval;
+    TI_UINT32  serviceStartTime;
+    TI_UINT32  minimumDataRate;
+    TI_UINT32  meanDataRate;
+    TI_UINT32  peakDataRate;
+    TI_UINT32  maximumBurstSize;
+    TI_UINT32  delayBound;
+    TI_UINT32  minimumPHYRate;
+    TI_UINT16  surplusBandwidthAllowance;
+    TI_UINT16  mediumTime;
+
+} dot11_WME_TSPEC_IE_t;
+
+
+#define WME_TSPEC_IE_ID                         221
+#define WME_TSPEC_IE_LEN                        61
+#define WME_TSPEC_IE_TSINFO_LEN                 9                
+#define WME_TSPEC_IE_OUI_TYPE                   0x02
+#define WME_TSPEC_IE_OUI_SUB_TYPE               0x02
+#define WME_TSPEC_IE_VERSION                    0x01
+
+/* OUI TYPE values that can be present in management packets inside Cisco vendor specific IE */
+typedef enum
+{
+    TS_METRIX_OUI_TYPE = 0x07,
+    TS_RATE_SET_OUI_TYPE = 0x08,
+    EDCA_LIFETIME_OUI_TYPE = 0x09
+} XCC_IE_OUI_TYPE_t;
+
+#define ADDTS_REQUEST_ACTION                    0x00
+#define ADDTS_RESPONSE_ACTION                   0x01
+#define DELTS_ACTION                            0x02
+
+#define ADDTS_STATUS_CODE_SUCCESS               0x00
+#define DELTS_CODE_SUCCESS                      0x00
+ 
+
+#define TS_INFO_0_TRAFFIC_TYPE_MASK             0x01
+#define TS_INFO_0_TSID_MASK                     0x1E
+#define TS_INFO_0_DIRECTION_MASK                0x60
+#define TS_INFO_0_ACCESS_POLICY_MASK            0x80
+
+#define TS_INFO_1_ACCESS_POLICY_MASK            0x01
+#define TS_INFO_1_AGGREGATION_MASK              0x02
+#define TS_INFO_1_APSD_MASK                     0x04    
+#define TS_INFO_1_USER_PRIORITY_MASK            0x38
+#define TS_INFO_1_TSINFO_ACK_POLICY_MASK        0xC0
+
+#define TS_INFO_2_SCHEDULE_MASK                 0x01
+#define TS_INFO_2_RESERVED_MASK                 0xF7    
+
+#define TRAFFIC_TYPE_SHIFT                      0
+#define TSID_SHIFT                              1
+#define DIRECTION_SHIFT                         5
+#define ACCESS_POLICY_SHIFT                     7
+#define AGGREGATION_SHIFT                       1
+#define APSD_SHIFT                              2   
+#define USER_PRIORITY_SHIFT                     3
+#define TSINFO_ACK_POLICY_SHIFT                 6
+#define SCHEDULE_SHIFT                          0
+#define RESERVED_SHIFT                          1
+#define SURPLUS_BANDWIDTH_ALLOW                 13  
+
+#define TS_INFO_0_ACCESS_POLICY_EDCA            0x1                 
+#define NORMAL_ACKNOWLEDGEMENT                  0x00        
+#define NO_SCHEDULE                             0x00        
+#define PS_UPSD                                 0x01
+#define EDCA_MODE                               0x08
+#define FIX_MSDU_SIZE                           0x8000
+
+#define WPA_IE_OUI                              {0x00, 0x50, 0xf2}
+#define XCC_OUI                                 {0x00, 0x40, 0x96}
+
+/* Action field structure
+    used for extended management action such as spectrum management */ 
+typedef TI_UINT8 dot11_ACTION_FIELD_t[2];
+
+
+/* Management frames sub types */
+typedef enum
+{
+    ASSOC_REQUEST       = 0,
+    ASSOC_RESPONSE      = 1,
+    RE_ASSOC_REQUEST    = 2,
+    RE_ASSOC_RESPONSE   = 3,
+    PROBE_REQUEST       = 4,
+    PROBE_RESPONSE      = 5,
+    BEACON              = 8,
+    ATIM                = 9,
+    DIS_ASSOC           = 10,
+    AUTH                = 11,
+    DE_AUTH             = 12,
+    ACTION              = 13
+} dot11MgmtSubType_e;
+
+/* Management frames element IDs */
+typedef enum
+{
+    SSID_IE_ID                          = 0,
+    SUPPORTED_RATES_IE_ID               = 1,
+    FH_PARAMETER_SET_IE_ID              = 2,
+    DS_PARAMETER_SET_IE_ID              = 3,
+    CF_PARAMETER_SET_IE_ID              = 4,
+    TIM_IE_ID                           = 5,
+    IBSS_PARAMETER_SET_IE_ID            = 6,
+    COUNTRY_IE_ID                       = 7,
+    CHALLANGE_TEXT_IE_ID                = 16,
+    POWER_CONSTRAINT_IE_ID              = 32,
+    TPC_REPORT_IE_ID                    = 35,
+    CHANNEL_SWITCH_ANNOUNCEMENT_IE_ID   = 37,
+    QUIET_IE_ID                         = 40,
+    ERP_IE_ID                           = 42,
+    HT_CAPABILITIES_IE_ID               = 45,
+    QOS_CAPABILITY_IE_ID                = 46,
+    RSN_IE_ID                           = 48,
+    EXT_SUPPORTED_RATES_IE_ID           = 50,
+    HT_INFORMATION_IE_ID                = 61,
+    XCC_EXT_1_IE_ID                     = 133,
+    XCC_EXT_2_IE_ID                     = 149,  
+    CELL_POWER_IE                       = 150, /*XCC*/
+    WPA_IE_ID                           = 221
+
+} dot11MgmtIeId_e;
+
+/* Spectrum Management Action fields */
+typedef enum
+{
+    MEASUREMENT_REQUEST             = 0,
+    MEASUREMENT_REPORT              = 1,
+    TPC_REQUEST                     = 2,
+    TPC_REPORT                      = 3,
+    CHANNEL_SWITCH_ANNOUNCEMENT     = 4
+} dot11ActionFrameTypes_e;
+
+/* Category fields (such as apectrum management)*/
+typedef enum
+{
+    CATAGORY_SPECTRUM_MANAGEMENT        = 0,
+    CATAGORY_QOS                        = 1,
+    WME_CATAGORY_QOS                    = 17,
+    CATAGORY_SPECTRUM_MANAGEMENT_ERROR  = 128
+} dot11CategoryTypes_e;
+
+
+/* 
+ * Management templates to set to the HAL:
+ */
+
+#ifdef XCC_MODULE_INCLUDED
+
+    typedef struct  
+    {
+        dot11_mgmtHeader_t  hdr;
+        char                infoElements[sizeof( dot11_SSID_t ) + 
+                                         sizeof( dot11_RATES_t ) +
+                                         sizeof( dot11_RATES_t ) +
+                                         sizeof( Tdot11HtCapabilitiesUnparse ) +
+                                         sizeof( DOT11_WSC_PROBE_REQ_MAX_LENGTH ) +
+                                         sizeof( XCC_radioManagmentCapability_IE_t )
+                                        ];
+    } probeReqTemplate_t;
+
+#else /* XCC_MODULE_INCLUDED */
+
+    typedef struct  
+    {
+        dot11_mgmtHeader_t  hdr;
+        char                infoElements[sizeof( dot11_SSID_t ) + 
+                                         sizeof( dot11_RATES_t ) +
+                                         sizeof( dot11_RATES_t ) +
+                                         sizeof( Tdot11HtCapabilitiesUnparse ) +
+                                         sizeof( DOT11_WSC_PROBE_REQ_MAX_LENGTH )
+                                        ];
+    } probeReqTemplate_t;
+
+#endif /* XCC_MODULE_INCLUDED */
+
+
+typedef struct 
+{
+    dot11_mgmtHeader_t  hdr;
+    TI_UINT8               timeStamp[TIME_STAMP_LEN];
+    TI_UINT16              beaconInterval;
+    TI_UINT16              capabilities;
+    char                infoElements[ sizeof( dot11_SSID_t ) + 
+                                      sizeof( dot11_RATES_t ) +
+                                      sizeof( dot11_RATES_t ) +
+                                      sizeof( dot11_DS_PARAMS_t ) +
+                                      sizeof( dot11_COUNTRY_t)      ];
+}  probeRspTemplate_t;
+
+typedef struct 
+{
+    dot11_mgmtHeader_t  hdr;
+} nullDataTemplate_t;
+
+typedef struct 
+{
+    dot11_mgmtHeader_t  hdr;
+    TI_UINT16 disconnReason;
+} disconnTemplate_t; /* Deauth or Disassoc */
+
+typedef struct
+{
+   dot11_PsPollFrameHeader_t   hdr;
+} psPollTemplate_t;
+
+typedef struct
+{
+   dot11_header_t   hdr;
+}  QosNullDataTemplate_t;
+
+/* Traffic Stream Rate Set (TSRS) info-elements */
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           OUI[3];
+    TI_UINT8           oui_type;
+    TI_UINT8           tsid;
+    TI_UINT8           tsNominalRate;
+} dot11_TSRS_STA_IE_t;
+
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           OUI[3];
+    TI_UINT8           oui_type;
+    TI_UINT8           tsid;
+    TI_UINT8           tsRates[8];
+}  dot11_TSRS_IE_t;
+
+/* MSDU lifetime info-element */
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           OUI[3];
+    TI_UINT8           oui_type;
+    TI_UINT8           tsid;
+    TI_UINT16          msduLifeTime;
+}  dot11_MSDU_LIFE_TIME_IE_t;
+
+typedef struct 
+{
+    dot11_eleHdr_t  hdr;
+    TI_UINT8           OUI[3];
+    TI_UINT8           oui_type;
+    TI_UINT8           tsid;
+    TI_UINT8           state;
+    TI_UINT16          measureInterval;
+}  dot11_TS_METRICS_IE_t;
+
+typedef struct 
+{
+    dot11_TSRS_IE_t             *trafficStreamParameter;
+    dot11_MSDU_LIFE_TIME_IE_t   *edcaLifetimeParameter;
+    dot11_TS_METRICS_IE_t       *tsMetrixParameter;
+} XCCv4IEs_t;
+
+
+/* Measurement Report message frame structure */
+#define DOT11_MEASUREMENT_REPORT_ELE_ID     (39)
+#define DOT11_MAX_MEASUREMENT_REPORT_LEN    (4)
+#define DOT11_MIN_MEASUREMENT_REPORT_IE_LEN (3)
+#define DOT11_MEASUREMENT_REPORT_ELE_IE_LEN (DOT11_MIN_MEASUREMENT_REPORT_IE_LEN + DOT11_MAX_MEASUREMENT_REPORT_LEN*MAX_NUM_REQ)
+
+typedef struct
+{
+    dot11_ACTION_FIELD_t    actionField;
+    TI_UINT8   dialogToken;
+
+    dot11_eleHdr_t  hdr;
+    TI_UINT8            measurementToken;
+    TI_UINT8            measurementMode;
+    TI_UINT8            measurementType;
+    TI_UINT8            measurementReports[DOT11_MAX_MEASUREMENT_REPORT_LEN*MAX_NUM_REQ];
+}  MeasurementReportFrame_t;
+
+
+
+typedef enum 
+{
+    STATUS_SUCCESSFUL = 0,
+    STATUS_UNSPECIFIED,
+    STATUS_AUTH_REJECT,
+    STATUS_ASSOC_REJECT,
+    STATUS_SECURITY_FAILURE,
+    STATUS_AP_DEAUTHENTICATE,
+    STATUS_AP_DISASSOCIATE,
+    STATUS_ROAMING_TRIGGER,
+    STATUS_DISCONNECT_DURING_CONNECT,
+    STATUS_SG_RESELECT,
+    MGMT_STATUS_MAX_NUM
+} mgmtStatus_e;
+
+/* Used as a status code in case of STATUS_AUTH_REJECT or STATUS_ASSOC_REJECT that was not received at all */
+#define STATUS_PACKET_REJ_TIMEOUT   0xFFFF
+
+/* As defined in 802.11 spec section 7.3.1 - status codes for deAuth packet */
+#define STATUS_CODE_802_1X_AUTHENTICATION_FAILED 23
+
+/* map field included in measurement report IE (only in basic report) */
+typedef enum
+{
+  DOT11_BSS_ONLY                    = (0x01),
+  DOT11_OFDM_ONLY                   = (0x02),
+  DOT11_RADAR_AND_UNIDENTIFIED      = (0x0C)
+} dot11_Map_Sub_Field_e;
+
+
+typedef struct
+{
+   legacy_dot11_header_t dot11Header;
+   Wlan_LlcHeader_T  snapHeader;
+}  legacy_dot11_DataMsduHeader_t;
+
+
+#define WLAN_HEADER_TYPE_CONCATENATION 0x01
+#define WLAN_CONCAT_HEADER_LEN 2
+
+
+#endif   /* _802_11_INFO_DEFS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/CmdInterfaceCodes.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1314 @@
+/*
+ * CmdInterfaceCodes.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:   CmdInterfaceCodes.h											*/
+/*    PURPOSE:																*/
+/*																			*/
+/****************************************************************************/
+#ifndef _CMD_INTERFACE_CODES_H_
+#define _CMD_INTERFACE_CODES_H_
+
+/** \file  CmdInterfaceCodes.h 
+ * \brief Command Interface Codes 
+ * \n\n
+ * This file contains the definitions for the parameters that can be Set/Get from outside user.
+ * \n\n
+ */
+
+#include "TWDriver.h"
+
+/* defines */
+/***********/
+
+/* types */
+/*********/
+
+
+/* This file contains the definitions for the parameters that can be Set/Get from outside.
+    The parmeters that can be Set/Get from inside the driver only are defined in the file paramIn.h */
+
+/****************************************************************************
+                                PARAMETERS ISSUE
+    Each parameter in the system is defined as UINT32. The parameter
+    structue is as following:
+
+ bit   31   30 - 24     23    22 - 16    15 - 8       7 - 0
+    +-----+----------+-----+----------+-----------+-----------+
+    | Set | Reserved | Get | Reserved | Module    | Parameter |
+    | bit |          | bit |          | number    | number    |
+    +-----+----------+-----+----------+-----------+-----------+
+
+  The 'set' bit indicates whteher this parameter can be set from OS abstraction layer.
+  The 'get' bit indicates whteher this parameter can be get from OS abstraction layer.
+  (All the parameters can be Get/Set from insied the driver.)
+  The module number indicated who is the oner of the parameter.
+  The parameter number is the parameter unique number used to identify it.
+
+****************************************************************************/
+
+/** \def SET_BIT
+ * \brief Bitmaks of bit which indicates if the Command is SET Command
+ */
+#define	SET_BIT         			0x08000000
+/** \def GET_BIT
+ * \brief Bitmaks of bit which indicates if the Command is GET Command
+ */
+#define	GET_BIT				        0x00800000
+/** \def ASYNC_PARAM
+ * \brief Bitmaks of bit which indicates if the access to the Command Parameter is Async
+ */
+#define ASYNC_PARAM					0x00010000
+/** \def ALLOC_NEEDED_PARAM
+ * \brief Bitmaks of bit which indicates if that the data is not allocated in the paramInfo structure
+ */
+#define ALLOC_NEEDED_PARAM			0x00020000
+
+
+/** \def GET_PARAM_MODULE_NUMBER
+ * \brief Macro which gets the Parameter's Module Number from the second byte of x \n
+ * x should be taken from Module Parameters Enumeration
+ * sa EModuleParam
+ */
+#define GET_PARAM_MODULE_NUMBER(x)  ((x & 0x0000FF00) >> 8)
+/** \def IS_PARAM_ASYNC
+ * \brief Macro which returns True if access to the Command Parameter is Async \n
+ * Otherwise returns False
+ */
+#define IS_PARAM_ASYNC(x)			(x & ASYNC_PARAM)
+/** \def IS_ALLOC_NEEDED_PARAM
+ * \brief Macro which returns True if data is not allocated in the paramInfo structure \n
+ * (there is a need to allocate memory for data). Otherwise returns False
+ */
+#define IS_ALLOC_NEEDED_PARAM(x)	(x & ALLOC_NEEDED_PARAM)	
+/** \def IS_PARAM_FOR_MODULE
+ * \brief Macro which returns True if input param is for input module. \n
+ * Otherwise returns False
+ */
+#define IS_PARAM_FOR_MODULE(param, module)   ((param & 0x0000FF00) == module)
+
+/** \enum EModuleParam
+ * \brief Modules Parameters ID
+ * 
+ * \par Description
+ * This Enumeration defines all available Modules numbers. \n
+ * Note that the actual number is held in the second byte (E.g. 0x0000FF00). \n
+ * According to these numbers it is decided to which Module the Command Parameter is destined
+ * 
+ * \sa
+ */
+/* NOTICE! whenever you add a module, you have to increment MAX_PARAM_MODULE_NUMBER as well!!! */
+typedef enum
+{
+    DRIVER_MODULE_PARAM               	= 0x0000,	/**< Driver Module Number							*/
+    AUTH_MODULE_PARAM               	= 0x0100,	/**< Authentication Module Number					*/
+    ASSOC_MODULE_PARAM              	= 0x0200,	/**< Association Module Number	   					*/
+    RX_DATA_MODULE_PARAM            	= 0x0300,	/**< RX Data Module Number							*/
+    TX_CTRL_MODULE_PARAM            	= 0x0400,	/**< TX Control Module Number						*/
+    CTRL_DATA_MODULE_PARAM          	= 0x0500,	/**< Control Data Module Number						*/
+    SITE_MGR_MODULE_PARAM           	= 0x0600,	/**< Site Manager Module Number						*/
+    CONN_MODULE_PARAM               	= 0x0700,	/**< Connection Module Number						*/
+    RSN_MODULE_PARAM                	= 0x0800,	/**< Robust Security NW (RSN) Module Number			*/
+    ADM_CTRL_MODULE_PARAM           	= 0x0900,	/**< ADM Control Module Number						*/
+    TWD_MODULE_PARAM                	= 0x0A00,	/**< Report Module Number							*/
+    REPORT_MODULE_PARAM             	= 0x0B00,	/**< Report Module Number							*/
+    SME_MODULE_PARAM                    = 0x0C00,	/**< SME Module Number								*/
+    MLME_SM_MODULE_PARAM            	= 0x0D00,	/**< 802.11 MLME State-Machine Module Number  		*/
+    REGULATORY_DOMAIN_MODULE_PARAM  	= 0x0E00,	/**< Regulatory Domain Module Number 				*/
+    MEASUREMENT_MODULE_PARAM        	= 0x0F00,	/**< Measurement Module Number						*/
+    XCC_MANAGER_MODULE_PARAM        	= 0x1000,	/**< XCC Manager Module Number 						*/
+    ROAMING_MANAGER_MODULE_PARAM    	= 0x1100,	/**< Roaming Manager Module Number					*/
+    SOFT_GEMINI_PARAM               	= 0x1200,	/**< Soft Gemini Module Number						*/
+    QOS_MANAGER_PARAM               	= 0x1300,	/**< Quality Of Service (QoS) Manager Module Number	*/
+    POWER_MANAGER_PARAM             	= 0x1400,	/**< Power Manager Module Number					*/
+    SCAN_CNCN_PARAM                 	= 0x1500,	/**< Scan Concentrator Module Number				*/
+    SCAN_MNGR_PARAM                 	= 0x1600,	/**< Scan Manager Module Number						*/
+    MISC_MODULE_PARAM					= 0x1700,	/**< Misc. Module Number							*/
+    HEALTH_MONITOR_MODULE_PARAM         = 0x1800,	/**< Health Monitor Module Number					*/
+
+    /*
+    Last module - DO NOT TOUCH!
+    */
+    MODULE_PARAM_LAST_MODULE						/**< LAst Module - Dummy, mast be last				*/
+
+}   EModuleParam;
+
+/** \def MAX_PARAM_MODULE_NUMBER
+ * \brief Macro which returns the number of Parameters Modules
+ */
+#define MAX_PARAM_MODULE_NUMBER             (GET_PARAM_MODULE_NUMBER(MODULE_PARAM_LAST_MODULE))
+
+
+
+/** \enum EExternalParam
+ * \brief External Parameters
+ * 
+ * \par Description
+ * This Enumeation includes all the eaxternal parameters numbers which are used for Get/Set Commands. 
+ * Each module can have 256 parameters	\n
+ * PARAMETERS ISSUE:	\n
+ * Each parameter in the system is defined as UINT32. The parameter structue is as following:	\n
+ * bit 0 - 7: 		Parameter Number - number of parameter inside Module\n
+ * bit 8 - 15:		Module number - number of Module\n
+ * bit 16:			Async Bit - indicates if command is Async (ON) or Sync (OFF)\n
+ * bit 17:			Allocate Bit - indicates if allocation should be done for parameter (ON) or not (OFF)\n
+ * bit 18 - 22:		Reserved			\n
+ * bit 23:			Get Bit	- indicates if command is Get (ON) or not (OFF)	\n
+ * bit 24 - 26:		Reserved	\n
+ * bit 27:			Set Bit	- indicates if command is Set (ON) or not (OFF)	\n
+ * bit 28 - 31:		Reserved	\n\n
+ * The 'set' bit indicates whteher this parameter can be set from OS abstraction layer.
+ * The 'get' bit indicates whteher this parameter can be get from OS abstraction layer.
+ * (All the parameters can be Get/Set from insied the driver.)
+ * The module number indicated who is the oner of the parameter.
+ * The parameter number is the parameter unique number used to identify it.
+ *
+ * \sa
+ */
+ /* bit | 31 - 28  | 27  | 26 - 24  |  23 | 22 - 18  |    17    |  16   |  15 - 8   |   7 - 0   |
+ *      +----------+-----+----------+-----+----------+----------+-------+-----------+-----------+
+ *      | Reserved | Set | Reserved | Get | Reserved | Allocate | Async | Module    | Parameter |
+ *      |          | bit |          | bit |          |    bit   |  bit  | number    | number    |
+ *      +----------+-----+----------+-----+----------+----------+-------+-----------+-----------+
+ */
+typedef enum
+{
+	/* Driver General section */
+    DRIVER_INIT_PARAM                           =	SET_BIT |           DRIVER_MODULE_PARAM | 0x00,	/**< Driver Init Parameter (Driver General Set Command): \n
+																									* Used for setting driver defaults. Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x00\n
+																									* Module Number: Driver Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+    DRIVER_START_PARAM                          =	SET_BIT |           DRIVER_MODULE_PARAM | 0x01, /**< Driver Start Parameter (Driver General Set Command): \n
+																									* Used for Starting Driver. Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x01\n
+																									* Module Number: Driver Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+    DRIVER_STOP_PARAM                           =	SET_BIT |           DRIVER_MODULE_PARAM | 0x02, /**< Driver Stop Parameter (Driver General Set Command): \n
+																									* Used for Stopping Driver. Done Sync with no memory allocation \n
+																									* Parameter Number:	0x02\n
+																									* Module Number: Driver Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+    DRIVER_STATUS_PARAM                         =	          GET_BIT | DRIVER_MODULE_PARAM | 0x03, /**< Driver Status Parameter (Driver General Get Command): \n
+																									* Used for Getting Driver's Status (if running). Done Sync with no memory allocation\n																														Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x03\n
+																									* Module Number: Driver Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: OFF	\n
+																									*/
+    DRIVER_THREADID_PARAM                       =	          GET_BIT | DRIVER_MODULE_PARAM | 0x04, /**< Driver Thread ID Parameter (Driver General Get Command): \n
+																									* Used for Getting Driver's Thread ID. Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x04\n
+																									* Module Number: Driver Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: OFF	\n
+																									*/
+
+	/* Site manager section */	
+	SITE_MGR_DESIRED_CHANNEL_PARAM				=	SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x01,	/**< Site Manager Desired Channel Parameter (Site Manager Module Set/Get Command):\n 
+																										* Used for Setting/Getting desired Channel to/from OS abstraction layer\n 
+																										* Done Sync with no memory allocation \n
+																										* Parameter Number:	0x01\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+	SITE_MGR_DESIRED_SUPPORTED_RATE_SET_PARAM	=	SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x05,	/**< Site Manager Desired Supported Rate Set Parameter (Site Manager Module Set/Get Command):\n 
+																										* Used for Setting/Getting Desired Supported Rate to/from OS abstraction layer\n 
+																										* Done Sync with no memory allocation \n
+																										* Parameter Number:	0x05\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+	SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM		= 	SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x0A,	/**< Site Manager Desired Preamble Type Parameter (Site Manager Module Set/Get Command): \n 
+																										* Used for Setting/Getting Desired Preamble Type to/from OS abstraction layer\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x0A\	n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+	SITE_MGR_CURRENT_CHANNEL_PARAM              = 	SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x0E,	/**< Site Manager Current Channel Parameter (Site Manager Module Set/Get Command): \n 
+																										* Used for Setting/Getting Current Channel to/from OS abstraction layer\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x0E	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+	SITE_MGR_TI_WLAN_COUNTERS_PARAM            	=			  GET_BIT | SITE_MGR_MODULE_PARAM | 0x14,	/**< Site Manager TI WLAN Counters Parameter (Site Manager Module Get Command): \n 
+																										* Used for Getting TI WLAN Statistics Counters from OS abstraction layer\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x14	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/
+	SITE_MGR_EEPROM_VERSION_PARAM				=			  GET_BIT | SITE_MGR_MODULE_PARAM | 0x16,  	/**< Site Manager EEPROM Version Parameter (Site Manager Module Get Command): \n 
+																										* Used for Getting EEPROM Version from FW\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x16	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/ 
+	SITE_MGR_FIRMWARE_VERSION_PARAM				=			  GET_BIT | SITE_MGR_MODULE_PARAM | 0x17,	/**< Site Manager FW Version Parameter (Site Manager Module Get Command): \n 
+																										* Used for Getting FW Version from FW\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x17	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/ 
+	SITE_MGR_DESIRED_SLOT_TIME_PARAM			=	SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x1B,	/**< Site Manager Desired Slot Time Parameter (Site Manager Module Set/Get Command): \n 
+																										* Used for Getting Desired Slot Time from OS abstraction layer and Setting Desired Slot Time to FW\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x1B	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+	SITE_MGR_GET_AP_QOS_CAPABILITIES            =             GET_BIT | SITE_MGR_MODULE_PARAM | 0x2E,	/**< Site Manager Get AP QoS Cpabilities Parameter (Site Manager Module Get Command): \n  
+																										* Used for Getting AP QoS Cpabilities from OS abstraction layer\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x2E	\n
+																										* Module Number: Site Manager Module Number \n 
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/
+	SITE_MGR_CURRENT_TX_RATE_PARAM				=             GET_BIT | SITE_MGR_MODULE_PARAM | 0x32,	/**< Site Manager Current TX Rate Parameter (Site Manager Module Get Command): \n  
+																										* Used for Getting Current TX Rate from OS abstraction layer\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x32	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/
+	SITE_MGR_BSSID_FULL_LIST_PARAM				=			  GET_BIT | SITE_MGR_MODULE_PARAM | 0x34,	/**< Site Manager BSSID Full List Parameter (Site Manager Module Get Command): \n  
+																										* Used for Getting BSSID Full List from OS abstraction layer\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x34	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/
+	SITE_MGR_BEACON_FILTER_DESIRED_STATE_PARAM = 	SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x35,	/**< Site Manager Beacon Filter Desired State Parameter (Site Manager Module Set/Get Command): \n  
+																										* Used for Getting Beacon Filter Desired State from OS abstraction layer or Setting Beacon Filter Desired State to FW\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x35	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+    SITE_MGR_NETWORK_TYPE_IN_USE				=             GET_BIT | SITE_MGR_MODULE_PARAM | 0x36,	/**< Site Manager NW Type in Use Parameter (Site Manager Module Get Command): \n  
+																										* Used for Getting NW Type in Use from OS abstraction layer\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x36	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/
+
+	/* Simple Config module */
+	SITE_MGR_SIMPLE_CONFIG_MODE					= 	SET_BIT | GET_BIT | SITE_MGR_MODULE_PARAM | 0x38,	/**< Site Manager Simple Configuration Mode Parameter (Simple Configuration Module Set/Get Command): \n  
+																										* Used for Setting/Getting WiFi Simple Configuration Mode\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x38	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+    SITE_MGR_GET_PRIMARY_SITE					= 	          GET_BIT | SITE_MGR_MODULE_PARAM | 0x40,	/**< Site Manager Get Primary Site Parameter (Simple Configuration Module Get Command): \n  
+																										* Used for Getting Primary Site from OS abstraction layer\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x40	\n
+																										* Module Number: Site Manager Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/
+
+    SITE_MGR_PRIMARY_SITE_HT_SUPPORT			= 	          GET_BIT | SITE_MGR_MODULE_PARAM | 0x41,	/**< Site Manager check if the Primary Site support HT: \n  
+                                                                                                        * Used for check if the Primary Site support HT \n
+                                                                                                        * Done Sync with no memory allocation\n 
+                                                                                                        * Parameter Number:	0x41	\n
+                                                                                                        * Module Number: Site Manager Module Number \n
+                                                                                                        * Async Bit: OFF	\n
+                                                                                                        * Allocate Bit: OFF	\n
+                                                                                                        * GET Bit: ON	\n
+                                                                                                        * SET Bit: OFF	\n
+                                                                                                        */
+	/* CTRL data section */
+	CTRL_DATA_CURRENT_BSS_TYPE_PARAM			=	SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x04,	/**< Control Data Primary BSS Type Parameter (Control Data Module Set/Get Command): \n  
+																										* Used for Setting/Getting Primary BSS Type to/form Control Data Parameters\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x04	\n
+																										* Module Number: Control Data Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+    CTRL_DATA_MAC_ADDRESS						= 	          GET_BIT | CTRL_DATA_MODULE_PARAM | 0x08,	/**< Control Data MAC Address Parameter (Control Data Module Get Command): \n  
+																										* Used for Getting MAC Address form FW\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x08	\n
+																										* Module Number: Control Data Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/
+    CTRL_DATA_CLSFR_TYPE                        =			  GET_BIT | CTRL_DATA_MODULE_PARAM | 0x0D,	/**< Control Data Classifier Type Parameter (Control Data Module Set/Get Command): \n  
+																										* Used for Setting/Getting Classifier Type to/form Control Data (TX Data Queue) Parameters\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x0D	\n
+																										* Module Number: Control Data Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: OFF	\n
+																										*/
+    CTRL_DATA_CLSFR_CONFIG                      =	SET_BIT           | CTRL_DATA_MODULE_PARAM | 0x0E,	/**< Control Data Classifier Configure Parameter (Control Data Module Set Command): \n  
+																										* Used for adding Classifier entry to Control Data (TX Data Queue) Parameters\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x0E	\n
+																										* Module Number: Control Data Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: OFF	\n
+																										* SET Bit: ON	\n
+																										*/
+    CTRL_DATA_CLSFR_REMOVE_ENTRY                =	SET_BIT           | CTRL_DATA_MODULE_PARAM | 0x0F,	/**< Control Data Classifier Configure Parameter (Control Data Module Set Command): \n  
+																										* Used for removing Classifier entry from Control Data (TX Data Queue) Parameters\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x0F	\n
+																										* Module Number: Control Data Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: OFF	\n
+																										* SET Bit: ON	\n
+																										*/
+    CTRL_DATA_TRAFFIC_INTENSITY_THRESHOLD		=	SET_BIT | GET_BIT | CTRL_DATA_MODULE_PARAM | 0x15,	/**< Control Data Traffic Intensity Threshold Parameter (Control Data Module Set/Get Command): \n  
+																										* Used for Setting/Getting Traffic Intensity Threshold to/from Control Data (Traffic Intensity Threshold) Parameters\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x15	\n
+																										* Module Number: Control Data Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+    CTRL_DATA_TOGGLE_TRAFFIC_INTENSITY_EVENTS	=	SET_BIT           | CTRL_DATA_MODULE_PARAM | 0x16,	/**< Control Data Toggle Traffic Intensity Events Parameter (Control Data Module Set Command): \n  
+																										* Used for Toggle Traffic Intensity Events (turns ON/OFF traffic intensity notification events)	\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x16	\n
+																										* Module Number: Control Data Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: OFF	\n
+																										* SET Bit: ON	\n
+																										*/
+
+	/* SME SM section */    
+    SME_DESIRED_SSID_ACT_PARAM                  = SET_BIT | GET_BIT | SME_MODULE_PARAM	 | 0x01,		/**< SME Set SSID and start connection process (SME Module Set/Get Command): \n  
+																										* Used for set SSID and start connection or get current SSID \n 
+																										* Parameter Number:	0x01 \n
+																										* Module Number: SME Module Number \n
+																										* Async Bit: OFF \n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+
+    SME_RADIO_ON_PARAM                          = SET_BIT | GET_BIT | SME_MODULE_PARAM	 | 0x03,		/**< SME State-Machine Radio ON Parameter (SME Module Set/Get Command): \n  
+																										* Used for Setting new and generating State-Machine Event, or Getting current Radio ON\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x03	\n
+																										* Module Number: SME Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+    SME_CONNECTION_MODE_PARAM                   = SET_BIT | GET_BIT | SME_MODULE_PARAM   | 0x04,		/**< SME State-Machine Connection Mode Parameter (SME Module Set/Get Command): \n  
+																										* Used for Setting new Connection Mode (and generating disconnect State-Machine event) or Getting current Connection Mode\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x04	\n
+																										* Module Number: SME Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: ON	\n
+																										* SET Bit: ON	\n
+																										*/
+    SME_WSC_PB_MODE_PARAM                       = SET_BIT           | SME_MODULE_PARAM   | 0x07,		/**< SME State-Machine SME on the WPS Mode Parameter (SME Module Set Command): \n  
+																										* Used for updating the SME on the WPS mode\n
+																										* Done Sync with no memory allocation\n 
+																										* Parameter Number:	0x07	\n
+																										* Module Number: SME Module Number \n
+																										* Async Bit: OFF	\n
+																										* Allocate Bit: OFF	\n
+																										* GET Bit: OFF	\n
+																										* SET Bit: ON	\n
+																										*/
+
+    SME_DESIRED_SSID_PARAM                      = SET_BIT           | SME_MODULE_PARAM	 | 0x08,		/**< SME Set SSID without start connection process (SME Module Set Command): \n  
+                                                                                                        * Used for set SSID without connection \n 
+                                                                                                        * Parameter Number:	0x08 \n
+                                                                                                        * Module Number: SME Module Number \n
+                                                                                                        * Async Bit: OFF \n
+                                                                                                        * Allocate Bit: OFF	\n
+                                                                                                        * GET Bit: OFF	\n
+                                                                                                        * SET Bit: ON	\n
+                                                                                                        */
+
+	/* Scan Concentrator section */
+    SCAN_CNCN_START_APP_SCAN					= 	SET_BIT | 			SCAN_CNCN_PARAM | 0x01 | ALLOC_NEEDED_PARAM,	/**< Scan Concentrator Start Application Scan Parameter (Scan Concentrator Module Set Command): \n  
+																														* Used for start one-shot scan as running application scan client\n
+																														* Done Sync with memory allocation\n 
+																														* Parameter Number:	0x01	\n
+																														* Module Number: Scan Concentrator Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: ON	\n
+																														* GET Bit: OFF	\n
+																														* SET Bit: ON	\n
+																														*/
+    SCAN_CNCN_STOP_APP_SCAN                     =   SET_BIT |           SCAN_CNCN_PARAM | 0x02,							/**< Scan Concentrator Stop Application Scan Parameter (Scan Concentrator Module Set Command): \n  
+																														* Used for stop one-shot scan as running application scan client\n
+																														* Done Sync with no memory allocation\n 
+																														* Parameter Number:	0x02	\n
+																														* Module Number: Scan Concentrator Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: OFF	\n
+																														* GET Bit: OFF	\n
+																														* SET Bit: ON	\n
+																														*/
+    SCAN_CNCN_START_PERIODIC_SCAN               =   SET_BIT |           SCAN_CNCN_PARAM | 0x03 | ALLOC_NEEDED_PARAM,	/**< Scan Concentrator Start Periodic Scan Parameter (Scan Concentrator Module Set Command): \n  
+																														* Used for start periodic scan as running application scan client\n
+																														* Done Sync with memory allocation\n 
+																														* Parameter Number:	0x03	\n
+																														* Module Number: Scan Concentrator Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: ON	\n
+																														* GET Bit: OFF	\n
+																														* SET Bit: ON	\n
+																														*/
+    SCAN_CNCN_STOP_PERIODIC_SCAN                =   SET_BIT |           SCAN_CNCN_PARAM | 0x04,							/**< Scan Concentrator Stop Periodic Scan Parameter (Scan Concentrator Module Set Command): \n  
+																														* Used for stop periodic scan as running application scan client\n
+																														* Done Sync with no memory allocation\n 
+																														* Parameter Number:	0x04	\n
+																														* Module Number: Scan Concentrator Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: OFF	\n
+																														* GET Bit: OFF	\n
+																														* SET Bit: ON	\n
+																														*/
+    SCAN_CNCN_BSSID_LIST_SCAN_PARAM             =   SET_BIT |           SCAN_CNCN_PARAM | 0x05,							/**< Scan Concentrator BSSID List Scon Parameter (Scan Concentrator Module Set Command): \n  
+																														* Used for start one-shot scan as running application scan client\n
+																														* Done Sync with no memory allocation\n 
+																														* Parameter Number:	0x05	\n
+																														* Module Number: Scan Concentrator Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: OFF	\n
+																														* GET Bit: OFF	\n
+																														* SET Bit: ON	\n
+																														*/
+    SCAN_CNCN_BSSID_LIST_SIZE_PARAM             =   GET_BIT |           SCAN_CNCN_PARAM | 0x06,							/**< Scan Concentrator BSSID List Size Parameter (Scan Concentrator Module Get Command): \n  
+																														* Used for retrieving the size to allocate for the application scan result list\n
+																														* Done Sync with no memory allocation\n 
+																														* Parameter Number:	0x06	\n
+																														* Module Number: Scan Concentrator Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: OFF	\n
+																														* GET Bit: ON	\n
+																														* SET Bit: OFF	\n
+																														*/
+    SCAN_CNCN_BSSID_LIST_PARAM                  =   GET_BIT |           SCAN_CNCN_PARAM | 0x07,							/**< Scan Concentrator BSSID List Parameter (Scan Concentrator Module Get Command): \n  
+																														* Used for retrieving the application scan result table\n
+																														* Done Sync with no memory allocation\n 
+																														* Parameter Number:	0x07	\n
+																														* Module Number: Scan Concentrator Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: OFF	\n
+																														* GET Bit: ON	\n
+																														* SET Bit: OFF	\n
+																														*/
+
+	/* Scan Manager module */
+    SCAN_MNGR_SET_CONFIGURATION                 =	SET_BIT |           SCAN_MNGR_PARAM | 0x01 | ALLOC_NEEDED_PARAM,	/**< Scan Manager Set Configuration Parameter (Scan Manager Module Set Command): \n  
+																														* Used for setting the Scan Policy\n
+																														* Done Sync with memory allocation\n 
+																														* Parameter Number:	0x01	\n
+																														* Module Number: Scan Manager Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: ON	\n
+																														* GET Bit: OFF	\n
+																														* SET Bit: ON	\n
+																														*/
+    SCAN_MNGR_BSS_LIST_GET						=			  GET_BIT | SCAN_MNGR_PARAM | 0x02 | ALLOC_NEEDED_PARAM,	/**< Scan Manager Get BSS List Parameter (Scan Manager Module Get Command): \n  
+																														* Used for getting the currently available BSS list\n
+																														* Done Sync with memory allocation\n 
+																														* Parameter Number:	0x02	\n
+																														* Module Number: Scan Manager Module Number \n
+																														* Async Bit: OFF	\n
+																														* Allocate Bit: ON	\n
+																														* GET Bit: ON	\n
+																														* SET Bit: OFF	\n
+																														*/
+
+	/* regulatory domain section */
+	REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM	=			  GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x02,					   	/**< Regulatory Domain Management Capability Enabled Parameter (Regulatory Domain Module Get Command): \n  
+																																				* Used for getting indication if Spectrum Management is enabled\n
+																																				* Done Sync with no memory allocation\n 
+																																				* Parameter Number:	0x02	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: OFF	\n
+																																				*/
+	REGULATORY_DOMAIN_ENABLED_PARAM							=			  GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x03,						/**< Regulatory Domain Enabled Parameter (Regulatory Domain Module Get Command): \n  
+																																				* Used for getting indication if regulatory domain if 802.11d is in use\n
+																																				* Done Sync with no memory allocation\n 
+																																				* Parameter Number:	0x03	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: OFF	\n
+																																				*/ 		
+    REGULATORY_DOMAIN_CURRENT_TX_POWER_LEVEL_PARAM      	= 	SET_BIT | GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x06,						/**< Regulatory Domain Current TX Power Level Parameter (Regulatory Domain Module Set/Get Command): \n  
+																																				* Used for setting/getting current TZ Power Level\n
+																																				* Done Sync with no memory allocation\n 
+																																				* Parameter Number:	0x06	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: ON	\n
+																																				*/ 
+    REGULATORY_DOMAIN_CURRENT_TX_POWER_IN_DBM_PARAM			= 	SET_BIT | GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x08,						/**< Regulatory Domain Current TX Power in DBM Parameter (Regulatory Domain Module Set/Get Command): \n  
+																																				* Used for setting/getting current TX Power Level in DBM\n
+																																				* Done Sync with no memory allocation\n 
+																																				* Parameter Number:	0x08	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: ON	\n
+																																				*/
+    REGULATORY_DOMAIN_ENABLE_DISABLE_802_11D				=	SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x0C,					 	/**< Regulatory Domain Enable/Disable 802.11d Parameter (Regulatory Domain Module Set Command): \n  
+																																				* Used for enabling/disabling 802.11d.\n
+																																				* Done Sync with no memory allocation\n 
+																																				* Parameter Number:	0x0C	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: OFF	\n
+																																				* SET Bit: ON	\n
+																																				*/   	
+    REGULATORY_DOMAIN_ENABLE_DISABLE_802_11H				=	SET_BIT |           REGULATORY_DOMAIN_MODULE_PARAM | 0x0D,						/**< Regulatory Domain Enable/Disable 802.11h Parameter (Regulatory Domain Module Set Command): \n  
+																																				* Used for enabling/disabling 802.11h (If 802_11h is enabled, enable 802_11d as well)\n
+																																				* Done Sync with no memory allocation\n 
+																																				* Parameter Number:	0x0D	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: OFF	\n
+																																				* SET Bit: ON	\n
+																																				*/ 
+    REGULATORY_DOMAIN_COUNTRY_2_4_PARAM						=	SET_BIT | GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x0E | ALLOC_NEEDED_PARAM,	/**< Regulatory Domain Country 2-4 Parameter (Regulatory Domain Module Set/Get Command): \n  
+																																				* Used for getting Country String or setting the local country IE per band with the Country IE that was detected in the last passive scan\n
+																																				* Done Sync with memory allocation\n 
+																																				* Parameter Number:	0x0E	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: ON	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: ON	\n
+																																				*/		
+    REGULATORY_DOMAIN_COUNTRY_5_PARAM						=	SET_BIT | GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x0F | ALLOC_NEEDED_PARAM,	/**< Regulatory Domain Country 5 Parameter (Regulatory Domain Module Set/Get Command): \n  
+																																				* Used for getting Country String or setting the local country IE per band with the Country IE that was detected in the last passive scan\n
+																																				* Done Sync with memory allocation\n 
+																																				* Parameter Number:	0x0F	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: ON	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: ON	\n
+																																				*/	
+    REGULATORY_DOMAIN_DFS_CHANNELS_RANGE					=	SET_BIT | GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x10,						/**< Regulatory Domain DFS Channels Parameter (Regulatory Domain Module Set/Get Command): \n  
+																																				* Used for config manager in order to set/get a parameter received from the OS abstraction layer\n
+																																				* Done Sync with no memory allocation\n 
+																																				* Parameter Number:	0x10	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: ON	\n
+																																				*/	
+	REGULATORY_DOMAIN_TX_POWER_LEVEL_TABLE_PARAM			=   		  GET_BIT | REGULATORY_DOMAIN_MODULE_PARAM | 0x12,						/**< Regulatory Domain TX Power Level Table Parameter (Regulatory Domain Module Get Command): \n  
+																																				* Used for getting TX Power Level Table from FW\n
+																																				* Done Sync with no memory allocation\n 
+																																				* Parameter Number:	0x12	\n
+																																				* Module Number: Regulatory Domain Module Number \n
+																																				* Async Bit: OFF	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: OFF	\n
+																																				*/		
+
+	/* Power Manager params */
+    POWER_MGR_POWER_MODE							= 	SET_BIT | GET_BIT | POWER_MANAGER_PARAM | 0x01,							/**< Power Manager Power Mode Parameter (Power Manager Module Set/Get Command): \n  
+																																* Used for setting/getting the Power Mode to/from Power Manager Module\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x01	\n
+																																* Module Number: Power Manager Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+    POWER_MGR_POWER_LEVEL_PS                        =   SET_BIT | GET_BIT | POWER_MANAGER_PARAM | 0x02,							/**< Power Manager Power Level Power-Save Parameter (Power Manager Module Set/Get Command): \n  
+																																* Used for getting the Power Level Power-Save from Power Manager Module or setting the Power Level Power-Save to Power Manager Module (and to FW if Power-Save is Enabled)\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x02	\n
+																																* Module Number: Power Manager Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+    POWER_MGR_POWER_LEVEL_DEFAULT                   =   SET_BIT | GET_BIT | POWER_MANAGER_PARAM | 0x03,							/**< Power Manager Power Level Default Parameter (Power Manager Module Set/Get Command): \n  
+																																* Used for getting the Power Level Default from Power Manager Module or setting the Power Level Default to Power Manager Module (and to FW if Power-Save is Enabled)\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x03	\n
+																																* Module Number: Power Manager Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+    POWER_MGR_POWER_LEVEL_DOZE_MODE                 =   SET_BIT | GET_BIT | POWER_MANAGER_PARAM | 0x04,							/**< Power Manager Power Level Doze Mode (short-doze / long-doze) Parameter (Power Manager Module Set/Get Command): \n  
+																																* Used for getting the Power Level Doze Mode from Power Manager Module or setting the Power Level Doze Mode to Power Manager Module (and to FW if Power-Save is Enabled)\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x04	\n
+																																* Module Number: Power Manager Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+    POWER_MGR_KEEP_ALIVE_ENA_DIS                    =   SET_BIT |           POWER_MANAGER_PARAM | 0x05,							/**< Power Manager Keep Alive Enable/Disable Parameter (Power Manager Module Set Command): \n  
+																																* Used for setting the Keep Alive Enable/Disable to Power Manager and FW\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x05	\n
+																																* Module Number: Power Manager Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: OFF	\n
+																																* SET Bit: ON	\n
+																																*/
+    POWER_MGR_KEEP_ALIVE_ADD_REM                    =   SET_BIT |           POWER_MANAGER_PARAM | 0x06 | ALLOC_NEEDED_PARAM,	/**< Power Manager Keep Alive add REM Parameter (Power Manager Module Set Command): \n  
+																																* Used for setting addition/removal of a template and global enable/disable flag to Power Manager and FW\n
+																																* Done Sync with memory allocation\n 
+																																* Parameter Number:	0x06	\n
+																																* Module Number: Power Manager Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: ON	\n
+																																* GET Bit: OFF	\n
+																																* SET Bit: ON	\n
+																																*/
+    POWER_MGR_KEEP_ALIVE_GET_CONFIG                 =             GET_BIT | POWER_MANAGER_PARAM | 0x07 | ALLOC_NEEDED_PARAM,	/**< Power Manager Keep Alive Get Configuration Parameter (Power Manager Module Get Command): \n  
+																																* Used for getting the Keep Alive current Configuration\n
+																																* Done Sync with memory allocation\n 
+																																* Parameter Number:	0x07	\n
+																																* Module Number: Power Manager Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: ON	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: OFF	\n
+																																*/
+
+	/* Robust Security NW (RSN) section */
+	RSN_ENCRYPTION_STATUS_PARAM						=	SET_BIT | GET_BIT | RSN_MODULE_PARAM | 0x04,							/**< Robust Security NW (RSN) Encryption Status Parameter (RSN Module Set/Get Command): \n  
+																																* Used for setting/getting Encryption Status to/from RSN Module\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x04	\n
+																																* Module Number: RSN Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+	RSN_ADD_KEY_PARAM								=	SET_BIT | 			RSN_MODULE_PARAM | 0x05,							/**< Robust Security NW (RSN) Add Key Parameter (RSN Module Set Command): \n  
+																																* Used for adding RSN Key to FW\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x05	\n
+																																* Module Number: RSN Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: OFF	\n
+																																* SET Bit: ON	\n
+																																*/
+	RSN_REMOVE_KEY_PARAM							=	SET_BIT           | RSN_MODULE_PARAM | 0x06,							/**< Robust Security NW (RSN) Remove Key Parameter (RSN Module Set Command): \n  
+																																* Used for removing RSN Key from FW\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x06	\n
+																																* Module Number: RSN Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: OFF	\n
+																																* SET Bit: ON	\n
+																																*/
+    RSN_EXT_AUTHENTICATION_MODE                 	= 	SET_BIT | GET_BIT | RSN_MODULE_PARAM | 0x07,							/**< Robust Security NW (RSN) External Authentication Mode Parameter (RSN Module Set/Get Command): \n  
+																																* Used for getting RSN External Authentication Mode from RSN Module or setting RSN External Authentication Mode to FW and RSN Module\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x07	\n
+																																* Module Number: RSN Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+	RSN_MIXED_MODE									=	SET_BIT | GET_BIT | RSN_MODULE_PARAM | 0x08,							/**< Robust Security NW (RSN) Mixed Mode Parameter (RSN Module Set/Get Command): \n  
+																																* Used for setting/getting RSN Mixed Mode to/from RSN Module\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x08	\n
+																																* Module Number: RSN Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+    RSN_DEFAULT_KEY_ID								=	SET_BIT | GET_BIT | RSN_MODULE_PARAM | 0x09,							/**< Robust Security NW (RSN) Defualt Key ID Parameter (RSN Module Set/Get Command): \n  
+																																* Used for getting RSN defualt Key ID from RSN Module or setting RSN defualt Key ID to FW and RSN Module\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x09	\n
+																																* Module Number: RSN Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+	RSN_XCC_NETWORK_EAP								=	SET_BIT | GET_BIT | RSN_MODULE_PARAM | 0x0A,							/**< Robust Security NW (RSN) XCC NW EAP Parameter (RSN Module Set/Get Command): \n  
+																																* Used for setting/getting RSN XCC NW EAP to/from RSN Module\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	0x0A	\n
+																																* Module Number: RSN Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+
+	/* TWD Control section */
+    TWD_RTS_THRESHOLD_PARAM                			=   SET_BIT | GET_BIT | TWD_MODULE_PARAM | TWD_RTS_THRESHOLD_PARAM_ID,		/**< TWD Control RTS Threshold Parameter (TWD Control Module Set/Get Command): \n  
+																																* Used for getting RTS Threshold from TWD Control Module or setting RTS Threshold to FW and TWD Control Module\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	TWD_RTS_THRESHOLD_PARAM_ID	\n
+																																* Module Number: TWD Control Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+    TWD_FRAG_THRESHOLD_PARAM               			=   SET_BIT | GET_BIT | TWD_MODULE_PARAM | TWD_FRAG_THRESHOLD_PARAM_ID,		/**< TWD Control Fragmentation Threshold Parameter (TWD Control Module Set/Get Command): \n  
+																																* Used for getting Fragmentation Threshold from TWD Control Module or setting Fragmentation Threshold to FW and TWD Control Module\n
+																																* Done Sync with no memory allocation\n 
+																																* Parameter Number:	TWD_FRAG_THRESHOLD_PARAM_ID	\n
+																																* Module Number: TWD Control Module Number \n
+																																* Async Bit: OFF	\n
+																																* Allocate Bit: OFF	\n
+																																* GET Bit: ON	\n
+																																* SET Bit: ON	\n
+																																*/
+    TWD_RSSI_LEVEL_PARAM							=			  GET_BIT | TWD_MODULE_PARAM | TWD_RSSI_LEVEL_PARAM_ID 			| ASYNC_PARAM,	/**< TWD Control RSSI Level Parameter (TWD Control Module Get Command): \n  
+																																				* Used for getting RSSI Level From FW\n
+																																				* Done Async with no memory allocation\n 
+																																				* Parameter Number:	TWD_RSSI_LEVEL_PARAM_ID	\n
+																																				* Module Number: TWD Control Module Number \n
+																																				* Async Bit: ON	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: OFF	\n
+																																				*/
+    TWD_SNR_RATIO_PARAM                    			=			  GET_BIT | TWD_MODULE_PARAM | TWD_SNR_RATIO_PARAM_ID			| ASYNC_PARAM,	/**< TWD Control SNR Radio Parameter (TWD Control Module Get Command): \n  
+																																				* Used for getting SNR Radio From FW (same outcome as TWD_RSSI_LEVEL_PARAM)\n
+																																				* Done Async with no memory allocation\n 
+																																				* Parameter Number:	TWD_SNR_RATIO_PARAM_ID	\n
+																																				* Module Number: TWD Control Module Number \n
+																																				* Async Bit: ON	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: OFF	\n
+																																				*/
+
+	/*for BIP/PLT/Radio Debug Tests --> supports Set + GET*/
+	TWD_RADIO_TEST_PARAM               						=   SET_BIT | GET_BIT | TWD_MODULE_PARAM | TWD_RADIO_TEST_PARAM_ID 	| ASYNC_PARAM,	/**< TWD Control SNR Radio Parameter (TWD Control Module Set/Get Command): \n  
+																																				* Used for performing BIP/PLT/Radio Debug Tests\n
+																																				* Done Async with no memory allocation\n 
+																																				* Parameter Number:	TWD_RADIO_TEST_PARAM_ID	\n
+																																				* Module Number: TWD Control Module Number \n
+																																				* Async Bit: ON	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: ON	\n
+																																				* SET Bit: ON	\n
+																																				*/
+
+	TWD_FM_COEX_PARAM               						=   SET_BIT |    TWD_MODULE_PARAM | TWD_FM_COEX_PARAM_ID,	                        /**< TWD Control FM-Coexistence Parameters (TWD Control Module Set/Get Command): \n  
+																																				* Used for setting the FM-Coexistence Parameters\n
+																																				* Done Async with no memory allocation\n 
+																																				* Parameter Number:	TWD_FM_COEX_PARAM_ID	\n
+																																				* Module Number: TWD Control Module Number \n
+																																				* Async Bit: ON	\n
+																																				* Allocate Bit: OFF	\n
+																																				* GET Bit: OFF	\n
+																																				* SET Bit: ON	\n
+																																				*/
+
+	/* Roaming manager */
+    ROAMING_MNGR_APPLICATION_CONFIGURATION		= 	SET_BIT | GET_BIT | ROAMING_MANAGER_MODULE_PARAM | 0x01,	/**< Roaming Manager Application Configuration Parameter (Roaming Manager Module Set/Get Command): \n  
+																												* Used for setting/getting Roaming Manager Application Configuration to/from Roaming Manager Module and State-Machine\n
+																												* Done Sync with no memory allocation\n 
+																												* Parameter Number:	0x01	\n
+																												* Module Number: Roaming Manager Module Number \n
+																												* Async Bit: OFF	\n
+																												* Allocate Bit: OFF	\n
+																												* GET Bit: ON	\n
+																												* SET Bit: ON	\n
+																												*/
+    ROAMING_MNGR_USER_DEFINED_TRIGGER     		= 	SET_BIT |           ROAMING_MANAGER_MODULE_PARAM | 0x02,	/**< Roaming Manager User Defined Trigger Parameter (Roaming Manager Module Set Command): \n  
+																												* Used for setting user-defined trigger to FW\n
+																												* Done Sync with no memory allocation\n 
+																												* Parameter Number:	0x02	\n
+																												* Module Number: Roaming Manager Module Number \n
+																												* Async Bit: OFF	\n
+																												* Allocate Bit: OFF	\n
+																												* GET Bit: OFF	\n
+																												* SET Bit: ON	\n
+																												*/
+
+	/* QOS manager params */
+    QOS_MNGR_SET_OS_PARAMS						=	SET_BIT |           QOS_MANAGER_PARAM | 0x10,	/**< QoS Manager Set OS Parameter (QoS Module Set Command): \n  
+																									* Used for setting Quality Of Service Manager's Parameters\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x10	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+    QOS_MNGR_AP_QOS_PARAMETERS					=			  GET_BIT | QOS_MANAGER_PARAM | 0x11,	/**< QoS Manager AP QoS Parameter (QoS Module Get Command): \n  
+																									* Used for getting current AP QoS Parameters from QoS Module\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x11	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: OFF	\n
+																									*/
+    QOS_MNGR_OS_TSPEC_PARAMS					=             GET_BIT | QOS_MANAGER_PARAM | 0x12,	/**< QoS Manager OS TSPEC Parameter (QoS Module Get Command): \n  
+																									* Used for getting current OS 802.11 QoS TSPEC Parameters from QoS Module\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x12	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: OFF	\n
+																									*/
+    QOS_MNGR_AC_STATUS							=	SET_BIT | GET_BIT | QOS_MANAGER_PARAM | 0x13,	/**< QoS Manager AC Status Parameter (QoS Module Set/Get Command): \n  
+																									* Used for setting/getting SC Status\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x13	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+    QOS_MNGR_ADD_TSPEC_REQUEST					=	SET_BIT | 			QOS_MANAGER_PARAM | 0x14,	/**< QoS Manager Add TSPEC Request Parameter (QoS Module Set Command): \n  
+																									* Used for setting TSPEC Parameters to QoS Module\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x14	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+	QOS_MNGR_DEL_TSPEC_REQUEST					=	SET_BIT           | QOS_MANAGER_PARAM | 0x15,	/**< QoS Manager Delete TSPEC Request Parameter (QoS Module Set Command): \n  
+																									* Used for deleting TSPEC Parameters from QoS Module\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x15	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+	QOS_MNGR_GET_DESIRED_PS_MODE				=             GET_BIT | QOS_MANAGER_PARAM | 0x17,	/**< QoS Manager Get Desired Power-Save Mode Parameter (QoS Module Get Command): \n  
+																									* Used for getting the current desired Power-Save Mode from QoS Module\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x17	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: OFF	\n
+																									*/
+    QOS_SET_RX_TIME_OUT							=	SET_BIT |			QOS_MANAGER_PARAM | 0x18, 	/**< QoS Manager Get Desired Power-Save Mode Parameter (QoS Module Set Command): \n  
+																									* Used for setting RX Time Out (PS poll and UPSD) to FW and in QoS Module\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x18	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+    QOS_MNGR_PS_RX_STREAMING					=	SET_BIT | GET_BIT | QOS_MANAGER_PARAM | 0x19,	/**< QoS Manager Set Power-Save RX Streaming Parameter (QoS Module Set/Get Command): \n  
+																									* Used for getting Power-Save RX Streaming or setting Power-Save RX Streaming to FW and in QoS Module\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x19	\n
+																									* Module Number: QoS Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+
+    /* Soft Gemini params */
+	SOFT_GEMINI_SET_ENABLE						=	SET_BIT |           SOFT_GEMINI_PARAM	| 0x01,	/**< Soft Gimini Parameters Set Enable Parameter (Soft Gimini Parameters Module Set Command): \n  
+																									* Used for configuring Soft Gimini enable Mode (Enable|Disable|Auto) in FW\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x01	\n
+																									* Module Number: Soft Gimini Parameters Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+    SOFT_GEMINI_SET_CONFIG						=	SET_BIT |           SOFT_GEMINI_PARAM   | 0x03,	/**< Soft Gimini Parameters Set Configuration Parameter (Soft Gimini Parameters Module Set Command): \n  
+																									* Used for setting Soft Gimini Configuration to FW\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x03	\n
+																									* Module Number: Soft Gimini Parameters Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: OFF	\n
+																									* SET Bit: ON	\n
+																									*/
+    SOFT_GEMINI_GET_CONFIG                      =	GET_BIT |           SOFT_GEMINI_PARAM   | 0x04,	/**< Soft Gimini Parameters Get Configuration Parameter (Soft Gimini Parameters Module Get Command): \n  
+																									* Used for getting Soft Gimini Configuration\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x04	\n
+																									* Module Number: Soft Gimini Parameters Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: OFF	\n
+																									*/
+
+	/* REPORT section */
+	REPORT_MODULE_TABLE_PARAM                   =	SET_BIT | GET_BIT | REPORT_MODULE_PARAM | 0x01,	/**< Report Module Table Parameter (Report Module Set/Get Command): \n  
+																									* Used for setting/getting Report Module Table (Tble of all Logged Modules)\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x01	\n
+																									* Module Number: Report Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+	REPORT_SEVERITY_TABLE_PARAM                 =	SET_BIT | GET_BIT | REPORT_MODULE_PARAM | 0x02,	/**< Report Severity Table Parameter (Report Module Set/Get Command): \n  
+																									* Used for setting/getting the Severity Table (holds availble severity Levels of the event which is reported to user)\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x02	\n
+																									* Module Number: Report Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+    REPORT_MODULE_ON_PARAM                      =   SET_BIT | GET_BIT | REPORT_MODULE_PARAM | 0x03,	/**< Report Module ON Parameter (Report Module Set/Get Command): \n  
+																									* Used for setting (Enable) ceratin Logged Module in Report Modules Table or getting the Reported Module Status from Table (Enabled/Disabled)\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x03	\n
+																									* Module Number: Report Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+    REPORT_MODULE_OFF_PARAM                     =   SET_BIT | GET_BIT | REPORT_MODULE_PARAM | 0x04,	/**< Report Module OFF Parameter (Report Module Set/Get Command): \n  
+																									* Used for setting (Disable) ceratin Logged Module in Report Modules Table or getting the Reported Module Status from Table (Enabled/Disabled)\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x04	\n
+																									* Module Number: Report Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+    REPORT_PPMODE_VALUE_PARAM                   =   SET_BIT | GET_BIT | REPORT_MODULE_PARAM | 0x05,	/**< Report PP MODE Value Parameter (Report Module Set/Get Command): \n  
+																									* Used for setting (Enable/Disable) or Getting the Debug Mode flag, which indicates whether debug module should be used or not\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x05	\n
+																									* Module Number: Report Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+	REPORT_OUTPUT_TO_LOGGER_ON                  =   SET_BIT | GET_BIT | REPORT_MODULE_PARAM | 0x06,	/**< Report output ON Parameter (Report Module Set/Get Command): \n  
+																									* Used for setting the output of logs to the logger application\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x04	\n
+																									* Module Number: Report Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+
+	REPORT_OUTPUT_TO_LOGGER_OFF                  =   SET_BIT | GET_BIT | REPORT_MODULE_PARAM | 0x07,/**< Report output OFF Parameter (Report Module Set/Get Command): \n  
+																									* Used for setting OFF the output of logs to the logger application\n
+																									* Done Sync with no memory allocation\n 
+																									* Parameter Number:	0x04	\n
+																									* Module Number: Report Module Number \n
+																									* Async Bit: OFF	\n
+																									* Allocate Bit: OFF	\n
+																									* GET Bit: ON	\n
+																									* SET Bit: ON	\n
+																									*/
+
+
+	/* TX data section */
+    TX_CTRL_COUNTERS_PARAM						=			  GET_BIT | TX_CTRL_MODULE_PARAM | 0x01 | ALLOC_NEEDED_PARAM,	/**< TX Control Counters Parameter (TX Control Module Get Command): \n  
+																															* Used for getting TX statistics per Tx-queue\n
+																															* Done Sync with memory allocation\n 
+																															* Parameter Number:	0x01	\n
+																															* Module Number: TX Control Module Number \n
+																															* Async Bit: OFF	\n
+																															* Allocate Bit: ON	\n
+																															* GET Bit: ON	\n
+																															* SET Bit: OFF	\n
+																															*/
+    TX_CTRL_RESET_COUNTERS_PARAM                =	SET_BIT 		  | TX_CTRL_MODULE_PARAM | 0x02,						/**< TX Control Reset Counters Parameter (TX Control Module Set Command): \n  
+																															* Used for Reset all TX statistics per Tx-queue\n
+																															* Done Sync with no memory allocation\n 
+																															* Parameter Number:	0x02	\n
+																															* Module Number: TX Control Module Number \n
+																															* Async Bit: OFF	\n
+																															* Allocate Bit: OFF	\n
+																															* GET Bit: OFF	\n
+																															* SET Bit: ON	\n
+																															*/
+    TX_CTRL_SET_MEDIUM_USAGE_THRESHOLD			=	SET_BIT           | TX_CTRL_MODULE_PARAM | 0x03,						/**< TX Control Set Medum Usage Threshold Parameter (TX Control Module Set Command): \n  
+																															* Used for setting Medum Usage Threshold of AC\n
+																															* Done Sync with no memory allocation\n 
+																															* Parameter Number:	0x03	\n
+																															* Module Number: TX Control Module Number \n
+																															* Async Bit: OFF	\n
+																															* Allocate Bit: OFF	\n
+																															* GET Bit: OFF	\n
+																															* SET Bit: ON	\n
+																															*/
+
+    /* RX data section */
+    RX_DATA_ENABLE_DISABLE_RX_DATA_FILTERS     	=   SET_BIT | GET_BIT | RX_DATA_MODULE_PARAM | 0x04,						/**< RX Data Enable/Disable Filters Parameter (RX Data Module Set/Get Command): \n  
+																															* Used for Enabling/Disabling Filters in FW or getting the  Filters Enabling/Disabling current Status\n
+																															* Done Sync with no memory allocation\n 
+																															* Parameter Number:	0x04	\n
+																															* Module Number: RX Data Module Number \n
+																															* Async Bit: OFF	\n
+																															* Allocate Bit: OFF	\n
+																															* GET Bit: ON	\n
+																															* SET Bit: ON	\n
+																															*/
+    RX_DATA_ADD_RX_DATA_FILTER                 	=   SET_BIT           | RX_DATA_MODULE_PARAM | 0x05,						/**< RX Data Add Filter Parameter (RX Data Module Set Command): \n  
+																															* Used for adding RX Data Filter to FW\n
+																															* Done Sync with no memory allocation\n 
+																															* Parameter Number:	0x05	\n
+																															* Module Number: RX Data Module Number \n
+																															* Async Bit: OFF	\n
+																															* Allocate Bit: OFF	\n
+																															* GET Bit: OFF	\n
+																															* SET Bit: ON	\n
+																															*/
+    RX_DATA_REMOVE_RX_DATA_FILTER              	=   SET_BIT           | RX_DATA_MODULE_PARAM | 0x06,						/**< RX Data Remove Filter Parameter (RX Data Module Set Command): \n  
+																															* Used for removing RX Data Filter from FW\n
+																															* Done Sync with no memory allocation\n 
+																															* Parameter Number:	0x06	\n
+																															* Module Number: RX Data Module Number \n
+																															* Async Bit: OFF	\n
+																															* Allocate Bit: OFF	\n
+																															* GET Bit: OFF	\n
+																															* SET Bit: ON	\n
+																															*/
+    RX_DATA_GET_RX_DATA_FILTERS_STATISTICS     	=             GET_BIT | RX_DATA_MODULE_PARAM | 0x07 | ASYNC_PARAM,			/**< RX Data Get RX Data Filter Statistics Parameter (RX Data Module Get Command): \n  
+																															* Used for getting RX Data Filter Statistics from FW\n
+																															* Done Async with no memory allocation\n 
+																															* Parameter Number:	0x07	\n
+																															* Module Number: RX Data Module Number \n
+																															* Async Bit: ON	\n
+																															* Allocate Bit: OFF	\n
+																															* GET Bit: ON	\n
+																															* SET Bit: OFF	\n
+																															*/
+    
+
+	/* measurement section */
+    MEASUREMENT_ENABLE_DISABLE_PARAM			=	SET_BIT |           MEASUREMENT_MODULE_PARAM | 0x01,	/**< Measurement Enable/Disable Parameter (Measurement Module Set Command): \n  
+																											* Used for Enabling/Disabling Measurement Management Module\n
+																											* Done Sync with no memory allocation\n 
+																											* Parameter Number:	0x01	\n
+																											* Module Number: Measurement Module Number \n
+																											* Async Bit: OFF	\n
+																											* Allocate Bit: OFF	\n
+																											* GET Bit: OFF	\n
+																											* SET Bit: ON	\n
+																											*/
+	MEASUREMENT_MAX_DURATION_PARAM				=	SET_BIT |           MEASUREMENT_MODULE_PARAM | 0x02,	/**< Measurement Maximum Duration Parameter (Measurement Module Set Command): \n  
+																											* Used for updating the Maximum Duration on non serving channel\n
+																											* Done Sync with no memory allocation\n 
+																											* Parameter Number:	0x02	\n
+																											* Module Number: Measurement Module Number \n
+																											* Async Bit: OFF	\n
+																											* Allocate Bit: OFF	\n
+																											* GET Bit: OFF	\n
+																											* SET Bit: ON	\n
+																											*/
+
+	/* XCC */    
+    XCC_CONFIGURATION							=	SET_BIT | GET_BIT | XCC_MANAGER_MODULE_PARAM | 0x01,	/**< XCC Manager Configuration Parameter (XCC Manager Module Set/Get Command): \n  
+																											* Used for setting or getting XCC configuration (RogueAP, CCKM, CKIP, All)\n
+																											* Done Sync with no memory allocation\n 
+																											* Parameter Number:	0x01	\n
+																											* Module Number: XCC Manager Module Number \n
+																											* Async Bit: OFF	\n
+																											* Allocate Bit: OFF	\n
+																											* GET Bit: ON	\n
+																											* SET Bit: ON	\n
+																											*/
+
+	/* MISC section */
+	DEBUG_ACTIVATE_FUNCTION						=	SET_BIT | 			MISC_MODULE_PARAM | 0x03,		 	/**< Debug Activate Function Parameter (MISC Module Set Command): \n  
+																											* Used for performing debug function\n
+																											* Done Sync with no memory allocation\n 
+																											* Parameter Number:	0x03	\n
+																											* Module Number: MISC Module Number \n
+																											* Async Bit: OFF	\n
+																											* Allocate Bit: OFF	\n
+																											* GET Bit: OFF	\n
+																											* SET Bit: ON	\n
+																											*/ 
+   
+	/* Health Monitoring section */
+    HEALTH_MONITOR_CHECK_DEVICE                 =   SET_BIT |           HEALTH_MONITOR_MODULE_PARAM | 0x01,	/**< Health Monitoring Check Device Parameter (Health Monitoring Module Set Command): \n  
+																											* Used for sending health check command to FW\n
+																											* Done Sync with no memory allocation\n 
+																											* Parameter Number:	0x01	\n
+																											* Module Number: Health Monitoring Module Number \n
+																											* Async Bit: OFF	\n
+																											* Allocate Bit: OFF	\n
+																											* GET Bit: OFF	\n
+																											* SET Bit: ON	\n
+																											*/
+
+	LAST_CMD									=	0x00	/**< Last External Parameter - Dummy, Should always stay Last	*/													
+
+}   EExternalParam;
+
+/* functions */
+/*************/
+
+#endif  /* _CMD_INTERFACE_CODES_H_ */
+        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/GenSM.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,249 @@
+/*
+ * GenSM.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 GenSM.c
+ *  \brief Generic state machine implementation
+ *
+ *  \see GenSM.h
+ */
+
+
+#define __FILE_ID__  FILE_ID_128
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "GenSM.h"
+
+/* generic state machine object structure */
+typedef struct
+{
+    TI_HANDLE       hOS;               /**< OS handle */ 
+    TI_HANDLE       hReport;           /**< report handle */ 
+    TGenSM_matrix   tMatrix;           /**< next state/action matrix */
+    TI_UINT32       uStateNum;         /**< Number of states in the matrix */
+    TI_UINT32       uEventNum;         /**< Number of events in the matrix */
+    TI_UINT32       uCurrentState;     /**< Current state */
+    TI_UINT32       uEvent;            /**< Last event sent */
+    void            *pData;            /**< Last event data */
+    TI_BOOL         bEventPending;     /**< Event pending indicator */
+    TI_BOOL         bInAction;         /**< Evenet execution indicator */
+    TI_UINT32       uModuleLogIndex;   /**< Module index to use for printouts */
+    TI_INT8         *pGenSMName;       /**< state machine name */
+    TI_INT8         **pStateDesc;      /**< State description strings */
+    TI_INT8         **pEventDesc;      /**< Event description strings */
+} TGenSM;
+
+
+/** 
+ * \fn     genSM_Create 
+ * \brief  Cerates a generic state machine object
+ * 
+ * Cerates a generic state machine object. Allocates system resources.
+ * 
+ * \note   event/action matrix and debug descriptions are used by reference, and are not copied! 
+ * \param  hOS - handle to the OS object
+ * \return Handle to the generic state machine object
+ * \sa     GenSM_Unload, GenSM_Init, genSM_SetDefaults
+ */
+TI_HANDLE genSM_Create (TI_HANDLE hOS)
+{
+    TGenSM      *pGenSM = NULL;
+
+    /* Allocate object storage */
+    pGenSM = os_memoryAlloc (hOS, sizeof(TGenSM),MemoryNormal);
+    if (NULL != pGenSM)
+    {
+        /* Store OS handle */
+        pGenSM->hOS = hOS;
+    }
+
+    return (TI_HANDLE)pGenSM;
+}
+
+/** 
+ * \fn     genSM_Unload 
+ * \brief  Unloads a generic state machine object
+ * 
+ * Unloads a generic state machine object. Frees system resources consumed by the object.
+ * 
+ * \param  hGenSM - hanlde to the generic state machine object
+ * \return None
+ * \sa     GenSM_Create 
+ */
+void genSM_Unload (TI_HANDLE hGenSM)
+{
+    TGenSM      *pGenSM =       (TGenSM*)hGenSM;
+
+    /* free the generic state machine object storage */
+    os_memoryFree (pGenSM->hOS, hGenSM, sizeof (TGenSM));
+}
+
+/** 
+ * \fn     genSM_Init 
+ * \brief  Initializes the generic state machine object
+ * 
+ * Initializes the generic state machine object. Store handles to other modules.
+ * 
+ * \param  hGenSM - hanlde to the generic state machine object
+ * \param  hReport - handle to the report module
+ * \return None
+ * \sa     GenSM_Create, genSM_SetDefaults
+ */
+void genSM_Init (TI_HANDLE hGenSM, TI_HANDLE hReport)
+{
+    TGenSM      *pGenSM =       (TGenSM*)hGenSM;
+
+    /* store report handle */
+    pGenSM->hReport = hReport;
+}
+
+/** 
+ * \fn     genSM_SetDefaults 
+ * \brief  Set default values to the generic state machine 
+ * 
+ * Set default values to the generic state machine
+ * 
+ * \note   event/action matrix and debug descriptions are used by reference, and are not copied! 
+ * \param  hGenSM - hanlde to the generic state machine object
+ * \param  uStateNum - number of states
+ * \param  uEventNum - number of events
+ * \param  pMatrix - pointer to the event/actions matrix
+ * \param  uInitialState - the initial state
+ * \param  pGenSMName - a string describing the state machine, for debug prints
+ * \param  pStateDesc - strings describing the state machine states, for debug prints
+ * \param  pEventDesc - strings describing the state machine events, for debug prints
+ * \param  uModuleLogIndex - Log index used by the module using the state machine
+ * \return None
+ * \sa     genSM_Create, genSM_Init
+ */
+void genSM_SetDefaults (TI_HANDLE hGenSM, TI_UINT32 uStateNum, TI_UINT32 uEventNum,
+                        TGenSM_matrix pMatrix, TI_UINT32 uInitialState, TI_INT8 *pGenSMName, 
+                        TI_INT8 **pStateDesc, TI_INT8 **pEventDesc, TI_UINT32 uModuleLogIndex)
+{
+    TGenSM      *pGenSM =       (TGenSM*)hGenSM;
+
+    /* set values */
+    pGenSM->uStateNum       = uStateNum;
+    pGenSM->uEventNum       = uEventNum;
+    pGenSM->tMatrix         = pMatrix;
+    pGenSM->uCurrentState   = uInitialState;
+    pGenSM->pGenSMName      = pGenSMName;
+    pGenSM->pStateDesc      = pStateDesc;
+    pGenSM->pEventDesc      = pEventDesc;
+    pGenSM->uModuleLogIndex = uModuleLogIndex;
+    pGenSM->bEventPending   = TI_FALSE;
+    pGenSM->bInAction       = TI_FALSE;
+}
+
+void genSM_Event (TI_HANDLE hGenSM, TI_UINT32 uEvent, void *pData)
+{
+    TGenSM              *pGenSM =       (TGenSM*)hGenSM;
+    TI_UINT32           uCurrentState;
+    TGenSM_actionCell   *pCell;
+
+#ifdef TI_DBG
+    /* sanity check */
+    if (uEvent >= pGenSM->uEventNum)
+    {
+        TRACE3(pGenSM->hReport, REPORT_SEVERITY_ERROR , ": module: %d received event %d, which is out of events boundry %d\n", pGenSM->uModuleLogIndex, uEvent, pGenSM->uEventNum);
+    }
+    if (TI_TRUE == pGenSM->bEventPending)
+    {
+        TRACE3(pGenSM->hReport, REPORT_SEVERITY_ERROR , ": module: %d received event %d, when event %d is pending execution!\n", pGenSM->uModuleLogIndex, uEvent, pGenSM->uEvent);
+    }
+#endif
+
+    /* mark that an event is pending */
+    pGenSM->bEventPending = TI_TRUE;
+
+    /* save event and data */
+    pGenSM->uEvent = uEvent;
+    pGenSM->pData = pData;
+
+    /* if an event is currently executing, return (new event will be handled when current event is done) */
+    if (TI_TRUE == pGenSM->bInAction)
+    {
+        TRACE1(pGenSM->hReport, REPORT_SEVERITY_INFORMATION , ": module: %d delaying execution of event \n", pGenSM->uModuleLogIndex);
+        return;
+    }
+
+    /* execute events, until none is pending */
+    while (TI_TRUE == pGenSM->bEventPending)
+    {
+        /* get the cell pointer for the current state and event */
+        pCell = &(pGenSM->tMatrix[ (pGenSM->uCurrentState * pGenSM->uEventNum) + pGenSM->uEvent ]);
+        
+
+        /* print state transition information */
+		TRACE4(pGenSM->hReport, REPORT_SEVERITY_INFORMATION, "genSM_Event: module %d <currentState = %d, event = %d> --> nextState = %d\n", pGenSM->uModuleLogIndex, pGenSM->uCurrentState, uEvent, pCell->uNextState);
+
+        /* mark that event execution is in place */
+        pGenSM->bInAction = TI_TRUE;
+
+        /* mark that pending event is being handled */
+        pGenSM->bEventPending = TI_FALSE;
+        
+        /* keep current state */
+        uCurrentState = pGenSM->uCurrentState;
+
+        /* update current state */
+        pGenSM->uCurrentState = pCell->uNextState;
+
+        /* run transition function */
+        (*(pCell->fAction)) (pGenSM->pData);
+
+        /* mark that event execution is complete */
+        pGenSM->bInAction = TI_FALSE;
+    }
+}
+
+/** 
+ * \fn     genSM_GetCurrentState
+ * \brief  retrieves the state machine current state
+ * 
+ * retrieves the state machine current state
+ * 
+ * \param  hGenSM - hanlde to the generic state machine object
+ * \return state machine current state
+ */
+TI_UINT32 genSM_GetCurrentState (TI_HANDLE hGenSM)
+{
+    TGenSM              *pGenSM =       (TGenSM*)hGenSM;
+
+    return pGenSM->uCurrentState;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/GenSM.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,81 @@
+/*
+ * GenSM.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 GenSM.h
+ *  \brief Generic state machine declarations
+ *
+ *  \see GenSM.c
+ */
+
+
+#ifndef __GENSM_H__
+#define __GENSM_H__
+
+#include "tidef.h"
+
+/* action function type definition */
+typedef void (*TGenSM_action) (void *pData);
+
+
+/* State/Event cell */
+typedef  struct
+{
+    TI_UINT32       uNextState; /**< next state in transition */
+    TGenSM_action   fAction;    /**< action function */
+} TGenSM_actionCell;
+
+
+
+/* 
+ * matrix type 
+ * Although the state-machine matrix is actually a two-dimensional array, it is treated as a single 
+ * dimension array, since the size of each dimeansion is only known in run-time
+ */
+typedef TGenSM_actionCell *TGenSM_matrix;
+
+TI_HANDLE   genSM_Create (TI_HANDLE hOS);
+void        genSM_Unload (TI_HANDLE hGenSM);
+void        genSM_Init (TI_HANDLE hGenSM, TI_HANDLE hReport);
+void        genSM_SetDefaults (TI_HANDLE hGenSM, TI_UINT32 uStateNum, TI_UINT32 uEventNum,
+                        TGenSM_matrix pMatrix, TI_UINT32 uInitialState, TI_INT8 *pGenSMName, 
+                        TI_INT8 **pStateDesc, TI_INT8 **pEventDesc, TI_UINT32 uModuleLogIndex);
+void        genSM_Event (TI_HANDLE hGenSM, TI_UINT32 uEvent, void *pData);
+TI_UINT32   genSM_GetCurrentState (TI_HANDLE hGenSM);
+
+#endif /* __GENSM_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/ccx/osdot11ccx.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,186 @@
+/*
+ * osdot11XCC.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:		osDot11XCC.h */
+/**/
+/* Purpose:		*/
+/**/
+/*--------------------------------------------------------------------------*/
+#ifndef __OSDOT11XCC_H__
+#define __OSDOT11XCC_H__
+
+#ifdef XCC_MODULE_INCLUDED
+
+#include  "osDot11.h"
+
+/************************************************************************
+ * XCC types  - taken from Funk inc file: fswXCC.h                      *
+ ************************************************************************/
+
+/* Rogue AP structure */
+
+typedef struct _OS_XCC_ROGUE_AP_DETECTED
+{
+	TI_UINT16             FailureReason;
+	TMacAddr              RogueAPMacAddress;
+	char                  RogueAPName[16];
+} OS_XCC_ROGUE_AP_DETECTED, *POS_XCC_ROGUE_AP_DETECTED;
+
+/**/
+/*  Auth Success structure*/
+/**/
+
+typedef struct _OS_XCC_AUTH_SUCCESS
+{
+  	OS_802_11_SSID          Ssid;
+	TMacAddr                BSSID;
+} OS_XCC_AUTH_SUCCESS, *POS_XCC_AUTH_SUCCESS;
+
+
+/**/
+/*  CCKM Request structure*/
+/**/
+
+/* RequestCode values*/
+typedef enum _OS_XCC_CCKM_REQUEST_CODE
+{
+	XCC_CckmFirstTime = 0,
+	XCC_CckmFastHandoff
+} OS_XCC_CCKM_REQUEST_CODE;
+
+typedef struct _OS_XCC_CCKM_REQUEST
+{
+	OS_XCC_CCKM_REQUEST_CODE    RequestCode;
+	TI_UINT32                    AssociationRequestIELength;
+	TI_UINT8                     AssociationRequestIE[1];
+} OS_XCC_CCKM_REQUEST;
+
+typedef struct _XCC_radioManagmentCapability_IE_t
+{
+	TI_UINT8			eleID;
+	TI_UINT8			len;
+	TI_UINT8			ciscoAironetOUI[3];
+	TI_UINT8			version;
+	TI_UINT16  		rmState;
+} XCC_radioManagmentCapability_IE_t;
+
+#define     OS_XCC_CONFIGURATION_ENABLE_CKIP        0x0001
+#define     OS_XCC_CONFIGURATION_ENABLE_ROGUE_AP    0x0002
+#define     OS_XCC_CONFIGURATION_ENABLE_CCKM        0x0004
+
+#define     OS_XCC_CONFIGURATION_ENABLE_ALL         0x0007 
+
+
+
+typedef enum _OS_XCC_NETWORK_EAP
+{
+    OS_XCC_NETWORK_EAP_OFF  = 0,
+    OS_XCC_NETWORK_EAP_ON,
+    OS_XCC_NETWORK_EAP_ALLOWED,
+    OS_XCC_NETWORK_EAP_PREFERRED
+} OS_XCC_NETWORK_EAP;
+
+/**/
+/*  CCKM Result structure*/
+/**/
+
+/* ResultCode values*/
+typedef enum _OS_XCC_CCKM_RESULT_CODE
+{
+	osXCC_CckmSuccess = 0,
+	osXCC_CckmFailure,
+	osXCC_CckmNotInUse
+} OS_XCC_CCKM_RESULT_CODE;
+
+typedef struct _OS_XCC_CCKM_RESULT
+{
+	OS_XCC_CCKM_RESULT_CODE ResultCode;
+} OS_XCC_CCKM_RESULT;
+
+
+/**/
+/*  CCKM Start structure*/
+/**/
+
+typedef struct _OS_XCC_CCKM_START
+{
+	TI_UINT8 Timestamp[8];
+	TMacAddr BSSID;
+} OS_XCC_CCKM_START;
+
+/*
+	GUIDs for custom OIDs in #define form
+	-------------------------------------
+
+	The same GUIDs constructed using DEFINE_GUID (above) are also 
+	available in #define form. This allows a GUID structure to be 
+	constructed directly. For example, an NDIS_GUID structure could be 
+	constructed as follows:
+
+		NDIS_GUID ng = {CGUID_FSW_XCC_CONFIGURATION, OID_FSW_XCC_CONFIGURATION, 4, fNDIS_GUID_TO_OID};
+ */
+
+/* oids*/
+#define CGUID_FSW_XCC_CONFIGURATION				{0x21190696, 0x118d, 0x4654, {0x9e, 0x9a, 0xc6, 0x9c, 0xa7, 0xc7, 0x95, 0xb8}}
+#define CGUID_FSW_XCC_NETWORK_EAP				{0x0725e492, 0x3025, 0x477c, {0x91, 0xdc, 0xd5, 0xc1, 0x2a, 0x4e, 0xec, 0x1f}}
+#define CGUID_FSW_XCC_ROGUE_AP_DETECTED			{0x5858fa82, 0x0dfd, 0x4a4a, {0xbb, 0xc9, 0xdc, 0xc7, 0x8f, 0x63, 0x01, 0x70}}
+#define CGUID_FSW_XCC_REPORT_ROGUE_APS			{0x6e72993a, 0x59a7, 0x4a3e, {0xb1, 0x65, 0x0c, 0xec, 0xb3, 0xc5, 0x0c, 0xdc}}
+#define CGUID_FSW_XCC_AUTH_SUCCESS				{0x55019653, 0x0454, 0x4309, {0xb8, 0xca, 0xd2, 0xe9, 0xf4, 0xd0, 0xaf, 0x83}}
+#define CGUID_FSW_XCC_CCKM_REQUEST				{0xf5190942, 0x6d90, 0x4858, {0x8a, 0xdf, 0x08, 0x6a, 0x2f, 0xa5, 0xb7, 0xeb}}
+#define CGUID_FSW_XCC_CCKM_RESULT				{0x1163fca7, 0x9c1a, 0x4e39, {0xa8, 0x79, 0x9f, 0x93, 0xad, 0x1b, 0x84, 0x07}}
+
+/* status code*/
+#define CGUID_FSW_XCC_CCKM_START				{0x8c389e47, 0xe511, 0x4d96, {0xae, 0xfe, 0x2f, 0xb7, 0x31, 0xd8, 0x0c, 0x05}}
+
+#define OID_FSW_XCC_CONFIGURATION				0xFF010201
+#define OID_FSW_XCC_NETWORK_EAP					0xFF010202
+#define OID_FSW_XCC_ROGUE_AP_DETECTED			0xFF010203
+#define OID_FSW_XCC_REPORT_ROGUE_APS			0xFF010204
+#define OID_FSW_XCC_AUTH_SUCCESS				0xFF010205
+#define OID_FSW_XCC_CCKM_REQUEST				0xFF010206
+#define OID_FSW_XCC_CCKM_RESULT					0xFF010207
+/* status code*/
+#define NDIS_STATUS_FSW_XCC_CCKM_START			0x60010001
+
+
+
+#endif /*XCC_MODULE_INCLUDED*/
+
+#endif /*__OSDOT11XCC_H__*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/commonTypes.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,80 @@
+/*
+ * commonTypes.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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_TYPES_H__
+#define __COMMON_TYPES_H__
+
+/************************************/
+/*      System return values.       */
+/************************************/
+
+typedef enum
+{
+    PARAM_NOT_SUPPORTED         = 2,
+    PARAM_VALUE_NOT_VALID       = 3,
+    CONFIGURATION_NOT_VALID     = 4,
+    NO_SITE_SELECTED_YET        = 5,
+    EXTERNAL_SET_PARAM_DENIED   = 7,
+    EXTERNAL_GET_PARAM_DENIED   = 8,
+    PARAM_MODULE_NUMBER_INVALID = 9,
+    STATION_IS_NOT_RUNNING      = 10,
+    CARD_IS_NOT_INSTALLED       = 11,
+
+    /* QoSMngr */
+    NOT_CONNECTED,
+    TRAFIC_ADM_PENDING,
+    NO_QOS_AP,
+    ADM_CTRL_DISABLE,
+    AC_ALREADY_IN_USE,
+    USER_PRIORITY_NOT_ADMITTED,
+
+
+	COMMAND_PENDING,
+
+    /* Rx Data Filters */
+    RX_NO_AVAILABLE_FILTERS,
+    RX_FILTER_ALREADY_EXISTS,
+    RX_FILTER_DOES_NOT_EXIST,
+    /* Soft Gemini */
+    SG_REJECT_MEAS_SG_ACTIVE,
+    PARAM_ALREADY_CONFIGURED
+
+} systemStatus_e;
+
+#endif /* __COMMON_TYPES_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/context.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,385 @@
+/*
+ * context.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   context.c 
+ *  \brief  The Context-Engine is an OS independent module, which provides the
+ *            infrustracture for switching from external contexts to the driver's context.
+ *          This includes also the driver task itself , which invokes the 
+ *            driver specific handlers in the driver's context.
+ *          The OS specific implementation under this module (e.g. task-switching or 
+ *            protection-locking) is provided by the OS abstraction layer (osapi.c).
+ * 
+ *  \see    context.h, osapi.c
+ */
+
+
+#define __FILE_ID__  FILE_ID_125
+#include "osApi.h"
+#include "report.h"
+#include "context.h"
+#include "TWDriver.h"
+
+
+/** 
+ * \fn     context_Create 
+ * \brief  Create the module 
+ * 
+ * Allocate and clear the module object.
+ * 
+ * \note    
+ * \param  hOs      - Handle to Os Abstraction Layer
+ * \return Handle of the allocated object 
+ * \sa     context_Destroy
+ */ 
+TI_HANDLE context_Create (TI_HANDLE hOs)
+{
+	TI_HANDLE hContext;
+
+	/* allocate module object */
+	hContext = os_memoryAlloc (hOs, sizeof(TContext),MemoryNormal);
+	
+	if (!hContext)
+	{
+		WLAN_OS_REPORT (("context_Create():  Allocation failed!!\n"));
+		return NULL;
+	}
+	
+    os_memoryZero (hOs, hContext, (sizeof(TContext)));
+
+	return (hContext);
+}
+
+
+/** 
+ * \fn     context_Destroy
+ * \brief  Destroy the module. 
+ * 
+ * Free the module memory.
+ * 
+ * \note   
+ * \param  hContext - The module object
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     context_Create
+ */ 
+TI_STATUS context_Destroy (TI_HANDLE hContext)
+{
+    TContext *pContext = (TContext *)hContext;
+
+    /* Destroy the protection handle */
+    os_protectDestroy (pContext->hOs, pContext->hProtectionLock);
+
+    /* free module object */
+	os_memoryFree (pContext->hOs, pContext, sizeof(TContext));
+	
+    return TI_OK;
+}
+
+
+/** 
+ * \fn     context_Init 
+ * \brief  Init required handles 
+ * 
+ * Init required handles.
+ * 
+ * \note    
+ * \param  hContext  - The queue object
+ * \param  hOs       - Handle to Os Abstraction Layer
+ * \param  hReport   - Handle to report module
+ * \return void        
+ * \sa     
+ */ 
+void context_Init (TI_HANDLE hContext, TI_HANDLE hOs, TI_HANDLE hReport)
+{
+	TContext *pContext = (TContext *)hContext;
+
+    pContext->hOs     = hOs;
+    pContext->hReport = hReport;
+	
+    /* Create the module's protection lock and save its handle */
+    pContext->hProtectionLock = os_protectCreate (pContext->hOs);
+}
+
+
+/** 
+ * \fn     context_RegisterClient
+ * \brief  Save client's parameters
+ * 
+ * This function is used by the Context clients in their init process, for registering 
+ *   their information, 
+ * This includes their callback function that should be invoked from the driver context
+ *   when they are pending. 
+ * 
+ * \note   
+ * \param  hContext - The module handle
+ * \param  fCbFunc  - The client's callback function.
+ * \param  hCbHndl  - The client's callback function handle.
+ * \param  bEnable  - TRUE = Enabled.
+ * \return TI_UINT32 - The index allocated for the client
+ * \sa     
+ */ 
+TI_UINT32 context_RegisterClient (TI_HANDLE       hContext,
+                                  TContextCbFunc  fCbFunc,
+                                  TI_HANDLE       hCbHndl,
+                                  TI_BOOL         bEnable,
+                                  char           *sName,
+                                  TI_UINT32       uNameSize)
+{
+	TContext *pContext = (TContext *)hContext;
+    TI_UINT32 uClientId = pContext->uNumClients;
+
+    /* If max number of clients is exceeded, report error and exit. */
+    if (uClientId == MAX_CLIENTS) 
+    {
+        TRACE0(pContext->hReport, REPORT_SEVERITY_ERROR , "context_RegisterClient() MAX_CLIENTS limit exceeded!!\n");
+        return 0;
+    }
+
+    /* Save the new client's parameters. */
+    pContext->aClientCbFunc[uClientId]  = fCbFunc;
+    pContext->aClientCbHndl[uClientId]  = hCbHndl;
+    pContext->aClientEnabled[uClientId] = bEnable;
+    pContext->aClientPending[uClientId] = TI_FALSE;
+
+#ifdef TI_DBG
+    if (uNameSize <= MAX_NAME_SIZE) 
+    {
+        os_memoryCopy(pContext->hOs, 
+                      (void *)(pContext->aClientName[uClientId].sName),
+                      (void *)sName, 
+                      uNameSize);
+        pContext->aClientName[uClientId].uSize = uNameSize;
+    }
+    else 
+    {
+        TRACE0(pContext->hReport, REPORT_SEVERITY_ERROR , "context_RegisterClient() MAX_NAME_SIZE limit exceeded!\n");
+    }
+#endif /* TI_DBG */
+
+    /* Increment clients number and return new client ID. */
+    pContext->uNumClients++;
+
+    TRACE2(pContext->hReport, REPORT_SEVERITY_INIT , "context_RegisterClient(): Client=, ID=%d, enabled=%d\n", uClientId, bEnable);
+
+    return uClientId;
+}
+
+
+/** 
+ * \fn     context_RequestSchedule
+ * \brief  Handle client's switch to driver's context.
+ * 
+ * This function is called by a client from external context event.
+ * It sets the client's Pending flag and requests the driver's task scheduling.
+ * Thus, the client's callback will be called afterwards from the driver context.
+ * 
+ * \note   
+ * \param  hContext   - The module handle
+ * \param  uClientId  - The client's index
+ * \return void 
+ * \sa     context_DriverTask
+ */ 
+void context_RequestSchedule (TI_HANDLE hContext, TI_UINT32 uClientId)
+{
+	TContext *pContext = (TContext *)hContext;
+
+#ifdef TI_DBG
+    pContext->aRequestCount[uClientId]++; 
+    TRACE3(pContext->hReport, REPORT_SEVERITY_INFORMATION , "context_RequestSchedule(): Client=, ID=%d, enabled=%d, pending=%d\n", uClientId, pContext->aClientEnabled[uClientId], pContext->aClientPending[uClientId]);
+#endif /* TI_DBG */
+
+    /* Set client's Pending flag */
+    pContext->aClientPending[uClientId] = TI_TRUE;
+
+    /* 
+     * If configured to switch context, request driver task scheduling.
+     * Else (context switch not required) call the driver task directly.
+	 * OS_REQUEST_SCHEDULE is OS depend macro, in case that the Os not support scheduling
+	 * that macro should return TI_NOK.
+     */
+	if(TI_OK != OS_REQUEST_SCHEDULE(pContext->hOs))
+    {
+        context_DriverTask (hContext);
+    }
+}
+
+
+/** 
+ * \fn     context_DriverTask
+ * \brief  The driver task
+ * 
+ * This function is the driver's main task that always runs in the driver's 
+ * single context, scheduled through the OS . 
+ * Only one instantiation of this task may run at a time!
+ * 
+ * \note   
+ * \param  hContext   - The module handle
+ * \return void 
+ * \sa     context_RequestSchedule
+ */ 
+void context_DriverTask (TI_HANDLE hContext)
+{
+	TContext       *pContext = (TContext *)hContext;
+    TContextCbFunc  fCbFunc;
+    TI_HANDLE       hCbHndl;
+    TI_UINT32       i;
+
+    TRACE0(pContext->hReport, REPORT_SEVERITY_INFORMATION , "context_DriverTask():\n");
+
+    /* For all registered clients do: */
+	for (i = 0; i < pContext->uNumClients; i++)
+    {
+        /* If client is pending and enabled */
+        if (pContext->aClientPending[i]  &&  pContext->aClientEnabled[i])
+        {
+            #ifdef TI_DBG
+                pContext->aInvokeCount[i]++; 
+                TRACE1(pContext->hReport, REPORT_SEVERITY_INFORMATION , "Invoking - Client=, ID=%d\n", i);
+            #endif /* TI_DBG */
+
+            /* Clear client's pending flag */
+            pContext->aClientPending[i] = TI_FALSE;
+
+            /* Call client's callback function */
+            fCbFunc = pContext->aClientCbFunc[i];
+            hCbHndl = pContext->aClientCbHndl[i];
+            fCbFunc(hCbHndl);
+        }
+    }
+}
+
+
+/** 
+ * \fn     context_EnableClient / context_DisableClient
+ * \brief  Enable a specific client activation
+ * 
+ * Called by the driver main when needed to enble/disable a specific event handling.
+ * The Enable function also schedules the driver-task if the specified client is pending.
+ * 
+ * \note   
+ * \param  hContext   - The module handle
+ * \param  uClientId  - The client's index
+ * \return void 
+ * \sa     context_DriverTask
+ */ 
+void context_EnableClient (TI_HANDLE hContext, TI_UINT32 uClientId)
+{
+	TContext *pContext = (TContext *)hContext;
+
+#ifdef TI_DBG
+    if (pContext->aClientEnabled[uClientId])
+    {
+        TRACE0(pContext->hReport, REPORT_SEVERITY_ERROR , "context_EnableClient() Client  already enabled!!\n");
+        return;
+    }
+    TRACE3(pContext->hReport, REPORT_SEVERITY_INFORMATION , "context_EnableClient(): Client=, ID=%d, enabled=%d, pending=%d\n", uClientId, pContext->aClientEnabled[uClientId], pContext->aClientPending[uClientId]);
+#endif /* TI_DBG */
+
+    /* Enable client */
+    pContext->aClientEnabled[uClientId] = TI_TRUE;
+
+    /* If client is pending, schedule driver task */
+    if (pContext->aClientPending[uClientId])
+    {
+        /* 
+         * If configured to switch context, request driver task scheduling.
+         * Else (context switch not required) call the driver task directly. 
+         */
+		if (TI_OK != OS_REQUEST_SCHEDULE(pContext->hOs)) 
+        {
+            context_DriverTask (hContext);
+        }
+    }
+}
+
+void context_DisableClient (TI_HANDLE hContext, TI_UINT32 uClientId)
+{
+	TContext *pContext = (TContext *)hContext;
+
+#ifdef TI_DBG
+    if (!pContext->aClientEnabled[uClientId])
+    {
+        TRACE0(pContext->hReport, REPORT_SEVERITY_ERROR , "context_DisableClient() Client  already disabled!!\n");
+        return;
+    }
+    TRACE3(pContext->hReport, REPORT_SEVERITY_INFORMATION , "context_DisableClient(): Client=, ID=%d, enabled=%d, pending=%d\n", uClientId, pContext->aClientEnabled[uClientId], pContext->aClientPending[uClientId]);
+#endif /* TI_DBG */
+
+    /* Disable client */
+    pContext->aClientEnabled[uClientId] = TI_FALSE;
+}
+
+/** 
+ * \fn     context_Print
+ * \brief  Print module information
+ * 
+ * Print the module's clients parameters.
+ * 
+ * \note   
+ * \param  hContext - The queue object
+ * \return void
+ * \sa     
+ */ 
+
+#ifdef TI_DBG
+
+void context_Print(TI_HANDLE hContext)
+{
+	TContext *pContext = (TContext *)hContext;
+    TI_UINT32 i;
+
+    WLAN_OS_REPORT(("context_Print():  %d Clients Registered:\n", pContext->uNumClients));
+    WLAN_OS_REPORT(("=======================================\n"));
+
+	for (i = 0; i < pContext->uNumClients; i++)
+	{
+		WLAN_OS_REPORT(("Client %d - %s: CbFunc=0x%x, CbHndl=0x%x, Enabled=%d, Pending=%d, Requests=%d, Invoked=%d\n",
+                        i,
+                        pContext->aClientName[i].sName,
+                        pContext->aClientCbFunc[i],
+                        pContext->aClientCbHndl[i],
+                        pContext->aClientEnabled[i],
+                        pContext->aClientPending[i],
+                        pContext->aRequestCount[i],
+                        pContext->aInvokeCount[i] ));
+	}
+}
+
+#endif /* TI_DBG */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/context.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,136 @@
+/*
+ * context.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   context.h 
+ *  \brief  context module header file.                                  
+ *
+ *  \see    context.c
+ */
+
+#ifndef _CONTEXT_H_
+#define _CONTEXT_H_
+
+#define MAX_CLIENTS     8   /* Maximum number of clients using context services */
+#define MAX_NAME_SIZE   16  /* Maximum client's name string size */
+
+#ifdef TI_DBG
+typedef struct 
+{
+    TI_UINT32       uSize;                  /* Clients' name string size */
+    char            sName [MAX_NAME_SIZE];  /* Clients' name string      */
+} TClientName;	
+#endif /* TI_DBG */
+
+/* The callback function type for context clients */
+typedef void (*TContextCbFunc)(TI_HANDLE hCbHndl);
+
+/* context module structure */
+typedef struct 
+{
+	TI_HANDLE        hOs;
+	TI_HANDLE        hReport; 
+
+    TI_HANDLE        hProtectionLock;              /* Handle of protection lock used by context clients */
+    TI_UINT32        uNumClients;                  /* Number of registered clients      */
+    TContextCbFunc   aClientCbFunc [MAX_CLIENTS];  /* Clients' callback functions       */
+    TI_HANDLE        aClientCbHndl [MAX_CLIENTS];  /* Clients' callback handles         */
+    TI_BOOL          aClientEnabled[MAX_CLIENTS];  /* Clients' enable/disable flags     */
+    TI_BOOL          aClientPending[MAX_CLIENTS];  /* Clients' pending flags            */
+
+#ifdef TI_DBG
+    TClientName      aClientName   [MAX_CLIENTS];  /* Clients' name string              */
+    TI_UINT32        aRequestCount [MAX_CLIENTS];  /* Clients' schedule requests counter*/
+    TI_UINT32        aInvokeCount  [MAX_CLIENTS];  /* Clients' invocations counter      */
+#endif
+
+} TContext;	
+
+
+/* Macros */
+/* =======*/
+/** 
+ * \fn     CONTEXT_ENTER_CRITICAL_SECTION / CONTEXT_LEAVE_CRITICAL_SECTION
+ * \brief  Lock / Unlock context related critical sections
+ * 
+ * The context clients should use these macros for protecting their critical sections
+ *   when handling context transition to driver context.
+ * 
+ * \note   
+ * \param  hContext   - The module handle
+ * \return void 
+ * \sa     
+ */ 
+	/* Start critical section protection */ 
+#define CONTEXT_ENTER_CRITICAL_SECTION(hContext) \
+	OS_ENTER_CRITICAL_SECTION(((TContext *)hContext)->hOs, ((TContext *)hContext)->hProtectionLock);
+
+	/* Stop critical section protection */ 
+#define CONTEXT_LEAVE_CRITICAL_SECTION(hContext) \
+	OS_LEAVE_CRITICAL_SECTION(((TContext *)hContext)->hOs, ((TContext *)hContext)->hProtectionLock);
+
+
+/* External Functions Prototypes */
+/* ============================= */
+TI_HANDLE context_Create          (TI_HANDLE hOs);
+TI_STATUS context_Destroy         (TI_HANDLE hContext);
+void      context_Init            (TI_HANDLE hContext, TI_HANDLE hOs, TI_HANDLE hReport);
+
+TI_UINT32 context_RegisterClient (TI_HANDLE       hContext,
+                                  TContextCbFunc  fCbFunc,
+                                  TI_HANDLE       hCbHndl,
+                                  TI_BOOL         bEnable,
+                                  char           *sName,
+                                  TI_UINT32       uNameSize);
+
+void      context_RequestSchedule (TI_HANDLE hContext, TI_UINT32 uClientId);
+void      context_DriverTask      (TI_HANDLE hContext);
+void      context_EnableClient    (TI_HANDLE hContext, TI_UINT32 uClientId);
+void      context_DisableClient   (TI_HANDLE hContext, TI_UINT32 uClientId);
+void      context_DisableClient   (TI_HANDLE hContext, TI_UINT32 uClientId);
+void      context_EnableClient    (TI_HANDLE hContext, TI_UINT32 uClientId);
+#ifdef TI_DBG
+void      context_Print           (TI_HANDLE hContext);
+#endif /* TI_DBG */
+
+
+
+#endif  /* _CONTEXT_H_ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/freq.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,130 @@
+/*
+ * freq.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  freq.c
+ *  \brief frequency to channel (and vice versa) conversion implementation
+ *
+ *  \see   freq.h
+ */
+
+
+#define __FILE_ID__								FILE_ID_126
+#include "osTIType.h"
+
+#define     CHAN_FREQ_TABLE_SIZE        (sizeof(ChanFreq) / sizeof(CHAN_FREQ))
+
+typedef struct {
+    TI_UINT8       chan;
+    TI_UINT32      freq;
+} CHAN_FREQ;
+
+static CHAN_FREQ ChanFreq[] = {
+    {1,  2412000},
+    {2,  2417000},
+    {3,  2422000},
+    {4,  2427000},
+    {5,  2432000},
+    {6,  2437000},
+    {7,  2442000},
+    {8,  2447000},
+    {9,  2452000},
+    {10, 2457000},
+    {11, 2462000},
+    {12, 2467000},
+    {13, 2472000}, 
+    {14, 2484000}, 
+    {34, 5170000},
+    {36, 5180000},
+    {38, 5190000},
+    {40, 5200000},
+    {42, 5210000},
+    {44, 5220000},
+    {46, 5230000}, 
+    {48, 5240000},
+    {52, 5260000},
+    {56, 5280000},
+    {60, 5300000},
+    {64, 5320000},
+    {100,5500000},
+    {104,5520000},
+    {108,5540000},
+    {112,5560000},
+    {116,5580000},
+    {120,5600000},
+    {124,5620000},
+    {128,5640000},
+    {132,5660000},
+    {136,5680000},
+    {140,5700000},
+    {149,5745000},
+    {153,5765000},
+    {157,5785000},
+    {161,5805000}
+  };
+
+TI_UINT8 Freq2Chan (TI_UINT32 freq)
+{
+    TI_UINT32   i;
+
+    for (i = 0; i < CHAN_FREQ_TABLE_SIZE; i++)
+    {
+        if (ChanFreq[ i ].freq == freq)
+        {
+            return ChanFreq[ i ].chan;
+        }
+    }
+
+    return 0;
+}
+
+
+TI_UINT32 Chan2Freq (TI_UINT8 chan)
+{
+    TI_UINT32   i;
+
+    for (i = 0; i < CHAN_FREQ_TABLE_SIZE; i++)
+    {
+        if (ChanFreq[ i ].chan == chan)
+        {
+            return ChanFreq[ i ].freq;
+        }
+    }
+
+    return 0;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/freq.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,55 @@
+/*
+ * freq.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  freq.h
+ *  \brief frequency to channel (and vice versa) conversion
+ *
+ *  \see   freq.c
+ */
+
+
+#ifndef __FREQ_H__
+#define __FREQ_H__
+
+#include "osTIType.h"
+
+TI_UINT8 Freq2Chan (TI_UINT32 freq);
+TI_UINT32 Chan2Freq (TI_UINT8 chan);
+
+#endif /* __FREQ_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/fsm.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,320 @@
+/*
+ * fsm.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 fsm.c
+ *  \brief finite state machine source code
+ *
+ *  \see fsm.h
+ */
+
+
+/***************************************************************************/
+/*																		   */
+/*		MODULE:	fsm.c													   */
+/*    PURPOSE:	Finite State Machine source code						   */
+/*																	 	   */
+/***************************************************************************/
+
+#define __FILE_ID__  FILE_ID_127
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "fsm.h"
+
+/* Constants */
+
+/* Enumerations */
+
+/* Typedefs */
+
+/* Structures */
+
+/* External data definitions */
+
+/* External functions definitions */
+
+/* Function prototypes */
+
+/**
+*
+* fsm_Init  - Initialize the FSM structure
+*
+* \b Description: 
+*
+* Init The FSM structure. If matrix argument is NULL, allocate memory for
+* new matrix.
+*
+* \b ARGS:
+*
+*  O   - pFsm - the generated FSM module  \n
+*  I   - noOfStates - Number of states in the module \n
+*  I   - noOfStates - Number of events in the module \n
+*  I/O - matrix - the state event matrix
+*  I   - transFunc - Transition finction for the state machine \n
+*
+* \b RETURNS:
+*
+*  TI_OK on success, TI_NOK on failure 
+*
+* \sa fsm_Event
+*/
+TI_STATUS fsm_Create(TI_HANDLE				hOs,
+				fsm_stateMachine_t		**pFsm,
+				TI_UINT8					MaxNoOfStates,
+				TI_UINT8					MaxNoOfEvents)
+{
+	/* check for perliminary conditions */
+	if ((pFsm == NULL) || (MaxNoOfStates == 0) || (MaxNoOfEvents == 0))
+	{
+		return TI_NOK;
+	}
+
+	/* allocate memory for FSM context */
+	*pFsm = (fsm_stateMachine_t *)os_memoryAlloc(hOs, sizeof(fsm_stateMachine_t),MemoryNormal);
+	if (*pFsm == NULL)
+	{
+		return TI_NOK;
+	}
+
+	/* allocate memory for FSM matrix */
+	(*pFsm)->stateEventMatrix = (fsm_Matrix_t)os_memoryAlloc(hOs, MaxNoOfStates * MaxNoOfEvents * sizeof(fsm_actionCell_t),MemoryNormal);
+	if ((*pFsm)->stateEventMatrix == NULL)
+	{
+		os_memoryFree(hOs, *pFsm, sizeof(fsm_stateMachine_t));
+		return TI_NOK;
+	}
+
+	/* update pFsm structure with parameters */
+	(*pFsm)->MaxNoOfStates = MaxNoOfStates;
+	(*pFsm)->MaxNoOfEvents = MaxNoOfEvents;
+
+	return(TI_OK);
+}
+
+/**
+*
+* fsm_Unload  - free all memory allocated to FSM structure
+*
+* \b Description: 
+*
+* Unload the FSM structure.
+*
+* \b ARGS:
+*
+*  O   - pFsm - the generated FSM module  \n
+*  I   - noOfStates - Number of states in the module \n
+*  I   - noOfStates - Number of events in the module \n
+*  I/O - matrix - the state event matrix
+*  I   - transFunc - Transition finction for the state machine \n
+*
+* \b RETURNS:
+*
+*  TI_OK on success, TI_NOK on failure 
+*
+* \sa fsm_Event
+*/
+TI_STATUS fsm_Unload(TI_HANDLE				hOs,
+				fsm_stateMachine_t		*pFsm)
+{
+	/* check for perliminary conditions */
+	if (pFsm == NULL)
+	{
+		return TI_NOK;
+	}
+
+	/* free memory of FSM matrix */
+	if (pFsm->stateEventMatrix != NULL)
+	{
+		os_memoryFree(hOs, pFsm->stateEventMatrix,
+					  pFsm->MaxNoOfStates * pFsm->MaxNoOfEvents * sizeof(fsm_actionCell_t));
+	}
+
+	/* free memory for FSM context (no need to check for null) */
+	os_memoryFree(hOs, pFsm, sizeof(fsm_stateMachine_t));
+
+	return(TI_OK);
+}
+
+/**
+*
+* fsm_Init  - Initialize the FSM structure
+*
+* \b Description: 
+*
+* Init The FSM structure. If matrix argument is NULL, allocate memory for
+* new matrix.
+*
+* \b ARGS:
+*
+*  O   - pFsm - the generated FSM module  \n
+*  I   - noOfStates - Number of states in the module \n
+*  I   - noOfStates - Number of events in the module \n
+*  I/O - matrix - the state event matrix
+*  I   - transFunc - Transition finction for the state machine \n
+*
+* \b RETURNS:
+*
+*  TI_OK on success, TI_NOK on failure 
+*
+* \sa fsm_Event
+*/
+TI_STATUS fsm_Config(fsm_stateMachine_t	*pFsm,
+				  fsm_Matrix_t			pMatrix,
+				  TI_UINT8					ActiveNoOfStates,
+				  TI_UINT8					ActiveNoOfEvents,
+				  fsm_eventActivation_t	transFunc,
+				  TI_HANDLE				hOs)
+{
+	/* check for perliminary conditions */
+	if ((pFsm == NULL) ||
+		(pMatrix == NULL))
+	{
+		return TI_NOK;
+	}
+
+	if ((ActiveNoOfStates > pFsm->MaxNoOfStates) || 
+		(ActiveNoOfEvents > pFsm->MaxNoOfEvents))
+	{
+		return TI_NOK;
+	}
+
+	/* copy matrix to FSM context */
+	os_memoryCopy(hOs, (void *)pFsm->stateEventMatrix, (void *)pMatrix,
+				  ActiveNoOfStates * ActiveNoOfEvents * sizeof(fsm_actionCell_t));
+
+	/* update pFsm structure with parameters */
+	pFsm->ActiveNoOfStates = ActiveNoOfStates;
+	pFsm->ActiveNoOfEvents = ActiveNoOfEvents;
+	pFsm->transitionFunc = transFunc;
+	return(TI_OK);
+}
+
+/**
+*
+* fsm_Event  - perform event transition in the matrix
+*
+* \b Description: 
+*
+* Perform event transition in the matrix
+*
+* \b ARGS:
+*
+*  I   - pFsm - the generated FSM module  \n
+*  I/O - currentState - current state of the SM \n
+*  I   - event - event causing transition \n
+*  I   - pData - data for activation function \n
+*
+* \b RETURNS:
+*
+*  TI_OK on success, TI_NOK on failure 
+*
+* \sa fsm_Init
+*/
+TI_STATUS fsm_Event(fsm_stateMachine_t		*pFsm,
+				 TI_UINT8					*currentState,
+				 TI_UINT8					event,
+				 void					*pData)
+{
+	TI_UINT8		oldState;
+	TI_STATUS		status;
+
+	/* check for FSM existance */
+	if (pFsm == NULL)
+	{
+		return(TI_NOK);
+	}
+
+	/* boundary check */
+	if ((*currentState >= pFsm->ActiveNoOfStates) || (event >= pFsm->ActiveNoOfEvents))
+	{
+		return(TI_NOK);
+	}
+	
+	oldState = *currentState;
+	/* update current state */
+	*currentState = pFsm->stateEventMatrix[(*currentState * pFsm->ActiveNoOfEvents) + event].nextState;
+
+	/* activate transition function */
+	status = (*pFsm->stateEventMatrix[(oldState * pFsm->ActiveNoOfEvents) + event].actionFunc)(pData);
+
+	return status;
+}
+
+
+/**
+*
+* fsm_GetNextState  - Retrun the next state for a given current state and an event.
+*
+* \b Description: 
+*
+* Retrun the next state for a given current state and an event.
+*
+* \b ARGS:
+*
+*  I   - pFsm - the generated FSM module  \n
+*  I   - currentState - current state of the SM \n
+*  I   - event - event causing transition \n
+*  O   - nextState - returned next state \n
+*
+* \b RETURNS:
+*
+*  TI_OK on success, TI_NOK on failure 
+*
+* \sa 
+*/
+TI_STATUS fsm_GetNextState(fsm_stateMachine_t		*pFsm,
+						TI_UINT8					currentState,
+						TI_UINT8					event,
+						TI_UINT8					*nextState)
+{
+	if (pFsm != NULL)
+	{
+		if ((currentState < pFsm->ActiveNoOfStates) && (event < pFsm->ActiveNoOfEvents))
+		{
+			*nextState = pFsm->stateEventMatrix[(currentState * pFsm->ActiveNoOfEvents) + event].nextState;
+			return(TI_OK);
+		}
+	}
+	
+	return(TI_NOK);
+}
+
+TI_STATUS action_nop(void *pData)
+{
+	return TI_OK;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/fsm.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,131 @@
+/*
+ * fsm.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 fsm.h
+ *  \brief finite state machine header file
+ *
+ *  \see fsm.c
+ */
+
+
+/***************************************************************************/
+/*																		   */
+/*		MODULE:	fsm.h													   */
+/*    PURPOSE:	Finite State Machine API								   */
+/*																	 	   */
+/***************************************************************************/
+
+#ifndef __FSM_H__
+#define __FSM_H__
+
+#include "tidef.h"
+#include "commonTypes.h"
+
+/* Constants */
+#define	MAX_DESC_STRING_LEN		64		
+
+
+/* Enumerations */
+
+/* Typedefs */
+
+/** state transition function */
+typedef	TI_STATUS (*fsm_eventActivation_t)(TI_UINT8 *currState, TI_UINT8 event, void* data);
+
+/** action function type definition */
+typedef TI_STATUS (*fsm_Action_t)(void* pData);
+
+/* Structures */
+
+/* State\Event cell */
+typedef  struct
+{
+	TI_UINT8			nextState;		/**< next state in transition */
+	fsm_Action_t	actionFunc;		/**< action function */
+} fsm_actionCell_t;
+
+/** matrix type */
+typedef	fsm_actionCell_t*		fsm_Matrix_t;
+
+/** general FSM structure */
+typedef struct
+{
+	fsm_Matrix_t			stateEventMatrix;		/**< State\Event matrix */
+	TI_UINT8					MaxNoOfStates;			/**< Max Number of states in the matrix */
+	TI_UINT8					MaxNoOfEvents;			/**< Max Number of events in the matrix */
+	TI_UINT8					ActiveNoOfStates;		/**< Active Number of states in the matrix */
+	TI_UINT8					ActiveNoOfEvents;		/**< Active Number of events in the matrix */
+	fsm_eventActivation_t	transitionFunc;			/**< State transition function */
+} fsm_stateMachine_t;
+
+/* External data definitions */
+
+/* External functions definitions */
+
+/* Function prototypes */
+
+TI_STATUS fsm_Create(TI_HANDLE				hOs,
+				fsm_stateMachine_t		**pFsm,
+				TI_UINT8					MaxNoOfStates,
+				TI_UINT8					MaxNoOfEvents);
+
+TI_STATUS fsm_Unload(TI_HANDLE				hOs,
+				fsm_stateMachine_t		*pFsm);
+
+TI_STATUS fsm_Config(fsm_stateMachine_t	*pFsm,
+				  fsm_Matrix_t			pMatrix,
+				  TI_UINT8					ActiveNoOfStates,
+				  TI_UINT8					ActiveNoOfEvents,
+				  fsm_eventActivation_t	transFunc,
+				  TI_HANDLE				hOs);
+
+TI_STATUS fsm_Event(fsm_stateMachine_t		*pFsm,
+				 TI_UINT8					*currentState,
+				 TI_UINT8					event,
+				 void					*pData);
+
+TI_STATUS fsm_GetNextState(fsm_stateMachine_t		*pFsm,
+						TI_UINT8					currentState,
+						TI_UINT8					event,
+						TI_UINT8					*nextState);
+
+
+TI_STATUS action_nop(void *pData);
+
+
+#endif /* __FSM_H__ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/mem.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,235 @@
+/*
+ * mem.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+#define __FILE_ID__  FILE_ID_129
+#include "tidef.h"
+#include "osApi.h"
+
+
+#define MEM_BLOCK_START  (('m'<<24) | ('e'<<16) | ('m'<<8) | 's')
+#define MEM_BLOCK_END    (('m'<<24) | ('e'<<16) | ('m'<<8) | 'e')
+
+
+typedef struct
+{
+    TI_HANDLE hOs;
+    TI_UINT32 uMaxAllocated;
+    TI_UINT32 uCurAllocated;
+
+} TMemMng;
+
+
+typedef struct
+{
+    TI_UINT32 size;
+    TI_UINT32 signature;
+
+} TMemBlock;
+
+
+
+/****************************************************************************************
+ *                                                                                      *
+ *                      OS Memory API                                                   *       
+ *                                                                                      *
+ ****************************************************************************************/
+TI_HANDLE mem_Create (TI_HANDLE hOs)
+{
+    TMemMng *pMemMng = (TMemMng *)os_memoryAlloc (hOs, sizeof(TMemMng),MemoryNormal);
+
+    if (pMemMng != NULL) 
+    {
+        pMemMng->hOs = hOs;
+        pMemMng->uCurAllocated = 0;
+        pMemMng->uMaxAllocated = 0;
+    }
+
+    return (TI_HANDLE)pMemMng;
+}
+
+
+TI_STATUS mem_Destroy (TI_HANDLE hMem)
+{
+    TMemMng *pMemMng = (TMemMng *)hMem;
+
+    if (pMemMng != NULL) 
+    {
+        os_memoryFree (pMemMng->hOs, (void *)pMemMng, sizeof(TMemMng));
+    }
+
+    return TI_OK;
+}
+
+
+
+/****************************************************************************************
+ *                        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* mem_Alloc (TI_HANDLE hMem, TI_UINT32 size)
+{
+    TMemMng *pMemMng = (TMemMng *)hMem;
+    TMemBlock *pMemBlock;
+    TI_UINT32 total = size + sizeof(TMemBlock) + sizeof(TI_UINT32);
+
+  #ifdef TI_MEM_ALLOC_TRACE
+    os_printf ("mem_Alloc(0x%p, %lu) : %u\n", hMem, size, uTotalSize);
+  #endif
+
+    pMemBlock = (TMemBlock *) os_memoryAlloc (pMemMng->hOs, total,MemoryNormal);
+    pMemBlock->size = size;
+    pMemBlock->signature = MEM_BLOCK_START;
+    *(TI_UINT32 *)((TI_UINT8 *)pMemBlock + total - sizeof(TI_UINT32)) = MEM_BLOCK_END;
+
+    pMemMng->uCurAllocated += total;
+    if (pMemMng->uMaxAllocated < pMemMng->uCurAllocated) 
+    {
+        pMemMng->uMaxAllocated = pMemMng->uCurAllocated;
+    }
+
+    return (void*)((TI_UINT8 *)pMemBlock + sizeof(TMemBlock));
+}
+
+
+/****************************************************************************************
+ *                        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* mem_Calloc (TI_HANDLE hMem, TI_UINT32 number, TI_UINT32 size)
+{
+    TMemMng *pMemMng = (TMemMng *)hMem;
+    void *ptr;
+    TI_UINT32 total;
+
+    total = number * size;
+
+ #ifdef TI_MEM_ALLOC_TRACE
+    os_printf ("os_memoryCAlloc(%u, %u) : %u\n", number, size, total);
+ #endif
+
+    ptr = mem_Alloc (hMem, total);
+
+    if (ptr != NULL)
+    {
+        os_memorySet (pMemMng->hOs, ptr, 0, total);
+    }
+
+    return ptr;
+}
+
+
+
+/****************************************************************************************
+ *                        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 mem_Free (TI_HANDLE hMem, void* ptr, TI_UINT32 size)
+{
+    TMemMng *pMemMng = (TMemMng *)hMem;
+    TMemBlock *pMemBlock = (TMemBlock *)((TI_UINT8 *)ptr - sizeof(TMemBlock));
+   
+  #ifdef TI_MEM_ALLOC_TRACE
+    os_printf ("os_memoryFree(%p, %u)\n", ptr, size);
+  #endif
+
+    if (pMemBlock->signature != MEM_BLOCK_START)
+    {
+      #ifdef TI_MEM_ALLOC_TRACE
+        os_printf ("os_memoryFree: memory block signature is incorrect - 0x%x\n", pMemBlock->signature);
+      #endif
+    }
+
+    else
+    {
+        *(TI_UINT8 *)(&pMemBlock->signature) = '~';
+        if (*(TI_UINT32 *)((TI_UINT8 *)pMemBlock + pMemBlock->size + sizeof(TMemBlock)) != MEM_BLOCK_END)
+        {
+          #ifdef TI_MEM_ALLOC_TRACE
+            os_printf ("os_memoryFree: memory block corruption, size - %u\n", pMemBlock->size);
+          #endif
+        }
+
+        os_memoryFree (pMemMng->hOs, pMemBlock, pMemBlock->signature + sizeof(TMemBlock) + sizeof(TI_UINT32));
+
+        pMemMng->uCurAllocated -= size + sizeof(TMemBlock) + sizeof(TI_UINT32);
+
+        if ((int)pMemMng->uCurAllocated < 0) 
+        {
+          #ifdef TI_MEM_ALLOC_TRACE
+            os_printf ("os_memoryFree: memory heap allocation calculation corrupted, size=%u, current=%u\n",
+                       size, drv->cur_heap_bytes_allocated);
+          #endif
+            pMemMng->uCurAllocated = 0;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/mem.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,39 @@
+/*
+ * mem.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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.
+ */
+
+void
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/osDot11.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,690 @@
+/*
+ * osDot11.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 __OSDOT11_H__
+#define __OSDOT11_H__
+
+#include "tidef.h"
+#include "tiQosTypes.h"
+
+
+#define	OS_STATUS_MEDIA_SPECIFIC_INDICATION	((NDIS_STATUS)0x40010012L)
+
+#define OS_802_11_REQUEST_REAUTH					0x01
+#define OS_802_11_REQUEST_KEYUPDATE					0x02
+#define OS_802_11_REQUEST_PAIRWISE_ERROR			0x06
+#define OS_802_11_REQUEST_GROUP_ERROR				0x0E
+
+#define OS_802_11_SSID_FIRST_VALID_CHAR             32
+
+#define OS_802_11_SSID_JUNK(str,len)                   \
+        ((len) > 2 &&                                  \
+         (str)[0] < OS_802_11_SSID_FIRST_VALID_CHAR && \
+         (str)[1] < OS_802_11_SSID_FIRST_VALID_CHAR && \
+         (str)[2] < OS_802_11_SSID_FIRST_VALID_CHAR)
+
+
+/**/
+/*  Per-packet information for Ieee8021QInfo.*/
+/**/
+typedef struct _OS_PACKET_8021Q_INFO
+{
+    union
+    {
+        struct
+        {
+            TI_UINT32      UserPriority:3;         /* 802.1p priority */
+            TI_UINT32      CanonicalFormatId:1;    /* always 0*/
+            TI_UINT32      VlanId:12;              /* VLAN Identification*/
+            TI_UINT32      Reserved:16;            /* set to 0*/
+        }   TagHeader;
+
+        void*  Value;
+    }u;
+} OS_PACKET_8021Q_INFO, *POS_PACKET_8021Q_INFO;
+
+
+typedef TI_UINT64 OS_802_11_KEY_RSC;
+
+typedef struct _OS_802_11_SSID 
+{
+    TI_UINT32 SsidLength;
+    TI_UINT8  Ssid[32];
+} OS_802_11_SSID, *POS_802_11_SSID;
+
+typedef enum _OS_802_11_NETWORK_TYPE
+{
+  os802_11FH,
+  os802_11DS,
+  os802_11OFDM5,
+  os802_11OFDM24,
+  os802_11Automode,
+  os802_11NetworkTypeMax
+} OS_802_11_NETWORK_TYPE;
+
+typedef struct _OS_802_11_NETWORK_TYPE_LIST 
+{
+  TI_UINT32                  NumberOfItems;
+  OS_802_11_NETWORK_TYPE NetworkType [1];
+} OS_802_11_NETWORK_TYPE_LIST, *POS_802_11_NETWORK_TYPE_LIST;
+
+typedef enum _OS_802_11_POWER_MODE
+{
+  /*Continuous access mode (CAM). */
+  /*When the power mode is set to CAM, the device is always on. */
+  os802_11PowerModeCAM, 
+
+  /*Specifies maximum (MAX) power saving. A power mode of MAX */
+  /*results in the greatest power savings for the 802.11 NIC radio. */
+  os802_11PowerModeMAX_PSP,
+
+  /*Specifies fast power-saving mode. This power mode provides */
+  /*the best combination of network performance and power usage. */
+  os802_11PowerModeFast_PSP,
+  os802_11PowerModeMax
+} OS_802_11_POWER_MODE;
+
+/*specified in milliwatts (mW).*/
+typedef TI_UINT32 OS_802_11_TX_POWER_LEVEL;
+/*Normal value from -10 and -200*/
+typedef TI_INT32 OS_802_11_RSSI; 
+
+/*Length */
+
+/*  Specifies the length of the OS_802_11_CONFIGURATION_FH structure in bytes. */
+/*HopPattern*/
+/*  Specifies the hop pattern used to determine the hop sequence. */
+/*  As defined by the 802.11 standard, the layer management entity (LME) of */
+/*  the physical layer uses a hop pattern to determine the hop sequence. */
+/*HopSet*/
+/*  Specifies a set of patterns. The LME of the physical layer uses these */
+/*  patterns to determine the hop sequence. */
+/*DwellTime*/
+/*  Specifies the maximum period of time during which the transmitter */
+/*  should remain fixed on a channel. This interval is described in Kµsec (1024 µsec). */
+typedef struct _OS_802_11_CONFIGURATION_FH 
+{
+    TI_UINT32  Length; 
+    TI_UINT32  HopPattern;
+    TI_UINT32  HopSet; 
+    TI_UINT32  DwellTime;
+} OS_802_11_CONFIGURATION_FH, *POS_802_11_CONFIGURATION_FH;
+
+/*Length */
+
+/*  Specifies the length of the NDIS_802_11_CONFIGURATION structure in bytes. */
+/*BeaconPeriod */
+/*  Specifies the interval between beacon message transmissions. */
+/*  This value is specified in Kµsec (1024 µsec). */
+/*ATIMWindow */
+/*  Specifies the announcement traffic information message (ATIM) window in */
+/*  Kµsec (1024 µsec). The ATIM window is a short time period immediately */
+/*  after the transmission of each beacon in an IBSS configuration. */
+/*  During the ATIM window, any station can indicate the need to transfer data */
+/*  to another station during the following data-transmission window. */
+/*DSConfig */
+/*  Specifies the frequency of the selected channel in kHz. */
+/*FHConfig */
+/*  Specifies the frequency hopping configuration in an OS_802_11_CONFIGURATION_FH structure. */
+typedef struct _OS_802_11_CONFIGURATION 
+{
+    TI_UINT32 Length;
+    TI_UINT32 BeaconPeriod;
+    TI_UINT32 ATIMWindow;
+  union 
+  {
+        TI_UINT32 DSConfig;
+        TI_UINT32 channel;
+  } Union;
+  OS_802_11_CONFIGURATION_FH FHConfig;
+} OS_802_11_CONFIGURATION, *POS_802_11_CONFIGURATION;
+
+/*Ndis802_11IBSS */
+/*  Specifies the independent basic service set (IBSS) mode. */
+/*  This mode is also known as ad hoc mode. */
+/*Ndis802_11Infrastructure */
+/*  Specifies the infrastructure mode. */
+/*Ndis802_11AutoUnknown */
+/*  Specifies an automatic mode. In this mode, the 802.11 NIC can switch */
+/*  between ad hoc and infrastructure modes as required. */
+/*Ndis802_11HighSpeedIBSS*/
+/*  Specifies proprietary ad hoc mode that works only PBCC.*/
+typedef enum _OS_802_11_NETWORK_MODE
+{
+  os802_11IBSS,
+  os802_11Infrastructure,
+  os802_11AutoUnknown,
+  os802_11HighSpeedIBSS,
+  os802_11InfrastructureMax
+} OS_802_11_NETWORK_MODE, OS_802_11_NETWORK_INFRASTRUCTURE,*POS_802_11_NETWORK_INFRASTRUCTURE;
+
+/**/
+/*The rates array contains a set of eight octets. */
+/*Each octet contains a desired data rate in units of .5 Mbps.*/
+/**/
+typedef TI_UINT8 OS_802_11_RATES[8];
+
+typedef TI_UINT8 OS_802_11_RATES_EX[16];
+
+typedef struct _OS_802_11_FIXED_IEs 
+{
+	TI_UINT8  TimeStamp[8]; 
+	TI_UINT16 BeaconInterval;
+	TI_UINT16 Capabilities; 
+} OS_802_11_FIXED_IEs, *POS_802_11_FIXED_IEs;
+
+typedef struct _OS_802_11_VARIABLE_IEs 
+{
+	TI_UINT8 ElementID;
+	TI_UINT8 Length;	/* Number of bytes in data field*/
+	TI_UINT8 data[1];
+}  OS_802_11_VARIABLE_IEs, *POS_802_11_VARIABLE_IEs;
+
+typedef struct _OS_802_11_BSSID
+{
+  TI_UINT32 Length;
+  TMacAddr                  MacAddress;
+  TI_UINT16					Capabilities; 
+  OS_802_11_SSID            Ssid;
+  TI_UINT32                 Privacy;
+  OS_802_11_RSSI            Rssi;
+  OS_802_11_NETWORK_TYPE    NetworkTypeInUse;
+  OS_802_11_CONFIGURATION   Configuration;
+  OS_802_11_NETWORK_MODE    InfrastructureMode;
+  OS_802_11_RATES           SupportedRates;
+}  OS_802_11_BSSID, *POS_802_11_BSSID;
+
+typedef struct _OS_802_11_BSSID_LIST
+{
+    TI_UINT32          NumberOfItems;
+  OS_802_11_BSSID  Bssid[1];
+}  OS_802_11_BSSID_LIST, *POS_802_11_BSSID_LIST;
+
+
+typedef struct _OS_802_11_BSSID_EX
+{
+  TI_UINT32					Length;
+  TMacAddr		            MacAddress;
+  TI_UINT16					Capabilities; 
+  OS_802_11_SSID            Ssid;
+  TI_UINT32                 Privacy;
+  OS_802_11_RSSI            Rssi;
+  OS_802_11_NETWORK_TYPE    NetworkTypeInUse;
+  OS_802_11_CONFIGURATION   Configuration;
+  OS_802_11_NETWORK_MODE    InfrastructureMode;
+  OS_802_11_RATES_EX        SupportedRates;
+  TI_UINT32                 IELength;
+  TI_UINT8                  IEs[1];
+} OS_802_11_BSSID_EX, *POS_802_11_BSSID_EX, OS_WLAN_BSSID_EX, *POS_WLAN_BSSID_EX;
+
+typedef struct _OS_802_11_BSSID_LIST_EX
+{
+  TI_UINT32                 NumberOfItems;
+  OS_802_11_BSSID_EX        Bssid[1];
+}  OS_802_11_BSSID_LIST_EX, *POS_802_11_BSSID_LIST_EX;
+
+
+typedef TI_UINT32 OS_802_11_FRAGMENTATION_THRESHOLD;
+typedef TI_UINT32 OS_802_11_RTS_THRESHOLD;
+typedef TI_UINT32 OS_802_11_ANTENNA;
+
+
+/*Length */
+/*  Specifies the length of the NDIS_802_11_WEP structure in bytes. */
+/*KeyIndex */
+/*  Specifies which key to add or remove. The global keys are represented */
+/*  by values of zero to n. When the most significant bit is set to 1, */
+/*  it indicates the key used to transmit to the access point. */
+/*KeyLength */
+/*  Specifies the length of the KeyMaterial character array in bytes. */
+/*KeyMaterial */
+/*  Specifies an arraythat identifies the WEP key. The length of this array is */
+/*  variable and depends upon the value of the KeyLength member. */
+
+typedef TI_UINT32 OS_802_11_KEY_INDEX;
+typedef struct _OS_802_11_WEP 
+{
+    TI_UINT32 Length;
+    TI_UINT32 KeyIndex; 
+    TI_UINT32 KeyLength;
+    TI_UINT8  KeyMaterial [32]; 
+} OS_802_11_WEP, *POS_802_11_WEP;
+
+/* Key mapping keys require a BSSID*/
+/*typedef tiUINT64 OS_802_11_KEY_RSC;*/
+
+typedef struct _OS_802_11_KEY
+{
+    TI_UINT32                  Length;             /* Length of this structure*/
+    TI_UINT32                  KeyIndex;
+    TI_UINT32                  KeyLength;          /* length of key in bytes*/
+    TMacAddr                   BSSID;
+    OS_802_11_KEY_RSC          KeyRSC;
+    TI_UINT8                   KeyMaterial[32];     /* variable length depending on above field*/
+}  OS_802_11_KEY, *POS_802_11_KEY;
+
+typedef struct _OS_802_11_REMOVE_KEY
+{
+    TI_UINT32                  Length;             /* Length of this structure*/
+    TI_UINT32                  KeyIndex;
+    TMacAddr                   BSSID;
+} OS_802_11_REMOVE_KEY, *POS_802_11_REMOVE_KEY;
+
+#define OS_802_11_AI_REQFI_CAPABILITIES     1
+#define OS_802_11_AI_REQFI_LISTENINTERVAL   2
+#define OS_802_11_AI_REQFI_CURRENTAPADDRESS 4
+
+
+#define OS_802_11_AI_RESFI_CAPABILITIES     1
+#define OS_802_11_AI_RESFI_STATUSCODE       2
+#define OS_802_11_AI_RESFI_ASSOCIATIONID    4
+
+typedef struct _OS_802_11_AI_REQFI
+{
+	TI_UINT16 Capabilities;
+	TI_UINT16 ListenInterval;
+	TMacAddr  CurrentAPAddress;
+    TI_UINT16 reserved; /* added for packing */
+
+} OS_802_11_AI_REQFI;
+
+typedef struct _OS_802_11_AI_RESFI
+{
+	TI_UINT16 Capabilities;
+	TI_UINT16 StatusCode;
+	TI_UINT16 AssociationId;
+#ifndef _WINDOWS
+    TI_UINT16 reserved; /* added for packing */
+#endif
+} OS_802_11_AI_RESFI;
+
+typedef struct _OS_802_11_ASSOCIATION_INFORMATION
+{
+    TI_UINT32 Length;
+    TI_UINT16 AvailableRequestFixedIEs;
+    OS_802_11_AI_REQFI RequestFixedIEs;
+    TI_UINT32 RequestIELength;
+    TI_UINT32 OffsetRequestIEs;
+    TI_UINT16 AvailableResponseFixedIEs;
+    OS_802_11_AI_RESFI ResponseFixedIEs;
+    TI_UINT32 ResponseIELength;
+    TI_UINT32 OffsetResponseIEs;
+
+}  OS_802_11_ASSOCIATION_INFORMATION, *POS_802_11_ASSOCIATION_INFORMATION;
+
+
+/* supported EAP types*/
+typedef enum _OS_802_11_EAP_TYPES
+{
+    OS_EAP_TYPE_NONE                = -1,
+	OS_EAP_TYPE_MD5_CHALLENGE		= 4,
+	OS_EAP_TYPE_GENERIC_TOKEN_CARD	= 6,
+	OS_EAP_TYPE_TLS					= 13,
+	OS_EAP_TYPE_LEAP				= 17,
+	OS_EAP_TYPE_TTLS				= 21,
+	OS_EAP_TYPE_PEAP				= 25,
+	OS_EAP_TYPE_MS_CHAP_V2			= 26,
+    OS_EAP_TYPE_FAST                = 43
+} OS_802_11_EAP_TYPES;
+
+/* encryption type*/
+typedef enum _OS_802_11_ENCRYPTION_TYPES
+{
+	OS_ENCRYPTION_TYPE_NONE = 0,
+	OS_ENCRYPTION_TYPE_WEP,
+	OS_ENCRYPTION_TYPE_TKIP,
+	OS_ENCRYPTION_TYPE_AES 
+} OS_802_11_ENCRYPTION_TYPES;
+
+/* Key type*/
+typedef enum _OS_802_11_KEY_TYPES
+{
+    OS_KEY_TYPE_STATIC = 0,
+    OS_KEY_TYPE_DYNAMIC
+} OS_802_11_KEY_TYPES;
+
+/* ELP mode*/
+typedef enum _OS_802_11_ELP_MODES
+{
+	OS_ELP_MODE_DISABLE,
+	OS_ELP_MODE_SYNC,
+    OS_ELP_MODE_NON_SYNC
+} OS_802_11_ELP_MODES;
+
+/* Roaming mode*/
+typedef enum _OS_802_11_ROAMING_MODES
+{
+	OS_ROAMING_MODE_DISABLE,
+	OS_ROAMING_MODE_ENABLE
+} OS_802_11_ROAMING_MODES;
+
+typedef enum _OS_802_11_POWER_PROFILE
+{
+    OS_POWER_MODE_AUTO,
+    OS_POWER_MODE_ACTIVE,
+    OS_POWER_MODE_SHORT_DOZE,
+    OS_POWER_MODE_LONG_DOZE
+} OS_802_11_POWER_PROFILE;
+
+typedef enum _OS_802_11_POWER_LEVELS
+{
+    OS_POWER_LEVEL_ELP,
+    OS_POWER_LEVEL_PD,
+    OS_POWER_LEVEL_AWAKE
+} OS_802_11_POWER_LEVELS;
+
+
+typedef enum _OS_802_11_BEACON_FILTER_MODE
+{
+    OS_BEACON_FILTER_MODE_INACTIVE,
+    OS_BEACON_FILTER_MODE_ACTIVE
+} OS_802_11_BEACON_FILTER_MODE;
+
+
+typedef enum _OS_802_11_SCAN_TYPES
+{
+    OS_SCAN_TYPE_PASSIVE,
+    OS_SCAN_TYPE_BROADCAST,
+    OS_SCAN_TYPE_UNICAST
+} OS_802_11_SCAN_TYPES;
+
+typedef enum _OS_802_11_VOICE_DELIVERY_PROTOCOL
+{
+    OS_VOICE_DELIVERY_PROTOCOL_DISABLED,
+    OS_VOICE_DELIVERY_PROTOCOL_PS_POLL   
+} OS_802_11_VOICE_DELIVERY_PROTOCOL;
+
+typedef struct _OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS
+{
+    TI_UINT32 uHighThreshold;
+	TI_UINT32 uLowThreshold;
+    TI_UINT32 TestInterval;
+} OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_PARAMS;
+
+typedef struct{
+	TI_UINT32 uHighOrLowThresholdFlag;                /* high or low */
+	TI_UINT32 uAboveOrBelowFlag;       /* direction of crossing */
+} OS_802_11_TRAFFIC_INTENSITY_THRESHOLD_CROSS_INDICATION_PARAMS;
+
+typedef TI_UINT8   OS_802_11_PMKID_VALUE[16];
+
+typedef struct _OS_BSSIDInfo
+{
+    TMacAddr   BSSID;
+    OS_802_11_PMKID_VALUE   PMKID;
+}  OS_BSSIDInfo, *POS_BSSIDInfo;
+
+typedef struct _OS_802_11_PMKID
+{
+    TI_UINT32        Length;
+    TI_UINT32        BSSIDInfoCount;
+    OS_BSSIDInfo    osBSSIDInfo[1];
+}  OS_802_11_PMKID, *POS_802_11_PMKID;
+
+typedef enum _OS_802_11_WEP_STATUS 
+{
+  os802_11WEPEnabled = 0,
+  os802_11Encryption1Enabled = os802_11WEPEnabled,
+  os802_11WEPDisabled,
+  os802_11EncryptionDisabled = os802_11WEPDisabled,
+  os802_11WEPKeyAbsent,
+  os802_11Encryption1KeyAbsent = os802_11WEPKeyAbsent,
+  os802_11WEPNotSupported,
+  os802_11EncryptionNotSupported = os802_11WEPNotSupported,
+  os802_11Encryption2Enabled,
+  os802_11Encryption2KeyAbsent,
+  os802_11Encryption3Enabled,
+  os802_11Encryption3KeyAbsent
+} OS_802_11_WEP_STATUS, OS_802_11_ENCRYPTION_STATUS;
+
+/*os802_11AuthModeOpen */
+/*  Specifies 802.11 open authentication mode. There are no checks when accepting */
+/*  clients in this mode. */
+/*os802_11AuthModeShared */
+/*  Specifies 802.11 shared authentication that uses a pre-shared wired equivalent */
+/*  privacy (WEP) key. */
+/*os802_11AuthModeAutoSwitch */
+/*  Specifies auto-switch mode. When using auto-switch mode, the NIC tries 802.11 shared */
+/*  authentication mode first. If shared mode fails, the NIC attempts to use 802.11 open */
+/*  authentication mode. */
+
+typedef enum _OS_802_11_AUTHENTICATION_MODE 
+{
+    os802_11AuthModeOpen,
+    os802_11AuthModeShared,
+    os802_11AuthModeAutoSwitch,
+    os802_11AuthModeWPA,
+    os802_11AuthModeWPAPSK,
+    os802_11AuthModeWPANone,
+    os802_11AuthModeWPA2,
+    os802_11AuthModeWPA2PSK,
+    os802_11AuthModeMax
+} OS_802_11_AUTHENTICATION_MODE;
+
+
+/*os802_11PrivFilterAcceptAll */
+/*  Specifies an open mode. In this mode, the NIC accepts any packet if the packet */
+/*  is not encrypted or if the NIC successfully decrypts it. */
+/*os802_11PrivFilter8021xWEP */
+/*  Specifies a filtering mode. In the 802.1X filtering mode, 802.1X packets are */
+/*  accepted even if they are not encrypted. However, the NIC accepts nothing else */
+/*  unless it is encrypted using WEP. */
+typedef enum _OS_802_11_PRIVACY_FILTER 
+{
+  os802_11PrivFilterAcceptAll, 
+  os802_11PrivFilter8021xWEP 
+} OS_802_11_PRIVACY_FILTER;
+
+typedef enum _OS_802_11_RELOAD_DEFAULTS
+{
+  os802_11ReloadWEPKeys
+} OS_802_11_RELOAD_DEFAULTS, *POS_802_11_RELOAD_DEFAULTS;
+
+typedef enum _OS_802_11_STATUS_TYPE
+{
+    os802_11StatusType_Authentication,
+    os802_11StatusType_PMKID_CandidateList = 2,
+    os802_11StatusTypeMax       /* not a real type, defined as an upper bound */
+} OS_802_11_STATUS_TYPE, *POS_802_11_STATUS_TYPE;
+
+typedef struct _OS_802_11_STATUS_INDICATION
+{
+    OS_802_11_STATUS_TYPE StatusType;
+} OS_802_11_STATUS_INDICATION, *POS_802_11_STATUS_INDICATION;
+
+
+typedef struct _OS_802_11_AUTHENTICATION_REQUEST
+{
+    TI_UINT32           	Length;             /* Length of this structure*/
+    TMacAddr 	            BSSID;
+	TI_UINT32				Flags;
+}  OS_802_11_AUTHENTICATION_REQUEST, *POS_802_11_AUTHENTICATION_REQUEST;
+
+typedef enum
+{
+	OS_DISASSOC_STATUS_UNSPECIFIED      		=   0,  
+	OS_DISASSOC_STATUS_AUTH_REJECT				=   1,
+	OS_DISASSOC_STATUS_ASSOC_REJECT				=   2,
+	OS_DISASSOC_STATUS_SECURITY_FAILURE 		=   3,
+	OS_DISASSOC_STATUS_AP_DEAUTHENTICATE		=   4,
+	OS_DISASSOC_STATUS_AP_DISASSOCIATE			=   5,
+	OS_DISASSOC_STATUS_ROAMING_TRIGGER			=   6
+
+}	OS_802_11_DISASSOCIATE_REASON_E;
+
+typedef struct
+{
+	OS_802_11_DISASSOCIATE_REASON_E  eDisAssocType;
+	TI_UINT32						 uStatusCode;
+} OS_802_11_DISASSOCIATE_REASON_T;
+
+
+
+#define OS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLE   0x01
+
+typedef struct _OS_802_11_PMKID_CANDIDATE 
+{
+    TMacAddr               BSSID;
+    TI_UINT32              Flags;
+}  OS_802_11_PMKID_CANDIDATE, *POS_802_11_PMKID_CANDIDATE;
+
+typedef struct _OS_802_11_PMKID_CANDIDATELIST
+{
+    TI_UINT32                   Version;       /* Version of the structure*/
+    TI_UINT32                   NumCandidates; /* No. of pmkid candidates*/
+    OS_802_11_PMKID_CANDIDATE  CandidateList[1];
+}  OS_802_11_PMKID_CANDIDATELIST, *POS_802_11_PMKID_CANDIDATELIST;
+
+
+typedef TI_UINT8 OS_802_11_MAC_PMKID_VALUE[16];
+
+typedef struct _OS_802_11_BSSIDInfo
+{
+    TMacAddr 	               BSSID;
+    OS_802_11_MAC_PMKID_VALUE  PMKID;
+}  OS_802_11_BSSIDInfo, *POS_802_11_BSSIDInfo;
+
+
+typedef struct _OS_802_11_AUTH_ENCRYPTION
+{
+    OS_802_11_AUTHENTICATION_MODE AuthModeSupported;
+    OS_802_11_ENCRYPTION_STATUS   EncryptionStatusSupported;
+} OS_802_11_AUTH_ENCRYPTION, *POS_802_11_AUTH_ENCRYPTION;
+
+
+typedef struct _OS_802_11_CAPABILITY
+{
+    TI_UINT32 Length;
+    TI_UINT32 Version;
+    TI_UINT32 NoOfPmKIDs;
+    TI_UINT32 NoOfAuthEncryptPairsSupported;
+    OS_802_11_AUTH_ENCRYPTION AuthEncryptionSupported[1];
+
+} OS_802_11_CAPABILITY, *POS_802_11_CAPABILITY;
+
+#define OID_CAPABILITY_VERSION 2
+
+
+
+typedef enum _OS_802_11_REG_DOMAIN
+{
+  os802_11_Domain_FCC = 0x10,
+  os802_11_Domain_IC = 0x20,
+  os802_11_Domain_ETSI = 0x30,
+  os802_11_Domain_Spain = 0x31,
+  os802_11_Domain_France = 0x32,
+  os802_11_Domain_MKK = 0x40,
+  os802_11_Domain_MKK1 = 0x41,
+  os802_11_Domain_US	= 0x50,		
+  os802_11_Domain_WB	= 0x51,
+  os802_11_Domain_EXWB	= 0x52
+} OS_802_11_REG_DOMAIN;
+
+
+
+#define OID_TI_VERSION							0xFF080001
+
+
+/* propritary OIDs used by FUNK supplicant for WPA Mixed mode support*/
+/* WPA2 MIxed mode OIDs */
+#define CGUID_FSW_802_11_AVAILABLE_OPTIONS      {0x1a905534, 0xe71f, 0x46d1, {0xa2, 0xcb, 0xa5, 0x57, 0x01, 0x76, 0x38, 0xfd}}
+#define CGUID_FSW_802_11_OPTIONS 				{0xdc7a51b7, 0x2236, 0x467d, {0xb1, 0x55, 0x03, 0x50, 0x42, 0x04, 0xcf, 0x30}}
+
+#define OID_FSW_802_11_AVAILABLE_OPTIONS        0xFF010237
+#define OID_FSW_802_11_OPTIONS                  0xFF010238
+
+
+
+/**/
+/* IEEE 802.11 OIDs*/
+/**/
+#define OID_802_11_BSSID                        0x0D010101
+#define OID_802_11_SSID                         0x0D010102
+#define OID_802_11_INFRASTRUCTURE_MODE          0x0D010108
+#define OID_802_11_ADD_WEP                      0x0D010113
+#define OID_802_11_REMOVE_WEP                   0x0D010114
+#define OID_802_11_DISASSOCIATE                 0x0D010115
+#define OID_802_11_AUTHENTICATION_MODE          0x0D010118
+#define OID_802_11_PRIVACY_FILTER               0x0D010119
+#define OID_802_11_BSSID_LIST_SCAN              0x0D01011A
+#define OID_802_11_WEP_STATUS                   0x0D01011B
+#define OID_802_11_RELOAD_DEFAULTS              0x0D01011C
+#define OID_802_11_ADD_KEY                      0x0D01011D
+#define OID_802_11_REMOVE_KEY                   0x0D01011E
+#define OID_802_11_ASSOCIATION_INFORMATION      0x0D01011F
+#define OID_802_11_NETWORK_TYPES_SUPPORTED      0x0D010203
+#define OID_802_11_NETWORK_TYPE_IN_USE          0x0D010204
+#define OID_802_11_TX_POWER_LEVEL               0x0D010205
+#define OID_802_11_RSSI                         0x0D010206
+#define OID_802_11_RSSI_TRIGGER                 0x0D010207
+#define OID_802_11_FRAGMENTATION_THRESHOLD      0x0D010209
+#define OID_802_11_RTS_THRESHOLD                0x0D01020A
+#define OID_802_11_NUMBER_OF_ANTENNAS           0x0D01020B
+#define OID_802_11_RX_ANTENNA_SELECTED          0x0D01020C
+#define OID_802_11_TX_ANTENNA_SELECTED          0x0D01020D
+#define OID_802_11_SUPPORTED_RATES              0x0D01020E
+#define OID_802_11_DESIRED_RATES                0x0D010210
+#define OID_802_11_CONFIGURATION                0x0D010211
+#define OID_802_11_STATISTICS                   0x0D020212
+#define OID_802_11_POWER_MODE                   0x0D010216
+#define OID_802_11_BSSID_LIST                   0x0D010217
+
+
+#ifndef _USER_MODE
+	#include "osdot11nousermode.h"
+#endif
+
+
+
+
+/* AnyWPA mode flags used in propritary FUNK suplicant OIDs*/
+
+#define     OS_802_11_OPTION_ENABLE_PROMOTE_MODE        0x00000001 /*bit 0*/
+#define     OS_802_11_OPTION_ENABLE_PROMOTE_CIPHER      0x00000002 /*bit 1*/
+#define		OS_802_11_OPTION_DISABLE_PROMOTE_MODE		0
+#define     OS_802_11_OPTION_ENABLE_ALL                 0x00000003 
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/queue.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,421 @@
+/*
+ * queue.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   queue.c 
+ *  \brief  This module provides generic queueing services, including enqueue, dequeue
+ *            and requeue of any object that contains TQueNodeHdr in its structure.                                  
+ *
+ *  \see    queue.h
+ */
+
+
+
+#define __FILE_ID__  FILE_ID_130
+#include "report.h"
+#include "queue.h"
+
+
+/* Queue structure */
+typedef struct 
+{
+    TQueNodeHdr tHead;          /* The queue first node */
+    TI_UINT32   uCount;         /* Current number of nodes in queue */
+    TI_UINT32   uLimit;         /* Upper limit of nodes in queue */
+    TI_UINT32   uMaxCount;      /* Maximum uCount value (for debug) */
+    TI_UINT32   uOverflow;      /* Number of overflow occurences - couldn't insert node (for debug) */
+    TI_UINT32   uNodeHeaderOffset; /* Offset of NodeHeader field from the entry of the queued item */
+	TI_HANDLE   hOs;
+	TI_HANDLE   hReport; 
+} TQueue;	
+
+
+
+/*
+ *              INTERNAL  FUNCTIONS 
+ *        =============================== 
+ */
+
+
+/*
+ *  InsertNode():  Insert new node between pPrev and pNext 
+ */
+static INLINE void InsertNode( TQueNodeHdr *pNode, TQueNodeHdr *pPrev, TQueNodeHdr *pNext)
+{
+	pNext->pPrev = pNode;
+	pNode->pNext = pNext;
+	pNode->pPrev = pPrev;
+	pPrev->pNext = pNode;
+}
+
+/*
+ *  RemoveNode():  Remove node from between pPrev and pNext 
+ */
+static INLINE void RemoveNode( TQueNodeHdr *pPrev, TQueNodeHdr *pNext)
+{
+	pNext->pPrev = pPrev;
+	pPrev->pNext = pNext;
+}
+
+/*
+ *  AddToHead():  Add node to queue head (last in queue) 
+ */
+static INLINE void AddToHead( TQueNodeHdr *pNode, TQueNodeHdr *pListHead)
+{
+	InsertNode (pNode, pListHead, pListHead->pNext);
+}
+
+/*
+ *  AddToTail():  Add node to queue tail (first in queue)
+ */
+static INLINE void AddToTail( TQueNodeHdr *pNode, TQueNodeHdr *pListHead)
+{
+	InsertNode( pNode, pListHead->pPrev, pListHead );
+}
+
+/*
+ *  DelFromTail():  Delete node from queue tail (first in queue)
+ */
+static INLINE void DelFromTail (TQueNodeHdr *pNode)
+{
+	RemoveNode (pNode->pPrev, pNode->pNext);
+}
+
+
+
+/*
+ *              EXTERNAL  FUNCTIONS 
+ *        =============================== 
+ */
+
+
+/** 
+ * \fn     que_Create 
+ * \brief  Create a queue. 
+ * 
+ * Allocate and init a queue object.
+ * 
+ * \note    
+ * \param  hOs               - Handle to Os Abstraction Layer
+ * \param  hReport           - Handle to report module
+ * \param  uLimit            - Maximum items to store in queue
+ * \param  uNodeHeaderOffset - Offset of NodeHeader field from the entry of the queued item.
+ * \return Handle to the allocated queue 
+ * \sa     que_Destroy
+ */ 
+TI_HANDLE que_Create (TI_HANDLE hOs, TI_HANDLE hReport, TI_UINT32 uLimit, TI_UINT32 uNodeHeaderOffset)
+{
+	TQueue *pQue;
+
+	/* allocate queue module */
+	pQue = os_memoryAlloc (hOs, sizeof(TQueue),MemoryNormal);
+	
+	if (!pQue)
+	{
+		WLAN_OS_REPORT (("Error allocating the Queue Module\n"));
+		return NULL;
+	}
+	
+    os_memoryZero (hOs, pQue, sizeof(TQueue));
+
+	/* Intialize the queue header */
+    pQue->tHead.pNext = pQue->tHead.pPrev = &pQue->tHead;
+
+	/* Set the Queue parameters */
+    pQue->hOs               = hOs;
+    pQue->hReport           = hReport;
+	pQue->uLimit            = uLimit;
+	pQue->uNodeHeaderOffset = uNodeHeaderOffset;
+
+	return (TI_HANDLE)pQue;
+}
+
+
+/** 
+ * \fn     que_Destroy
+ * \brief  Destroy the queue. 
+ * 
+ * Free the queue memory.
+ * 
+ * \note   The queue's owner should first free the queued items!
+ * \param  hQue - The queue object
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     que_Create
+ */ 
+TI_STATUS que_Destroy (TI_HANDLE hQue)
+{
+    TQueue *pQue = (TQueue *)hQue;
+
+    /* Alert if the queue is unloaded before it was cleared from items */
+    if (pQue->uCount)
+    {
+        TRACE0(pQue->hReport, REPORT_SEVERITY_ERROR, "que_Destroy() Queue Not Empty!!");
+    }
+    /* free Queue object */
+	os_memoryFree (pQue->hOs, pQue, sizeof(TQueue));
+	
+    return TI_OK;
+}
+
+
+/** 
+ * \fn     que_Init 
+ * \brief  Init required handles 
+ * 
+ * Init required handles.
+ * 
+ * \note    
+ * \param  hQue      - The queue object
+ * \param  hOs       - Handle to Os Abstraction Layer
+ * \param  hReport   - Handle to report module
+ * \return TI_OK on success or TI_NOK on failure  
+ * \sa     
+ */ 
+TI_STATUS que_Init (TI_HANDLE hQue, TI_HANDLE hOs, TI_HANDLE hReport)
+{
+	TQueue *pQue = (TQueue *)hQue;
+
+    pQue->hOs = hOs;
+    pQue->hReport = hReport;
+	
+	return TI_OK;
+}
+
+
+/** 
+ * \fn     que_Enqueue
+ * \brief  Enqueue an item 
+ * 
+ * Enqueue an item at the queue's head (last in queue).
+ * 
+ * \note   
+ * \param  hQue   - The queue object
+ * \param  hItem  - Handle to queued item
+ * \return TI_OK if item was queued, or TI_NOK if not queued due to overflow
+ * \sa     que_Dequeue, que_Requeue
+ */ 
+TI_STATUS que_Enqueue (TI_HANDLE hQue, TI_HANDLE hItem)
+{
+	TQueue      *pQue = (TQueue *)hQue;
+    TQueNodeHdr *pQueNodeHdr;  /* the Node-Header in the given item */
+
+    
+    /* Check queue limit */
+	if(pQue->uCount < pQue->uLimit)
+	{
+        /* Find NodeHeader in the given item */
+        pQueNodeHdr = (TQueNodeHdr *)((TI_UINT8*)hItem + pQue->uNodeHeaderOffset);
+
+        
+
+      
+            /* Check that (pNext == NULL) --> Sanity check that this item was dequeued before */
+            if (pQueNodeHdr->pNext)
+            {
+                TRACE0(pQue->hReport, REPORT_SEVERITY_ERROR, "que_Enqueue(): Trying to enqueue an item that wasn't dequeued!");
+                return TI_NOK;
+            }
+            
+        /* Enqueue item and increment items counter */
+		AddToHead (pQueNodeHdr, &pQue->tHead);
+		pQue->uCount++;
+
+        #ifdef TI_DBG
+		    if (pQue->uCount > pQue->uMaxCount)
+            {
+                pQue->uMaxCount = pQue->uCount;
+            }
+            TRACE0(pQue->hReport, REPORT_SEVERITY_INFORMATION , "que_Enqueue(): Enqueued Successfully\n");
+        #endif
+
+        return TI_OK;
+	}
+	
+	/* 
+	 *  Queue is overflowed, return TI_NOK.
+	 */
+#ifdef TI_DBG
+	pQue->uOverflow++;
+TRACE0(pQue->hReport, REPORT_SEVERITY_WARNING , "que_Enqueue(): Queue Overflow\n");
+#endif
+	
+	return TI_NOK;
+}
+
+
+/** 
+ * \fn     que_Dequeue
+ * \brief  Dequeue an item 
+ * 
+ * Dequeue an item from the queue's tail (first in queue).
+ * 
+ * \note   
+ * \param  hQue - The queue object
+ * \return pointer to dequeued item or NULL if queue is empty
+ * \sa     que_Enqueue, que_Requeue
+ */ 
+TI_HANDLE que_Dequeue (TI_HANDLE hQue)
+{
+    TQueue   *pQue = (TQueue *)hQue;
+	TI_HANDLE hItem;
+ 
+    if (pQue->uCount)
+    {
+        /* Queue is not empty, take packet from the queue tail */
+
+        /* find pointer to the node entry */
+         hItem = (TI_HANDLE)((TI_UINT8*)pQue->tHead.pPrev - pQue->uNodeHeaderOffset); 
+        
+         DelFromTail (pQue->tHead.pPrev);    /* remove node from the queue */
+         pQue->uCount--;
+
+         #ifdef TI_DBG
+            /* Clear the pNext so we can do a sanity check when enqueuing this structre in the future */
+            ((TQueNodeHdr *)((TI_UINT8*)hItem + pQue->uNodeHeaderOffset))->pNext = NULL;
+         #endif
+
+         return (hItem);
+    }
+    
+	/* Queue is empty */    
+    TRACE0(pQue->hReport, REPORT_SEVERITY_INFORMATION , "que_Dequeue(): Queue is empty\n");
+    
+    return NULL;
+}
+
+
+/** 
+ * \fn     que_Requeue
+ * \brief  Requeue an item 
+ * 
+ * Requeue an item at the queue's tail (first in queue).
+ * 
+ * \note   
+ * \param  hQue   - The queue object
+ * \param  hItem  - Handle to queued item
+ * \return TI_OK if item was queued, or TI_NOK if not queued due to overflow
+ * \sa     que_Enqueue, que_Dequeue
+ */ 
+TI_STATUS que_Requeue (TI_HANDLE hQue, TI_HANDLE hItem)
+{
+    TQueue      *pQue = (TQueue *)hQue;
+    TQueNodeHdr *pQueNodeHdr;  /* the NodeHeader in the given item */
+
+    /* 
+	 *  If queue's limits not exceeded add the packet to queue's tail and return TI_OK 
+	 */
+    if (pQue->uCount < pQue->uLimit)
+	{
+        /* Find NodeHeader in the given item */
+        pQueNodeHdr = (TQueNodeHdr *)((TI_UINT8*)hItem + pQue->uNodeHeaderOffset);
+
+        /* Enqueue item and increment items counter */
+		AddToTail (pQueNodeHdr, &pQue->tHead);
+		pQue->uCount++;
+
+#ifdef TI_DBG
+		if (pQue->uCount > pQue->uMaxCount)
+			pQue->uMaxCount = pQue->uCount;
+TRACE0(pQue->hReport, REPORT_SEVERITY_INFORMATION , "que_Requeue(): Requeued successfully\n");
+#endif
+
+		return TI_OK;
+    }
+    
+
+	/* 
+	 *  Queue is overflowed, return TI_NOK.
+	 *  Note: This is not expected in the current design, since Tx packet may be requeued
+	 *          only right after it was dequeued in the same context so the queue can't be full.
+	 */
+#ifdef TI_DBG
+    pQue->uOverflow++;
+TRACE0(pQue->hReport, REPORT_SEVERITY_ERROR , "que_Requeue(): Queue Overflow\n");
+#endif
+    
+    return TI_NOK;
+}
+
+
+/** 
+ * \fn     que_Size
+ * \brief  Return queue size 
+ * 
+ * Return number of items in queue.
+ * 
+ * \note   
+ * \param  hQue - The queue object
+ * \return TI_UINT32 - the items count
+ * \sa     
+ */ 
+TI_UINT32 que_Size (TI_HANDLE hQue)
+{
+    TQueue *pQue = (TQueue *)hQue;
+ 
+    return (pQue->uCount);
+}
+
+	
+/** 
+ * \fn     que_Print
+ * \brief  Print queue status
+ * 
+ * Print the queue's parameters (not the content).
+ * 
+ * \note   
+ * \param  hQue - The queue object
+ * \return void
+ * \sa     
+ */ 
+
+#ifdef TI_DBG
+
+void que_Print(TI_HANDLE hQue)
+{
+	TQueue *pQue = (TQueue *)hQue;
+
+    WLAN_OS_REPORT(("que_Print: Count=%u MaxCount=%u Limit=%u Overflow=%u NodeHeaderOffset=%u Next=0x%x Prev=0x%x\n",
+                    pQue->uCount, pQue->uMaxCount, pQue->uLimit, pQue->uOverflow, 
+                    pQue->uNodeHeaderOffset, pQue->tHead.pNext, pQue->tHead.pPrev));
+}
+
+#endif /* TI_DBG */
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/queue.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,77 @@
+/*
+ * queue.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   queue.h 
+ *  \brief  queue module header file.                                  
+ *
+ *  \see    queue.c
+ */
+
+
+#ifndef _QUEUE_H_
+#define _QUEUE_H_
+
+#define QUE_UNLIMITED_SIZE      0xFFFFFFFF
+
+/* A queue node header structure */                        
+typedef struct _TQueNodeHdr 
+{
+    struct _TQueNodeHdr *pNext;
+    struct _TQueNodeHdr *pPrev;
+} TQueNodeHdr;
+
+
+
+/* External Functions Prototypes */
+/* ============================= */
+TI_HANDLE que_Create  (TI_HANDLE hOs, TI_HANDLE hReport, TI_UINT32 uLimit, TI_UINT32 uNodeHeaderOffset);
+TI_STATUS que_Destroy (TI_HANDLE hQue);
+TI_STATUS que_Enqueue (TI_HANDLE hQue, TI_HANDLE hItem);
+TI_HANDLE que_Dequeue (TI_HANDLE hQue);
+TI_STATUS que_Requeue (TI_HANDLE hQue, TI_HANDLE hItem);
+TI_UINT32 que_Size    (TI_HANDLE hQue);
+
+#ifdef TI_DBG
+void      que_Print   (TI_HANDLE hQue);
+#endif /* TI_DBG */
+
+
+
+#endif  /* _QUEUE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/rate.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,1794 @@
+/*
+ * rate.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  rate.c
+ *  \brief Rate conversion
+ *
+ *  \see   rate.h
+ */
+#define __FILE_ID__  FILE_ID_131
+#include "tidef.h"
+#include "rate.h"
+
+
+
+ERate rate_NetToDrv (TI_UINT32 rate)
+{
+    switch (rate)
+    {
+        case NET_RATE_1M:
+        case NET_RATE_1M_BASIC:
+            return DRV_RATE_1M;
+
+        case NET_RATE_2M:
+        case NET_RATE_2M_BASIC:
+            return DRV_RATE_2M;
+
+        case NET_RATE_5_5M:
+        case NET_RATE_5_5M_BASIC:
+            return DRV_RATE_5_5M;
+
+        case NET_RATE_11M:
+        case NET_RATE_11M_BASIC:
+            return DRV_RATE_11M;
+
+        case NET_RATE_22M:
+        case NET_RATE_22M_BASIC:
+            return DRV_RATE_22M;
+
+        case NET_RATE_6M:
+        case NET_RATE_6M_BASIC:
+            return DRV_RATE_6M;
+
+        case NET_RATE_9M:
+        case NET_RATE_9M_BASIC:
+            return DRV_RATE_9M;
+
+        case NET_RATE_12M:
+        case NET_RATE_12M_BASIC:
+            return DRV_RATE_12M;
+
+        case NET_RATE_18M:
+        case NET_RATE_18M_BASIC:
+            return DRV_RATE_18M;
+
+        case NET_RATE_24M:
+        case NET_RATE_24M_BASIC:
+            return DRV_RATE_24M;
+
+        case NET_RATE_36M:
+        case NET_RATE_36M_BASIC:
+            return DRV_RATE_36M;
+
+        case NET_RATE_48M:
+        case NET_RATE_48M_BASIC:
+            return DRV_RATE_48M;
+
+        case NET_RATE_54M:
+        case NET_RATE_54M_BASIC:
+            return DRV_RATE_54M;
+
+        case NET_RATE_MCS0:
+        case NET_RATE_MCS0_BASIC:
+            return DRV_RATE_MCS_0;
+
+        case NET_RATE_MCS1:
+        case NET_RATE_MCS1_BASIC:
+            return DRV_RATE_MCS_1;
+
+        case NET_RATE_MCS2:
+        case NET_RATE_MCS2_BASIC:
+            return DRV_RATE_MCS_2;
+
+        case NET_RATE_MCS3:
+        case NET_RATE_MCS3_BASIC:
+            return DRV_RATE_MCS_3;
+
+        case NET_RATE_MCS4:
+        case NET_RATE_MCS4_BASIC:
+            return DRV_RATE_MCS_4;
+
+        case NET_RATE_MCS5:
+        case NET_RATE_MCS5_BASIC:
+            return DRV_RATE_MCS_5;
+
+        case NET_RATE_MCS6:
+        case NET_RATE_MCS6_BASIC:
+            return DRV_RATE_MCS_6;
+
+        case NET_RATE_MCS7:
+        case NET_RATE_MCS7_BASIC:
+            return DRV_RATE_MCS_7;
+
+        default:
+            return DRV_RATE_INVALID;
+    }
+}
+
+/************************************************************************
+ *                        hostToNetworkRate                         *
+ ************************************************************************
+DESCRIPTION: Translates a host rate (1, 2, 3, ....) to network rate (0x02, 0x82, 0x84, etc...) 
+                                                                                                   
+INPUT:      rate        -   Host rate
+
+OUTPUT:     
+
+
+RETURN:     Network rate if the input rate is valid, otherwise returns 0.
+
+************************************************************************/
+ENetRate rate_DrvToNet (ERate rate)
+{
+    switch (rate)
+    {
+        case DRV_RATE_AUTO:
+            return NET_BASIC_MASK;
+
+        case DRV_RATE_1M:
+            return NET_RATE_1M;
+
+        case DRV_RATE_2M:
+            return NET_RATE_2M;
+
+        case DRV_RATE_5_5M:
+            return NET_RATE_5_5M;
+
+        case DRV_RATE_11M:
+            return NET_RATE_11M;
+
+        case DRV_RATE_22M:
+            return NET_RATE_22M;
+
+        case DRV_RATE_6M:
+            return NET_RATE_6M;
+
+        case DRV_RATE_9M:
+            return NET_RATE_9M;
+
+        case DRV_RATE_12M:
+            return NET_RATE_12M;
+
+        case DRV_RATE_18M:
+            return NET_RATE_18M;
+
+        case DRV_RATE_24M:
+            return NET_RATE_24M;
+
+        case DRV_RATE_36M:
+            return NET_RATE_36M;
+
+        case DRV_RATE_48M:
+            return NET_RATE_48M;
+
+        case DRV_RATE_54M:
+            return NET_RATE_54M;
+
+        case DRV_RATE_MCS_0:
+            return NET_RATE_MCS0;
+
+        case DRV_RATE_MCS_1:
+            return NET_RATE_MCS1;
+    
+        case DRV_RATE_MCS_2:
+            return NET_RATE_MCS2;
+    
+        case DRV_RATE_MCS_3:
+            return NET_RATE_MCS3;
+    
+        case DRV_RATE_MCS_4:
+            return NET_RATE_MCS4;
+    
+        case DRV_RATE_MCS_5:
+            return NET_RATE_MCS5;
+    
+        case DRV_RATE_MCS_6:
+            return NET_RATE_MCS6;
+    
+        case DRV_RATE_MCS_7:
+            return NET_RATE_MCS7;
+
+        default:
+            return NET_BASIC_MASK;
+    }
+}
+
+/***************************************************************************
+*                   getMaxActiveRatefromBitmap                             *
+****************************************************************************
+* DESCRIPTION:  
+*
+* INPUTS:       hCtrlData - the object
+*               
+* OUTPUT:       
+*
+* RETURNS:      
+***************************************************************************/
+ERate rate_GetMaxFromDrvBitmap (TI_UINT32 uRateBitMap)
+{
+    if (uRateBitMap & DRV_RATE_MASK_MCS_7_OFDM)
+    {
+        return DRV_RATE_MCS_7;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_MCS_6_OFDM)
+    {
+        return DRV_RATE_MCS_6;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_MCS_5_OFDM)
+    {
+        return DRV_RATE_MCS_5;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_MCS_4_OFDM)
+    {
+        return DRV_RATE_MCS_4;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_MCS_3_OFDM)
+    {
+        return DRV_RATE_MCS_3;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_MCS_2_OFDM)
+    {
+        return DRV_RATE_MCS_2;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_MCS_1_OFDM)
+    {
+        return DRV_RATE_MCS_1;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_MCS_0_OFDM)
+    {
+        return DRV_RATE_MCS_0;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_54_OFDM)
+    {
+        return DRV_RATE_54M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_48_OFDM)
+    {
+        return DRV_RATE_48M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_36_OFDM)
+    {
+        return DRV_RATE_36M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_24_OFDM)
+    {
+        return DRV_RATE_24M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_22_PBCC)
+    {
+        return DRV_RATE_22M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_18_OFDM)
+    {
+        return DRV_RATE_18M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_12_OFDM)
+    {
+        return DRV_RATE_12M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_11_CCK)
+    {
+        return DRV_RATE_11M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_9_OFDM)
+    {
+        return DRV_RATE_9M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_6_OFDM)
+    {
+        return DRV_RATE_6M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_5_5_CCK)
+    {
+        return DRV_RATE_5_5M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_2_BARKER)
+    {
+        return DRV_RATE_2M;
+    }
+
+    if (uRateBitMap & DRV_RATE_MASK_1_BARKER)
+    {
+        return DRV_RATE_1M;
+    }
+
+    return DRV_RATE_INVALID;
+}
+
+/************************************************************************
+ *                        validateNetworkRate                           *
+ ************************************************************************
+DESCRIPTION: Verify that the input nitwork rate is valid
+                                                                                                   
+INPUT:      rate    -   input network rate
+
+OUTPUT:     
+
+
+RETURN:     TI_OK if valid, otherwise TI_NOK
+
+************************************************************************/
+static TI_STATUS rate_ValidateNet (ENetRate eRate)
+{
+    switch (eRate)
+    {
+        case NET_RATE_1M:
+        case NET_RATE_1M_BASIC:
+        case NET_RATE_2M:
+        case NET_RATE_2M_BASIC:
+        case NET_RATE_5_5M:
+        case NET_RATE_5_5M_BASIC:
+        case NET_RATE_11M:
+        case NET_RATE_11M_BASIC:
+        case NET_RATE_22M:
+        case NET_RATE_22M_BASIC:
+        case NET_RATE_6M:
+        case NET_RATE_6M_BASIC:
+        case NET_RATE_9M:
+        case NET_RATE_9M_BASIC:
+        case NET_RATE_12M:
+        case NET_RATE_12M_BASIC:
+        case NET_RATE_18M:
+        case NET_RATE_18M_BASIC:
+        case NET_RATE_24M:
+        case NET_RATE_24M_BASIC:
+        case NET_RATE_36M:
+        case NET_RATE_36M_BASIC:
+        case NET_RATE_48M:
+        case NET_RATE_48M_BASIC:
+        case NET_RATE_54M:
+        case NET_RATE_54M_BASIC:
+            return TI_OK;
+
+        default:
+            return TI_NOK;
+    }
+}
+
+/************************************************************************
+ *                        getMaxBasicRate                           *
+ ************************************************************************
+DESCRIPTION: Goes over an array of network rates and returns the max basic rate
+                                                                                                   
+INPUT:      pRates      -   Rate array
+
+OUTPUT:     
+
+
+RETURN:     Max basic rate (in network units)
+
+************************************************************************/
+ENetRate rate_GetMaxBasicFromStr (TI_UINT8 *pRatesString, TI_UINT32 len, ENetRate eMaxRate)
+{
+    TI_UINT32   i;
+    
+    for (i = 0; i < len; i++)
+    {
+        if (NET_BASIC_RATE (pRatesString[i]) && rate_ValidateNet ((ENetRate)pRatesString[i]) == TI_OK)
+        {
+            eMaxRate = (ENetRate)(TI_MAX (pRatesString[i], eMaxRate));
+        }
+    }
+
+    return eMaxRate;
+}
+
+/************************************************************************
+ *                        getMaxActiveRate                          *
+ ************************************************************************
+DESCRIPTION: Goes over an array of network rates and returns the max active rate
+                                                                                                   
+INPUT:      pRates      -   Rate array
+
+OUTPUT:     
+
+
+RETURN:     Max active rate (in network units)
+
+************************************************************************/
+ENetRate rate_GetMaxActiveFromStr (TI_UINT8 *pRatesString, TI_UINT32 len, ENetRate eMaxRate)
+{
+    TI_UINT32   i;
+    
+    for (i = 0; i < len; i++)
+    {
+        if (NET_ACTIVE_RATE (pRatesString[i]) && rate_ValidateNet ((ENetRate)pRatesString[i]) == TI_OK)
+        {
+            eMaxRate = (ENetRate)(TI_MAX (pRatesString[i], eMaxRate));
+        }
+    }
+
+    return eMaxRate;
+}
+
+TI_UINT32 rate_DrvToNumber (ERate eRate)
+{
+    switch (eRate)
+    {
+        case DRV_RATE_1M:
+            return 1;
+
+        case DRV_RATE_2M:
+            return 2;
+
+        case DRV_RATE_5_5M:
+            return 5;
+
+        case DRV_RATE_11M:
+            return 11;
+
+        case DRV_RATE_22M:
+            return 22;
+
+        case DRV_RATE_6M:
+            return 6;
+
+        case DRV_RATE_9M:
+            return 9;
+
+        case DRV_RATE_12M:
+            return 12;
+
+        case DRV_RATE_18M:
+            return 18;
+
+        case DRV_RATE_24M:
+            return 24;
+
+        case DRV_RATE_36M:
+            return 36;
+
+        case DRV_RATE_48M:
+            return 48;
+
+        case DRV_RATE_54M:
+            return 54;
+
+        case DRV_RATE_MCS_0:
+            return 6;
+    
+        case DRV_RATE_MCS_1:
+            return 13;
+    
+        case DRV_RATE_MCS_2:
+            return 19;
+    
+        case DRV_RATE_MCS_3:
+            return 26;
+    
+        case DRV_RATE_MCS_4:
+            return 39;
+    
+        case DRV_RATE_MCS_5:
+            return 52;
+    
+        case DRV_RATE_MCS_6:
+            return 58;
+    
+        case DRV_RATE_MCS_7:
+            return 65;
+
+        default:
+            return 0;
+    }
+}
+
+/************************************************************************
+ *                        bitMapToNetworkStringRates                    *
+ ************************************************************************
+DESCRIPTION: Converts bit map to the rates string
+                                                                                                   
+INPUT:      suppRatesBitMap     -   bit map of supported rates
+            basicRatesBitMap    -   bit map of basic rates
+
+OUTPUT:     string - network format rates array,
+            len - rates array length
+            firstOFDMrateLoc - the index of first OFDM rate in the rates array.
+
+
+RETURN:     None
+
+************************************************************************/
+TI_STATUS rate_DrvBitmapToNetStr (TI_UINT32   uSuppRatesBitMap,
+                                  TI_UINT32   uBasicRatesBitMap,
+                                  TI_UINT8    *string,
+                                  TI_UINT32   *len,
+                                  TI_UINT32   *pFirstOfdmRate)
+{
+    TI_UINT32   i = 0;
+    
+    if (uSuppRatesBitMap & DRV_RATE_MASK_1_BARKER)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_1_BARKER)
+        {
+            string[i++] = NET_RATE_1M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_1M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_2_BARKER)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_2_BARKER)
+        {
+            string[i++] = NET_RATE_2M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_2M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_5_5_CCK)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_5_5_CCK)
+        {
+            string[i++] = NET_RATE_5_5M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_5_5M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_11_CCK)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_11_CCK)
+        {
+            string[i++] = NET_RATE_11M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_11M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_22_PBCC)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_22_PBCC)
+        {
+            string[i++] = NET_RATE_22M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_22M;
+        }
+    }
+
+    *pFirstOfdmRate = i;
+    
+    if (uSuppRatesBitMap & DRV_RATE_MASK_6_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_6_OFDM)
+        {
+            string[i++] = NET_RATE_6M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_6M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_9_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_9_OFDM)
+        {
+            string[i++] = NET_RATE_9M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_9M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_12_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_12_OFDM)
+        {
+            string[i++] = NET_RATE_12M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_12M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_18_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_18_OFDM)
+        {
+            string[i++] = NET_RATE_18M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_18M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_24_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_24_OFDM)
+        {
+            string[i++] = NET_RATE_24M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_24M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_36_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_36_OFDM)
+        {
+            string[i++] = NET_RATE_36M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_36M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_48_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_48_OFDM)
+        {
+            string[i++] = NET_RATE_48M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_48M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_54_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_54_OFDM)
+        {
+            string[i++] = NET_RATE_54M_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_54M;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_0_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_MCS_0_OFDM)
+        {
+            string[i++] = NET_RATE_MCS0_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_MCS0;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_1_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_MCS_1_OFDM)
+        {
+            string[i++] = NET_RATE_MCS1_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_MCS1;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_2_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_MCS_2_OFDM)
+        {
+            string[i++] = NET_RATE_MCS2_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_MCS2;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_3_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_MCS_3_OFDM)
+        {
+            string[i++] = NET_RATE_MCS3_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_MCS3;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_4_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_MCS_4_OFDM)
+        {
+            string[i++] = NET_RATE_MCS4_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_MCS4;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_5_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_MCS_5_OFDM)
+        {
+            string[i++] = NET_RATE_MCS5_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_MCS5;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_6_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_MCS_6_OFDM)
+        {
+            string[i++] = NET_RATE_MCS6_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_MCS6;
+        }
+    }
+
+    if (uSuppRatesBitMap & DRV_RATE_MASK_MCS_7_OFDM)
+    {
+        if (uBasicRatesBitMap & DRV_RATE_MASK_MCS_7_OFDM)
+        {
+            string[i++] = NET_RATE_MCS7_BASIC;
+        }
+        else
+        {
+            string[i++] = NET_RATE_MCS7;
+        }
+    }
+
+
+    *len = i;
+    
+    return TI_OK;
+}
+
+/************************************************************************
+ *                        networkStringToBitMapSuppRates                *
+ ************************************************************************
+DESCRIPTION: Converts supported rates string to the bit map
+                                                                                                   
+INPUT:      string      -   array of rates in the network format
+            len - array length
+
+OUTPUT:     bitMap - bit map of rates.
+
+RETURN:     None
+
+************************************************************************/
+TI_STATUS rate_NetStrToDrvBitmap (TI_UINT32 *pBitMap, TI_UINT8 *string, TI_UINT32 len)
+{
+    TI_UINT32   i;
+    
+    *pBitMap = 0;
+    
+    for (i = 0; i < len; i++)
+    {
+        switch (string[i])
+        {
+            case NET_RATE_1M:
+            case NET_RATE_1M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_1_BARKER;
+                break;
+
+            case NET_RATE_2M:
+            case NET_RATE_2M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_2_BARKER;
+                break;
+
+            case NET_RATE_5_5M:
+            case NET_RATE_5_5M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_5_5_CCK;
+                break;
+
+            case NET_RATE_11M:
+            case NET_RATE_11M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_11_CCK;
+                break;
+
+            case NET_RATE_22M:
+            case NET_RATE_22M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_22_PBCC;
+                break;
+
+            case NET_RATE_6M:
+            case NET_RATE_6M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_6_OFDM;
+                break;
+
+            case NET_RATE_9M:
+            case NET_RATE_9M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_9_OFDM;
+                break;
+
+            case NET_RATE_12M:
+            case NET_RATE_12M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_12_OFDM;
+                break;
+
+            case NET_RATE_18M:
+            case NET_RATE_18M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_18_OFDM;
+                break;
+
+            case NET_RATE_24M:
+            case NET_RATE_24M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_24_OFDM;
+                break;
+
+            case NET_RATE_36M:
+            case NET_RATE_36M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_36_OFDM;
+                break;
+
+            case NET_RATE_48M:
+            case NET_RATE_48M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_48_OFDM;
+                break;
+
+            case NET_RATE_54M:
+            case NET_RATE_54M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_54_OFDM;
+                break;
+
+            case NET_RATE_MCS0:
+            case NET_RATE_MCS0_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_0_OFDM;
+                break;
+    
+            case NET_RATE_MCS1:
+            case NET_RATE_MCS1_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_1_OFDM;
+                break;
+    
+            case NET_RATE_MCS2:
+            case NET_RATE_MCS2_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_2_OFDM;
+                break;
+    
+            case NET_RATE_MCS3:
+            case NET_RATE_MCS3_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_3_OFDM;
+                break;
+    
+            case NET_RATE_MCS4:
+            case NET_RATE_MCS4_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_4_OFDM;
+                break;
+    
+            case NET_RATE_MCS5:
+            case NET_RATE_MCS5_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_5_OFDM;
+                break;
+    
+            case NET_RATE_MCS6:
+            case NET_RATE_MCS6_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_6_OFDM;
+                break;
+    
+            case NET_RATE_MCS7:
+            case NET_RATE_MCS7_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_7_OFDM;
+                break;
+
+            default:
+                break;
+        }
+    }
+
+    return TI_OK;
+}
+
+/************************************************************************
+ *                        networkStringToBitMapBasicRates               *
+ ************************************************************************
+DESCRIPTION: Converts basic rates string to the bit map
+                                                                                                   
+INPUT:      string      -   array of rates in the network format
+            len - array length
+
+OUTPUT:     bitMap - bit map of rates.
+
+RETURN:     None
+
+************************************************************************/
+TI_STATUS rate_NetBasicStrToDrvBitmap (TI_UINT32 *pBitMap, TI_UINT8 *string, TI_UINT32 len)
+{
+    TI_UINT32   i;
+    
+    *pBitMap = 0;
+    
+    for (i = 0; i < len; i++)
+    {
+        switch (string[i])
+        {
+            case NET_RATE_1M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_1_BARKER;
+                break;
+
+            case NET_RATE_2M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_2_BARKER;
+                break;
+
+            case NET_RATE_5_5M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_5_5_CCK;
+                break;
+
+            case NET_RATE_11M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_11_CCK;
+                break;
+
+            case NET_RATE_22M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_22_PBCC;
+                break;
+
+            case NET_RATE_6M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_6_OFDM;
+                break;
+
+            case NET_RATE_9M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_9_OFDM;
+                break;
+
+            case NET_RATE_12M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_12_OFDM;
+                break;
+
+            case NET_RATE_18M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_18_OFDM;
+                break;
+
+            case NET_RATE_24M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_24_OFDM;
+                break;
+
+            case NET_RATE_36M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_36_OFDM;
+                break;
+
+            case NET_RATE_48M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_48_OFDM;
+                break;
+
+            case NET_RATE_54M_BASIC:
+                *pBitMap |= DRV_RATE_MASK_54_OFDM;
+                break;
+
+            case NET_RATE_MCS0_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_0_OFDM;
+                break;
+    
+            case NET_RATE_MCS1_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_1_OFDM;
+                break;
+    
+            case NET_RATE_MCS2_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_2_OFDM;
+                break;
+    
+            case NET_RATE_MCS3_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_3_OFDM;
+                break;
+    
+            case NET_RATE_MCS4_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_4_OFDM;
+                break;
+    
+            case NET_RATE_MCS5_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_5_OFDM;
+                break;
+    
+            case NET_RATE_MCS6_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_6_OFDM;
+                break;
+    
+            case NET_RATE_MCS7_BASIC:
+                *pBitMap |= DRV_RATE_MASK_MCS_7_OFDM;
+                break;
+    
+            default:
+                break;
+        }
+    }
+
+    return TI_OK;
+}
+
+
+/************************************************************************
+ *                        rate_McsNetStrToDrvBitmap                     *
+ ************************************************************************
+DESCRIPTION: Converts MCS IEs rates bit map to driver bit map. 
+             supported only MCS0 - MCS7 
+                                                                                                   
+INPUT:      string - HT capabilities IE in the network format
+            len - IE array length
+
+OUTPUT:     bitMap - bit map of rates.
+
+RETURN:     None
+
+************************************************************************/
+TI_STATUS rate_McsNetStrToDrvBitmap (TI_UINT32 *pBitMap, TI_UINT8 *string)
+{
+    *pBitMap = string[0];
+
+    *pBitMap = *pBitMap << (DRV_RATE_MCS_0 - 1);
+
+    return TI_OK;
+}
+
+
+TI_STATUS rate_DrvBitmapToHwBitmap (TI_UINT32 uDrvBitMap, TI_UINT32 *pHwBitmap)
+{
+    TI_UINT32   uHwBitMap = 0;
+    
+    if (uDrvBitMap & DRV_RATE_MASK_1_BARKER)
+    {
+        uHwBitMap |= HW_BIT_RATE_1MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_2_BARKER)
+    {
+        uHwBitMap |= HW_BIT_RATE_2MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_5_5_CCK)
+    {
+        uHwBitMap |= HW_BIT_RATE_5_5MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_11_CCK)
+    {
+        uHwBitMap |= HW_BIT_RATE_11MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_22_PBCC)
+    {
+        uHwBitMap |= HW_BIT_RATE_22MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_6_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_6MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_9_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_9MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_12_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_12MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_18_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_18MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_24_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_24MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_36_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_36MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_48_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_48MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_54_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_54MBPS;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_MCS_0_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_MCS_0;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_MCS_1_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_MCS_1;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_MCS_2_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_MCS_2;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_MCS_3_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_MCS_3;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_MCS_4_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_MCS_4;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_MCS_5_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_MCS_5;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_MCS_6_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_MCS_6;
+    }
+
+    if (uDrvBitMap & DRV_RATE_MASK_MCS_7_OFDM)
+    {
+        uHwBitMap |= HW_BIT_RATE_MCS_7;
+    }
+
+    *pHwBitmap = uHwBitMap;
+    
+    return TI_OK;
+}
+
+TI_STATUS rate_PolicyToDrv (ETxRateClassId ePolicyRate, ERate *eAppRate)
+{
+    TI_UINT8     Rate = 0;
+    TI_STATUS status = TI_OK;
+
+    switch (ePolicyRate)
+    {
+        case txPolicy1    :   Rate =  DRV_RATE_1M   ;    break;
+        case txPolicy2    :   Rate =  DRV_RATE_2M   ;    break;
+        case txPolicy5_5  :   Rate =  DRV_RATE_5_5M ;    break;
+        case txPolicy11   :   Rate =  DRV_RATE_11M  ;    break;
+        case txPolicy22   :   Rate =  DRV_RATE_22M  ;    break;
+        case txPolicy6    :   Rate =  DRV_RATE_6M   ;    break;
+        case txPolicy9    :   Rate =  DRV_RATE_9M   ;    break;
+        case txPolicy12   :   Rate =  DRV_RATE_12M  ;    break;
+        case txPolicy18   :   Rate =  DRV_RATE_18M  ;    break;
+        case txPolicy24   :   Rate =  DRV_RATE_24M  ;    break;
+        case txPolicy36   :   Rate =  DRV_RATE_36M  ;    break;
+        case txPolicy48   :   Rate =  DRV_RATE_48M  ;    break;
+        case txPolicy54   :   Rate =  DRV_RATE_54M  ;    break;
+        case txPolicyMcs0 :   Rate =  DRV_RATE_MCS_0;    break;
+        case txPolicyMcs1 :   Rate =  DRV_RATE_MCS_1;    break;
+        case txPolicyMcs2 :   Rate =  DRV_RATE_MCS_2;    break;
+        case txPolicyMcs3 :   Rate =  DRV_RATE_MCS_3;    break;
+        case txPolicyMcs4 :   Rate =  DRV_RATE_MCS_4;    break;
+        case txPolicyMcs5 :   Rate =  DRV_RATE_MCS_5;    break;
+        case txPolicyMcs6 :   Rate =  DRV_RATE_MCS_6;    break;
+        case txPolicyMcs7 :   Rate =  DRV_RATE_MCS_7;    break;
+
+        default:
+            status = TI_NOK;
+            break;
+    }
+
+    if (status == TI_OK)
+        *eAppRate = (ERate)Rate;
+    else
+        *eAppRate = DRV_RATE_INVALID; 
+
+    return status;
+}
+
+
+TI_UINT32 rate_BasicToDrvBitmap (EBasicRateSet eBasicRateSet, TI_BOOL bDot11a)
+{
+    if (!bDot11a)
+    {
+        switch (eBasicRateSet)
+        {
+            case BASIC_RATE_SET_1_2:
+                return DRV_RATE_MASK_1_BARKER | 
+                       DRV_RATE_MASK_2_BARKER;
+
+            case BASIC_RATE_SET_1_2_5_5_11:
+                return DRV_RATE_MASK_1_BARKER | 
+                       DRV_RATE_MASK_2_BARKER | 
+                       DRV_RATE_MASK_5_5_CCK | 
+                       DRV_RATE_MASK_11_CCK;
+
+            case BASIC_RATE_SET_UP_TO_12:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_18:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_24:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_36:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_48:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_54:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+
+            case BASIC_RATE_SET_6_12_24:
+                return DRV_RATE_MASK_6_OFDM | 
+                       DRV_RATE_MASK_12_OFDM | 
+                       DRV_RATE_MASK_24_OFDM;
+
+            case BASIC_RATE_SET_1_2_5_5_6_11_12_24:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_24_OFDM;
+
+            case BASIC_RATE_SET_ALL_MCS_RATES:
+                return DRV_RATE_MASK_MCS_0_OFDM |
+                       DRV_RATE_MASK_MCS_1_OFDM |
+                       DRV_RATE_MASK_MCS_2_OFDM |
+                       DRV_RATE_MASK_MCS_3_OFDM |
+                       DRV_RATE_MASK_MCS_4_OFDM |
+                       DRV_RATE_MASK_MCS_5_OFDM |
+                       DRV_RATE_MASK_MCS_6_OFDM |
+                       DRV_RATE_MASK_MCS_7_OFDM |
+                       DRV_RATE_MASK_1_BARKER   | 
+                       DRV_RATE_MASK_2_BARKER   |
+                       DRV_RATE_MASK_5_5_CCK    |  
+                       DRV_RATE_MASK_11_CCK;
+
+
+            default:
+                return DRV_RATE_MASK_1_BARKER | 
+                       DRV_RATE_MASK_2_BARKER;
+        }
+    }
+    else
+    {
+        switch (eBasicRateSet)
+        {
+            case BASIC_RATE_SET_UP_TO_12:
+                return DRV_RATE_MASK_6_OFDM | 
+                       DRV_RATE_MASK_9_OFDM | 
+                       DRV_RATE_MASK_12_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_18:
+                return DRV_RATE_MASK_6_OFDM | 
+                       DRV_RATE_MASK_9_OFDM | 
+                       DRV_RATE_MASK_12_OFDM | 
+                       DRV_RATE_MASK_18_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_24:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_36:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_48:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM;
+
+            case BASIC_RATE_SET_UP_TO_54:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+
+            case BASIC_RATE_SET_6_12_24:
+                return DRV_RATE_MASK_6_OFDM | 
+                       DRV_RATE_MASK_12_OFDM | 
+                       DRV_RATE_MASK_24_OFDM;
+
+            case BASIC_RATE_SET_ALL_MCS_RATES:
+                return DRV_RATE_MASK_MCS_0_OFDM |
+                       DRV_RATE_MASK_MCS_1_OFDM |
+                       DRV_RATE_MASK_MCS_2_OFDM |
+                       DRV_RATE_MASK_MCS_3_OFDM |
+                       DRV_RATE_MASK_MCS_4_OFDM |
+                       DRV_RATE_MASK_MCS_5_OFDM |
+                       DRV_RATE_MASK_MCS_6_OFDM |
+                       DRV_RATE_MASK_MCS_7_OFDM |
+                       DRV_RATE_MASK_6_OFDM | 
+                       DRV_RATE_MASK_12_OFDM | 
+                       DRV_RATE_MASK_24_OFDM;
+
+            default:
+                return DRV_RATE_MASK_6_OFDM | 
+                       DRV_RATE_MASK_12_OFDM | 
+                       DRV_RATE_MASK_24_OFDM;
+        }
+    }
+}
+
+TI_UINT32 rate_SupportedToDrvBitmap (ESupportedRateSet eSupportedRateSet, TI_BOOL bDot11a)
+{
+    if (!bDot11a)
+    {
+        switch (eSupportedRateSet)
+        {
+            case SUPPORTED_RATE_SET_1_2:
+                return DRV_RATE_MASK_1_BARKER | 
+                       DRV_RATE_MASK_2_BARKER;
+
+            case SUPPORTED_RATE_SET_1_2_5_5_11:
+                return DRV_RATE_MASK_1_BARKER | 
+                       DRV_RATE_MASK_2_BARKER | 
+                       DRV_RATE_MASK_5_5_CCK | 
+                       DRV_RATE_MASK_11_CCK;
+
+            case SUPPORTED_RATE_SET_1_2_5_5_11_22:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_22_PBCC;
+
+            case SUPPORTED_RATE_SET_UP_TO_18:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM;
+
+            case SUPPORTED_RATE_SET_UP_TO_24:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM;
+
+            case SUPPORTED_RATE_SET_UP_TO_36:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM;
+
+            case SUPPORTED_RATE_SET_UP_TO_48:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM;
+
+            case SUPPORTED_RATE_SET_UP_TO_54:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+
+            case SUPPORTED_RATE_SET_ALL:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_22_PBCC |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+
+            case SUPPORTED_RATE_SET_ALL_OFDM:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+                       
+            case SUPPORTED_RATE_SET_ALL_MCS_RATES:
+                return DRV_RATE_MASK_MCS_0_OFDM |
+                       DRV_RATE_MASK_MCS_1_OFDM |
+                       DRV_RATE_MASK_MCS_2_OFDM |
+                       DRV_RATE_MASK_MCS_3_OFDM |
+                       DRV_RATE_MASK_MCS_4_OFDM |
+                       DRV_RATE_MASK_MCS_5_OFDM |
+                       DRV_RATE_MASK_MCS_6_OFDM |
+                       DRV_RATE_MASK_MCS_7_OFDM |
+                       DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_22_PBCC |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+
+            default:
+                return DRV_RATE_MASK_1_BARKER |
+                       DRV_RATE_MASK_2_BARKER |
+                       DRV_RATE_MASK_5_5_CCK |
+                       DRV_RATE_MASK_11_CCK |
+                       DRV_RATE_MASK_22_PBCC |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+        }
+    }
+    else
+    {
+        switch (eSupportedRateSet)
+        {
+            case SUPPORTED_RATE_SET_UP_TO_18:
+                return DRV_RATE_MASK_6_OFDM | 
+                       DRV_RATE_MASK_9_OFDM | 
+                       DRV_RATE_MASK_12_OFDM | 
+                       DRV_RATE_MASK_18_OFDM;
+
+            case SUPPORTED_RATE_SET_UP_TO_24:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM;
+
+            case SUPPORTED_RATE_SET_UP_TO_36:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM;
+
+            case SUPPORTED_RATE_SET_UP_TO_48:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM;
+
+            case SUPPORTED_RATE_SET_UP_TO_54:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+                       
+            case SUPPORTED_RATE_SET_ALL:
+            case SUPPORTED_RATE_SET_ALL_OFDM:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+                       
+            case SUPPORTED_RATE_SET_ALL_MCS_RATES:
+                return DRV_RATE_MASK_MCS_0_OFDM |
+                       DRV_RATE_MASK_MCS_1_OFDM |
+                       DRV_RATE_MASK_MCS_2_OFDM |
+                       DRV_RATE_MASK_MCS_3_OFDM |
+                       DRV_RATE_MASK_MCS_4_OFDM |
+                       DRV_RATE_MASK_MCS_5_OFDM |
+                       DRV_RATE_MASK_MCS_6_OFDM |
+                       DRV_RATE_MASK_MCS_7_OFDM |
+                       DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+
+            default:
+                return DRV_RATE_MASK_6_OFDM |
+                       DRV_RATE_MASK_9_OFDM |
+                       DRV_RATE_MASK_12_OFDM |
+                       DRV_RATE_MASK_18_OFDM |
+                       DRV_RATE_MASK_24_OFDM |
+                       DRV_RATE_MASK_36_OFDM |
+                       DRV_RATE_MASK_48_OFDM |
+                       DRV_RATE_MASK_54_OFDM;
+        }
+    }
+}
+
+TI_STATUS rate_ValidateVsBand (TI_UINT32 *pSupportedMask, TI_UINT32 *pBasicMask, TI_BOOL bDot11a)
+{
+    if (bDot11a)
+    {
+        *pSupportedMask &= ~
+            (
+                DRV_RATE_MASK_1_BARKER |
+                DRV_RATE_MASK_2_BARKER |
+                DRV_RATE_MASK_5_5_CCK |
+                DRV_RATE_MASK_11_CCK |
+                DRV_RATE_MASK_22_PBCC
+            );
+    }
+
+    *pBasicMask &= *pSupportedMask;
+
+    if (*pBasicMask == 0)
+    {
+        if (bDot11a)
+        {
+            *pBasicMask = DRV_RATE_MASK_6_OFDM | DRV_RATE_MASK_12_OFDM | DRV_RATE_MASK_24_OFDM;
+        }
+        else
+        {
+            *pBasicMask = DRV_RATE_MASK_1_BARKER | DRV_RATE_MASK_2_BARKER;
+        }
+    }
+
+    return TI_OK;
+}
+
+/*-----------------------------------------------------------------------------
+Routine Name:    RateNumberToHost
+Routine Description:
+Arguments:
+Return Value:    None
+-----------------------------------------------------------------------------*/
+ERate rate_NumberToDrv (TI_UINT32 rate)
+{
+    switch (rate)
+    {
+        case 0x1:
+            return DRV_RATE_1M;
+
+        case 0x2:
+            return DRV_RATE_2M;
+
+        case 0x5:
+            return DRV_RATE_5_5M;
+
+        case 0xB:
+            return DRV_RATE_11M;
+
+        case 0x16:
+            return DRV_RATE_22M;
+
+        case 0x6:
+            return DRV_RATE_6M;
+
+        case 0x9:
+            return DRV_RATE_9M;
+
+        case 0xC:
+            return DRV_RATE_12M;
+
+        case 0x12:
+            return DRV_RATE_18M;
+
+        case 0x18:
+            return DRV_RATE_24M;
+
+        case 0x24:
+            return DRV_RATE_36M;
+
+        case 0x30:
+            return DRV_RATE_48M;
+
+        case 0x36:
+            return DRV_RATE_54M;
+
+        /* MCS rate */
+        case 0x7:
+            return DRV_RATE_MCS_0;
+
+        case 0xD:
+            return DRV_RATE_MCS_1;
+
+        case 0x13:
+            return DRV_RATE_MCS_2;
+
+        case 0x1A:
+            return DRV_RATE_MCS_3;
+
+        case 0x27:
+            return DRV_RATE_MCS_4;
+
+        case 0x34:
+            return DRV_RATE_MCS_5;
+
+        case 0x3A:
+            return DRV_RATE_MCS_6;
+
+        case 0x41:
+            return DRV_RATE_MCS_7;
+
+        default:
+            return DRV_RATE_6M;
+    }
+}
+
+TI_UINT32 rate_GetDrvBitmapForDefaultBasicSet ()
+{
+    return rate_BasicToDrvBitmap (BASIC_RATE_SET_1_2_5_5_11, TI_FALSE);
+}
+
+TI_UINT32 rate_GetDrvBitmapForDefaultSupporteSet ()
+{
+    return rate_SupportedToDrvBitmap (SUPPORTED_RATE_SET_1_2_5_5_11, TI_FALSE);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/rate.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,183 @@
+/*
+ * rate.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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  rate.h
+ *  \brief Rate conversion
+ *
+ *  \see   rate.c
+ */
+
+
+
+
+#ifndef RATE_H
+#define RATE_H
+
+#include "TWDriver.h"
+
+
+typedef enum
+{
+    NET_BASIC_MASK      = 0x80,
+    NET_RATE_1M         = 0x02,
+    NET_RATE_2M         = 0x04,
+    NET_RATE_5_5M       = 0x0B,
+    NET_RATE_11M        = 0x16,
+    NET_RATE_22M        = 0x2C,
+    NET_RATE_6M         = 0x0C,
+    NET_RATE_9M         = 0x12,
+    NET_RATE_12M        = 0x18,
+    NET_RATE_18M        = 0x24,
+    NET_RATE_24M        = 0x30,
+    NET_RATE_36M        = 0x48,
+    NET_RATE_48M        = 0x60,
+    NET_RATE_54M        = 0x6C,
+    NET_RATE_MCS0       = 0x0D, /* MCS0 6.5M */
+    NET_RATE_MCS1       = 0x1A, /* MCS1 13M */
+    NET_RATE_MCS2       = 0x27, /* MCS2 19.5M */
+    NET_RATE_MCS3       = 0x34, /* MCS3 26M */
+    NET_RATE_MCS4       = 0x4E, /* MCS4 39M */
+    NET_RATE_MCS5       = 0x68, /* MCS5 52M */
+    NET_RATE_MCS6       = 0x75, /* MCS6 58.5M */
+    NET_RATE_MCS7       = 0x7F  /* MCS7 65M */
+
+} ENetRate;
+
+
+typedef enum 
+{
+    NET_RATE_1M_BASIC   = (NET_RATE_1M   | NET_BASIC_MASK),
+    NET_RATE_2M_BASIC   = (NET_RATE_2M   | NET_BASIC_MASK),
+    NET_RATE_5_5M_BASIC = (NET_RATE_5_5M | NET_BASIC_MASK),
+    NET_RATE_11M_BASIC  = (NET_RATE_11M  | NET_BASIC_MASK),
+    NET_RATE_22M_BASIC  = (NET_RATE_22M  | NET_BASIC_MASK),
+    NET_RATE_6M_BASIC   = (NET_RATE_6M   | NET_BASIC_MASK),
+    NET_RATE_9M_BASIC   = (NET_RATE_9M   | NET_BASIC_MASK),
+    NET_RATE_12M_BASIC  = (NET_RATE_12M  | NET_BASIC_MASK),
+    NET_RATE_18M_BASIC  = (NET_RATE_18M  | NET_BASIC_MASK),
+    NET_RATE_24M_BASIC  = (NET_RATE_24M  | NET_BASIC_MASK),
+    NET_RATE_36M_BASIC  = (NET_RATE_36M  | NET_BASIC_MASK),
+    NET_RATE_48M_BASIC  = (NET_RATE_48M  | NET_BASIC_MASK),
+    NET_RATE_54M_BASIC  = (NET_RATE_54M  | NET_BASIC_MASK),
+    NET_RATE_MCS0_BASIC  = (NET_RATE_MCS0  | NET_BASIC_MASK),
+    NET_RATE_MCS1_BASIC  = (NET_RATE_MCS1  | NET_BASIC_MASK),
+    NET_RATE_MCS2_BASIC  = (NET_RATE_MCS2  | NET_BASIC_MASK),
+    NET_RATE_MCS3_BASIC  = (NET_RATE_MCS3  | NET_BASIC_MASK),
+    NET_RATE_MCS4_BASIC  = (NET_RATE_MCS4  | NET_BASIC_MASK),
+    NET_RATE_MCS5_BASIC  = (NET_RATE_MCS5  | NET_BASIC_MASK),
+    NET_RATE_MCS6_BASIC  = (NET_RATE_MCS6  | NET_BASIC_MASK),
+    NET_RATE_MCS7_BASIC  = (NET_RATE_MCS7  | NET_BASIC_MASK)
+
+} ENetRateBasic;
+
+
+typedef enum
+{
+    BASIC_RATE_SET_1_2                  = 0,
+    BASIC_RATE_SET_1_2_5_5_11           = 1,
+    BASIC_RATE_SET_UP_TO_12             = 2,
+    BASIC_RATE_SET_UP_TO_18             = 3,
+    BASIC_RATE_SET_1_2_5_5_6_11_12_24   = 4,
+    BASIC_RATE_SET_UP_TO_36             = 5,
+    BASIC_RATE_SET_UP_TO_48             = 6,
+    BASIC_RATE_SET_UP_TO_54             = 7,
+    BASIC_RATE_SET_UP_TO_24             = 8,
+    BASIC_RATE_SET_6_12_24              = 9,
+    BASIC_RATE_SET_ALL_MCS_RATES        = 10
+} EBasicRateSet;
+
+
+/* Keep increasing define values - related to increasing suported rates */
+typedef enum
+{
+    SUPPORTED_RATE_SET_1_2              = 0,
+    SUPPORTED_RATE_SET_1_2_5_5_11       = 1,
+    SUPPORTED_RATE_SET_1_2_5_5_11_22    = 2,
+    SUPPORTED_RATE_SET_UP_TO_18         = 3,
+    SUPPORTED_RATE_SET_UP_TO_24         = 4,
+    SUPPORTED_RATE_SET_UP_TO_36         = 5,
+    SUPPORTED_RATE_SET_UP_TO_48         = 6,
+    SUPPORTED_RATE_SET_UP_TO_54         = 7,
+    SUPPORTED_RATE_SET_ALL              = 8,
+    SUPPORTED_RATE_SET_ALL_OFDM         = 9,
+    SUPPORTED_RATE_SET_ALL_MCS_RATES    = 10
+
+} ESupportedRateSet;
+
+
+typedef enum
+{
+    DRV_MODULATION_NONE     = 0,
+    DRV_MODULATION_CCK      = 1,
+    DRV_MODULATION_PBCC     = 2,
+    DRV_MODULATION_QPSK     = 3,
+    DRV_MODULATION_OFDM     = 4
+
+} EModulationType;
+
+
+#define NET_BASIC_RATE(rate)       ((rate) & NET_BASIC_MASK)
+#define NET_ACTIVE_RATE(rate)      (!NET_BASIC_RATE (rate))
+
+
+ERate     rate_NumberToDrv (TI_UINT32 rate);
+TI_UINT32 rate_DrvToNumber (ERate eRate);
+ERate     rate_NetToDrv (TI_UINT32 rate);
+ENetRate  rate_DrvToNet (ERate eRate);
+TI_STATUS rate_DrvBitmapToNetStr (TI_UINT32 uSuppRatesBitMap, TI_UINT32 uBasicRatesBitMap, TI_UINT8 *string, TI_UINT32 *len, TI_UINT32 *pFirstOfdmRate);
+TI_STATUS rate_NetStrToDrvBitmap (TI_UINT32 *pBitMap, TI_UINT8 *string, TI_UINT32 len);
+TI_STATUS rate_NetBasicStrToDrvBitmap (TI_UINT32 *pBitMap, TI_UINT8 *string, TI_UINT32 len);
+TI_STATUS rate_McsNetStrToDrvBitmap (TI_UINT32 *pBitMap, TI_UINT8 *string);
+TI_STATUS rate_DrvBitmapToHwBitmap (TI_UINT32 uDrvBitmap, TI_UINT32 *pHwBitmap);
+TI_STATUS rate_PolicyToDrv (ETxRateClassId ePolicyRate, ERate *eAppRate);
+TI_UINT32 rate_BasicToDrvBitmap (EBasicRateSet eBasicRateSet, TI_BOOL bDot11a);
+TI_UINT32 rate_SupportedToDrvBitmap (ESupportedRateSet eSupportedRateSet, TI_BOOL bDot11a);
+
+ERate     rate_GetMaxFromDrvBitmap (TI_UINT32 uBitMap);
+ENetRate  rate_GetMaxBasicFromStr (TI_UINT8 *pRatesString, TI_UINT32 len, ENetRate eMaxRate);
+ENetRate  rate_GetMaxActiveFromStr (TI_UINT8 *pRatesString, TI_UINT32 len, ENetRate eMaxRate);
+
+TI_STATUS rate_ValidateVsBand (TI_UINT32 *pSupportedMask, TI_UINT32 *pBasicMask, TI_BOOL bDot11a);
+
+TI_UINT32 rate_GetDrvBitmapForDefaultBasicSet (void);
+TI_UINT32 rate_GetDrvBitmapForDefaultSupporteSet (void);
+
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/report.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,563 @@
+/*
+ * report.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 report.c
+ *  \brief report module implementation
+ *
+ *  \see report.h
+ */
+
+#define __FILE_ID__  FILE_ID_132
+#include "tidef.h"
+#include "osApi.h"
+#include "report.h"
+#include "commonTypes.h"
+#include "CmdInterfaceCodes.h"
+
+
+
+
+/************************************************************************
+ *                        report_create                              	*
+ ************************************************************************/
+TI_HANDLE report_Create (TI_HANDLE hOs)
+{
+    TReport *pReport;
+
+    pReport = os_memoryAlloc(hOs, sizeof(TReport),MemoryNormal);
+    if (!pReport)
+    {
+        return NULL;
+    }
+
+    pReport->hOs = hOs;
+
+    os_memoryZero(hOs, pReport->aSeverityTable, sizeof(pReport->aSeverityTable));
+    os_memoryZero(hOs, pReport->aFileEnable, sizeof(pReport->aFileEnable));
+
+
+#ifdef PRINTF_ROLLBACK
+
+	/* Fill the files names table */
+
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_0  ]),  "timer                   "  ,  sizeof("timer                   "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_1  ]),  "measurementMgr          "  ,  sizeof("measurementMgr          "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_2  ]),  "measurementMgrSM        "  ,  sizeof("measurementMgrSM        "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_3  ]),  "regulatoryDomain        "  ,  sizeof("regulatoryDomain        "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_4  ]),  "requestHandler          "  ,  sizeof("requestHandler          "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_5  ]),  "SoftGemini              "  ,  sizeof("SoftGemini              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_6  ]),  "spectrumMngmntMgr       "  ,  sizeof("spectrumMngmntMgr       "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_7  ]),  "SwitchChannel           "  ,  sizeof("SwitchChannel           "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_8  ]),  "roamingMngr             "  ,  sizeof("roamingMngr             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_9  ]),  "scanMngr                "  ,  sizeof("scanMngr                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_10 ]),  "admCtrlXCC              "  ,  sizeof("admCtrlXCC              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_11 ]),  "XCCMngr                 "  ,  sizeof("XCCMngr                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_12 ]),  "XCCRMMngr               "  ,  sizeof("XCCRMMngr               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_13 ]),  "XCCTSMngr               "  ,  sizeof("XCCTSMngr               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_14 ]),  "rogueAp                 "  ,  sizeof("rogueAp                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_15 ]),  "TransmitPowerXCC        "  ,  sizeof("TransmitPowerXCC        "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_16 ]),  "admCtrl                 "  ,  sizeof("admCtrl                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_17 ]),  "admCtrlNone             "  ,  sizeof("admCtrlNone             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_18 ]),  "admCtrlWep              "  ,  sizeof("admCtrlWep              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_19 ]),  "admCtrlWpa              "  ,  sizeof("admCtrlWpa              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_20 ]),  "admCtrlWpa2             "  ,  sizeof("admCtrlWpa2             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_21 ]),  "apConn                  "  ,  sizeof("apConn                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_22 ]),  "broadcastKey802_1x      "  ,  sizeof("broadcastKey802_1x      "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_23 ]),  "broadcastKeyNone        "  ,  sizeof("broadcastKeyNone        "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_24 ]),  "broadcastKeySM          "  ,  sizeof("broadcastKeySM          "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_25 ]),  "conn                    "  ,  sizeof("conn                    "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_26 ]),  "connIbss                "  ,  sizeof("connIbss                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_27 ]),  "connInfra               "  ,  sizeof("connInfra               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_28 ]),  "keyDerive               "  ,  sizeof("keyDerive               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_29 ]),  "keyDeriveAes            "  ,  sizeof("keyDeriveAes            "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_30 ]),  "keyDeriveCkip           "  ,  sizeof("keyDeriveCkip           "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_31 ]),  "keyDeriveTkip           "  ,  sizeof("keyDeriveTkip           "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_32 ]),  "keyDeriveWep            "  ,  sizeof("keyDeriveWep            "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_33 ]),  "keyParser               "  ,  sizeof("keyParser               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_34 ]),  "keyParserExternal       "  ,  sizeof("keyParserExternal       "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_35 ]),  "keyParserWep            "  ,  sizeof("keyParserWep            "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_36 ]),  "mainKeysSm              "  ,  sizeof("mainKeysSm              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_37 ]),  "mainSecKeysOnly         "  ,  sizeof("mainSecKeysOnly         "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_38 ]),  "mainSecNull             "  ,  sizeof("mainSecNull             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_39 ]),  "mainSecSm               "  ,  sizeof("mainSecSm               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_40 ]),  "rsn                     "  ,  sizeof("rsn                     "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_41 ]),  "sme                     "  ,  sizeof("sme                     "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_42 ]),  "smeSelect               "  ,  sizeof("smeSelect               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_43 ]),  "smeSm                   "  ,  sizeof("smeSm                   "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_44 ]),  "unicastKey802_1x        "  ,  sizeof("unicastKey802_1x        "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_45 ]),  "unicastKeyNone          "  ,  sizeof("unicastKeyNone          "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_46 ]),  "unicastKeySM            "  ,  sizeof("unicastKeySM            "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_47 ]),  "CmdDispatcher           "  ,  sizeof("CmdDispatcher           "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_48 ]),  "CmdHndlr                "  ,  sizeof("CmdHndlr                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_49 ]),  "DrvMain                 "  ,  sizeof("DrvMain                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_50 ]),  "EvHandler               "  ,  sizeof("EvHandler               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_51 ]),  "Ctrl                    "  ,  sizeof("Ctrl                    "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_52 ]),  "GeneralUtil             "  ,  sizeof("GeneralUtil             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_53 ]),  "RateAdaptation          "  ,  sizeof("RateAdaptation          "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_54 ]),  "rx                      "  ,  sizeof("rx                      "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_55 ]),  "TrafficMonitor          "  ,  sizeof("TrafficMonitor          "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_56 ]),  "txCtrl                  "  ,  sizeof("txCtrl                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_57 ]),  "txCtrlParams            "  ,  sizeof("txCtrlParams            "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_58 ]),  "txCtrlServ              "  ,  sizeof("txCtrlServ              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_59 ]),  "TxDataClsfr             "  ,  sizeof("TxDataClsfr             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_60 ]),  "txDataQueue             "  ,  sizeof("txDataQueue             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_61 ]),  "txMgmtQueue             "  ,  sizeof("txMgmtQueue             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_62 ]),  "txPort                  "  ,  sizeof("txPort                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_63 ]),  "assocSM                 "  ,  sizeof("assocSM                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_64 ]),  "authSm                  "  ,  sizeof("authSm                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_65 ]),  "currBss                 "  ,  sizeof("currBss                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_66 ]),  "healthMonitor           "  ,  sizeof("healthMonitor           "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_67 ]),  "mlmeBuilder             "  ,  sizeof("mlmeBuilder             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_68 ]),  "mlmeParser              "  ,  sizeof("mlmeParser              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_69 ]),  "mlmeSm                  "  ,  sizeof("mlmeSm                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_70 ]),  "openAuthSm              "  ,  sizeof("openAuthSm              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_71 ]),  "PowerMgr                "  ,  sizeof("PowerMgr                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_72 ]),  "PowerMgrDbgPrint        "  ,  sizeof("PowerMgrDbgPrint        "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_73 ]),  "PowerMgrKeepAlive       "  ,  sizeof("PowerMgrKeepAlive       "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_74 ]),  "qosMngr                 "  ,  sizeof("qosMngr                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_75 ]),  "roamingInt              "  ,  sizeof("roamingInt              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_76 ]),  "ScanCncn                "  ,  sizeof("ScanCncn                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_77 ]),  "ScanCncnApp             "  ,  sizeof("ScanCncnApp             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_78 ]),  "ScanCncnOsSm            "  ,  sizeof("ScanCncnOsSm            "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_79 ]),  "ScanCncnSm              "  ,  sizeof("ScanCncnSm              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_80 ]),  "ScanCncnSmSpecific      "  ,  sizeof("ScanCncnSmSpecific      "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_81 ]),  "scanResultTable         "  ,  sizeof("scanResultTable         "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_82 ]),  "scr                     "  ,  sizeof("scr                     "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_83 ]),  "sharedKeyAuthSm         "  ,  sizeof("sharedKeyAuthSm         "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_84 ]),  "siteHash                "  ,  sizeof("siteHash                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_85 ]),  "siteMgr                 "  ,  sizeof("siteMgr                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_86 ]),  "StaCap                  "  ,  sizeof("StaCap                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_87 ]),  "systemConfig            "  ,  sizeof("systemConfig            "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_88 ]),  "templates               "  ,  sizeof("templates               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_89 ]),  "trafficAdmControl       "  ,  sizeof("trafficAdmControl       "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_90 ]),  "CmdBld                  "  ,  sizeof("CmdBld                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_91 ]),  "CmdBldCfg               "  ,  sizeof("CmdBldCfg               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_92 ]),  "CmdBldCfgIE             "  ,  sizeof("CmdBldCfgIE             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_93 ]),  "CmdBldCmd               "  ,  sizeof("CmdBldCmd               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_94 ]),  "CmdBldCmdIE             "  ,  sizeof("CmdBldCmdIE             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_95 ]),  "CmdBldItr               "  ,  sizeof("CmdBldItr               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_96 ]),  "CmdBldItrIE             "  ,  sizeof("CmdBldItrIE             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_97 ]),  "CmdQueue                "  ,  sizeof("CmdQueue                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_98 ]),  "RxQueue                 "  ,  sizeof("RxQueue                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_99 ]),  "txCtrlBlk               "  ,  sizeof("txCtrlBlk               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_100]),  "txHwQueue               "  ,  sizeof("txHwQueue               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_101]),  "CmdMBox                 "  ,  sizeof("CmdMBox                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_102]),  "eventMbox               "  ,  sizeof("eventMbox               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_103]),  "fwDebug                 "  ,  sizeof("fwDebug                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_104]),  "FwEvent                 "  ,  sizeof("FwEvent                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_105]),  "HwInit                  "  ,  sizeof("HwInit                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_106]),  "RxXfer                  "  ,  sizeof("RxXfer                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_107]),  "txResult                "  ,  sizeof("txResult                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_108]),  "txXfer                  "  ,  sizeof("txXfer                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_109]),  "MacServices             "  ,  sizeof("MacServices             "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_110]),  "MeasurementSrv          "  ,  sizeof("MeasurementSrv          "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_111]),  "measurementSrvDbgPrint  "  ,  sizeof("measurementSrvDbgPrint  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_112]),  "MeasurementSrvSM        "  ,  sizeof("MeasurementSrvSM        "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_113]),  "PowerSrv                "  ,  sizeof("PowerSrv                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_114]),  "PowerSrvSM              "  ,  sizeof("PowerSrvSM              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_115]),  "ScanSrv                 "  ,  sizeof("ScanSrv                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_116]),  "ScanSrvSM               "  ,  sizeof("ScanSrvSM               "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_117]),  "TWDriver                "  ,  sizeof("TWDriver                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_118]),  "TWDriverCtrl            "  ,  sizeof("TWDriverCtrl            "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_119]),  "TWDriverRadio           "  ,  sizeof("TWDriverRadio           "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_120]),  "TWDriverTx              "  ,  sizeof("TWDriverTx              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_121]),  "TwIf                    "  ,  sizeof("TwIf                    "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_122]),  "SdioBusDrv              "  ,  sizeof("SdioBusDrv              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_123]),  "TxnQueue                "  ,  sizeof("TxnQueue                "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_124]),  "WspiBusDrv              "  ,  sizeof("WspiBusDrv              "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_125]),  "context                 "  ,  sizeof("context                 "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_126]),  "freq                    "  ,  sizeof("freq                    "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_127]),  "fsm                     "  ,  sizeof("fsm                     "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_128]),  "GenSM                   "  ,  sizeof("GenSM                   "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_129]),  "mem                     "  ,  sizeof("mem                     "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_130]),  "queue                   "  ,  sizeof("queue                   "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_131]),  "rate                    "  ,  sizeof("rate                    "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_132]),  "report                  "  ,  sizeof("report                  "));
+    os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_133]),  "stack                   "  ,  sizeof("stack                   "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_134]),  "timer                   "  ,  sizeof("timer                   "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_135]),  "wlanhwinit              "  ,  sizeof("wlanhwinit              "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_136]),  "wlanhwinitmain          "  ,  sizeof("wlanhwinitmain          "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_137]),  "TIWlanHpaCB             "  ,  sizeof("TIWlanHpaCB             "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_138]),  "osapi                   "  ,  sizeof("osapi                   "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_139]),  "timerclient             "  ,  sizeof("timerclient             "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_140]),  "spi                     "  ,  sizeof("spi                     "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_141]),  "spiclient               "  ,  sizeof("spiclient               "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_142]),  "TIWlanTestIfac          "  ,  sizeof("TIWlanTestIface         "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_143]),  "wlantrace               "  ,  sizeof("wlantrace               "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_144]),  "TIWha                   "  ,  sizeof("TIWha                   "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_145]),  "TIWhaAdaptCb            "  ,  sizeof("TIWhaAdaptCb            "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_146]),  "TIWhaCb                 "  ,  sizeof("TIWhaCb                 "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_147]),  "TIWhaTxRx               "  ,  sizeof("TIWhaTxRx               "));
+	os_memoryCopy(hOs, (void *)(pReport->aFileName[FILE_ID_148]),  "TIWhaUtils              "  ,  sizeof("TIWhaUtils              "));
+
+#endif  /* PRINTF_ROLLBACK */
+    
+	/* Severity table description */
+
+	os_memoryCopy(hOs, (char *)(pReport->aSeverityDesc[REPORT_SEVERITY_INIT]),              "INIT", sizeof("INIT"));
+	os_memoryCopy(hOs, (char *)(pReport->aSeverityDesc[REPORT_SEVERITY_INFORMATION]),       "INFORMATION", sizeof("INFORMATION"));
+	os_memoryCopy(hOs, (char *)(pReport->aSeverityDesc[REPORT_SEVERITY_WARNING]),           "WARNING", sizeof("WARNING"));
+	os_memoryCopy(hOs, (char *)(pReport->aSeverityDesc[REPORT_SEVERITY_ERROR]),             "ERROR", sizeof("ERROR"));
+	os_memoryCopy(hOs, (char *)(pReport->aSeverityDesc[REPORT_SEVERITY_FATAL_ERROR]),       "FATAL_ERROR", sizeof("FATAL_ERROR"));
+	os_memoryCopy(hOs, (char *)(pReport->aSeverityDesc[REPORT_SEVERITY_SM]),                "SM", sizeof("SM"));
+	os_memoryCopy(hOs, (char *)(pReport->aSeverityDesc[REPORT_SEVERITY_CONSOLE]),           "CONSOLE", sizeof("CONSOLE"));
+     
+    return (TI_HANDLE)pReport;
+}
+
+/************************************************************************
+ *                        report_SetDefaults                            *
+ ************************************************************************/
+TI_STATUS report_SetDefaults (TI_HANDLE hReport, TReportInitParams *pInitParams)
+{
+	if( (NULL == hReport) || (NULL == pInitParams))
+	{
+		return TI_NOK;
+	}
+
+    report_SetReportFilesTable (hReport, (TI_UINT8 *)pInitParams->aFileEnable);
+    report_SetReportSeverityTable (hReport, (TI_UINT8 *)pInitParams->aSeverityTable);
+    
+    return TI_OK;
+}
+
+/************************************************************************
+ *                        report_unLoad                                 *
+ ************************************************************************/
+TI_STATUS report_Unload (TI_HANDLE hReport)
+{
+    TReport *pReport = (TReport *)hReport;
+
+	if(NULL == pReport)
+	{
+		return TI_NOK;
+	}
+
+#if defined(TIWLN_WINCE30) && defined(TI_DBG)
+    closeMyFile();
+#endif
+
+    os_memoryFree(pReport->hOs, pReport, sizeof(TReport));
+    return TI_OK;
+}
+
+
+TI_STATUS report_SetReportModule(TI_HANDLE hReport, TI_UINT8 module_index)
+{
+	if(NULL == hReport)
+	{
+		return TI_NOK;
+	}
+
+    ((TReport *)hReport)->aFileEnable[module_index] = 1;
+
+    return TI_OK;
+}
+
+
+TI_STATUS report_ClearReportModule(TI_HANDLE hReport, TI_UINT8 module_index)
+{
+	if(NULL == hReport)
+	{
+		return TI_NOK;
+	}
+
+    ((TReport *)hReport)->aFileEnable[module_index] = 0;
+
+    return TI_OK;
+}
+
+
+TI_STATUS report_GetReportFilesTable(TI_HANDLE hReport, TI_UINT8 *pFiles)
+{
+    TI_UINT8 index;
+
+	if( (NULL == hReport) || (NULL == pFiles))
+	{
+		return TI_NOK;
+	}
+
+    os_memoryCopy(((TReport *)hReport)->hOs, 
+                  (void *)pFiles, 
+                  (void *)(((TReport *)hReport)->aFileEnable), 
+                  sizeof(((TReport *)hReport)->aFileEnable));
+
+    for (index = 0; index < sizeof(((TReport *)hReport)->aFileEnable); index++)
+    {
+        pFiles[index] += '0';
+    }
+
+    return TI_OK;
+}
+
+
+TI_STATUS report_SetReportFilesTable(TI_HANDLE hReport, TI_UINT8 *pFiles)
+{
+    TI_UINT8 index;
+
+	if( (NULL == hReport) || (NULL == pFiles))
+	{
+		return TI_NOK;
+	}
+
+
+    for (index = 0; index < sizeof(((TReport *)hReport)->aFileEnable); index++)
+    {
+        pFiles[index] -= '0';
+    }
+
+    os_memoryCopy(((TReport *)hReport)->hOs, 
+                  (void *)(((TReport *)hReport)->aFileEnable), 
+                  (void *)pFiles, 
+                  sizeof(((TReport *)hReport)->aFileEnable));
+
+    return TI_OK;
+}
+
+
+TI_STATUS report_GetReportSeverityTable(TI_HANDLE hReport, TI_UINT8 *pSeverities)
+{
+    TI_UINT8 index;
+
+	if( (NULL == hReport) || (NULL == pSeverities))
+	{
+
+		return TI_NOK;
+	}
+
+
+    os_memoryCopy (((TReport *)hReport)->hOs, 
+                   (void *)pSeverities, 
+                   (void *)(((TReport *)hReport)->aSeverityTable), 
+                   sizeof(((TReport *)hReport)->aSeverityTable));
+
+    for (index = 0; index < sizeof(((TReport *)hReport)->aSeverityTable); index++)
+    {
+        pSeverities[index] += '0';
+    }
+
+    return TI_OK;
+}
+
+
+TI_STATUS report_SetReportSeverityTable(TI_HANDLE hReport, TI_UINT8 *pSeverities)
+{
+    TI_UINT8 index;
+
+	if( (NULL == hReport) || (NULL == pSeverities))
+	{
+		return TI_NOK;
+	}
+
+    for (index = 0; index < sizeof(((TReport *)hReport)->aSeverityTable); index++)
+    {
+        pSeverities[index] -= '0';
+    }
+
+    os_memoryCopy(((TReport *)hReport)->hOs, 
+                  (void *)(((TReport *)hReport)->aSeverityTable), 
+                  (void *)pSeverities, 
+                  sizeof(((TReport *)hReport)->aSeverityTable));
+
+    return TI_OK;
+}
+
+
+/***********************************************************************
+ *                        report_setParam                                   
+ ***********************************************************************/
+TI_STATUS report_SetParam (TI_HANDLE hReport, TReportParamInfo *pParam)
+{
+	if( (NULL == hReport) || (NULL == pParam))
+	{
+		return TI_NOK;
+	}
+
+    switch (pParam->paramType)
+    {
+    case REPORT_MODULE_ON_PARAM:
+		report_SetReportModule(hReport, pParam->content.aFileEnable[0]);
+        break;
+
+    case REPORT_MODULE_OFF_PARAM:
+		report_ClearReportModule(hReport, pParam->content.aFileEnable[0]);
+        break;
+
+    case REPORT_MODULE_TABLE_PARAM:
+		report_SetReportFilesTable(hReport, (TI_UINT8 *)pParam->content.aFileEnable);
+        break;
+
+    case REPORT_SEVERITY_TABLE_PARAM:
+        report_SetReportSeverityTable(hReport, (TI_UINT8 *)pParam->content.aSeverityTable);
+        break;
+        
+    case REPORT_PPMODE_VALUE_PARAM:
+        os_setDebugMode((TI_BOOL)pParam->content.uReportPPMode);
+        break;
+#ifndef PRINTF_ROLLBACK
+/*needed only if usinf new logger mechansm, in Symbian legacy way is used!*/
+
+	case REPORT_OUTPUT_TO_LOGGER_ON:
+		os_setDebugOutputToLogger(TI_TRUE);
+		break;
+
+	case REPORT_OUTPUT_TO_LOGGER_OFF:
+		os_setDebugOutputToLogger(TI_FALSE);
+        break;
+#endif
+
+    default:
+		TRACE1(hReport, REPORT_SEVERITY_ERROR, "Set param, Params is not supported, %d\n", pParam->paramType);
+        return PARAM_NOT_SUPPORTED;
+    }
+
+    return TI_OK;
+}
+
+/***********************************************************************
+ *                        report_getParam                                   
+ ***********************************************************************/
+TI_STATUS report_GetParam (TI_HANDLE hReport, TReportParamInfo *pParam)
+{
+	if( (NULL == hReport) || (NULL == pParam))
+	{
+		return TI_NOK;
+	}
+
+    switch (pParam->paramType)
+    {
+    case REPORT_MODULE_TABLE_PARAM:
+        report_GetReportFilesTable(hReport, (TI_UINT8 *)pParam->content.aFileEnable);
+        break;
+
+    case REPORT_SEVERITY_TABLE_PARAM:
+        report_GetReportSeverityTable(hReport, (TI_UINT8 *)pParam->content.aSeverityTable);
+        break;
+
+    default:
+        TRACE1(hReport, REPORT_SEVERITY_ERROR, "Get param, Params is not supported, %d\n", pParam->paramType);
+        return PARAM_NOT_SUPPORTED;
+    }
+
+    return TI_OK;
+}
+
+
+/************************************************************************
+ *                        report_Dump                                 *
+ ************************************************************************/
+TI_STATUS report_Dump (TI_UINT8 *pBuffer, char *pString, TI_UINT32 size)
+{
+    TI_UINT32 index;
+    TI_UINT8  temp_nibble;
+	if( (NULL == pBuffer) || (NULL == pString))
+	{
+		return TI_NOK;
+}
+
+    /* Go over pBuffer and convert it to chars */ 
+    for (index = 0; index < size; index++)
+    {
+        /* First nibble */
+        temp_nibble = (pBuffer[index] & 0x0F);
+        if (temp_nibble <= 9)
+        {
+            pString[(index << 1) + 1] = temp_nibble + '0';
+        }
+        else
+        {
+            pString[(index << 1) + 1] = temp_nibble - 10 + 'A';
+        }
+
+        /* Second nibble */
+        temp_nibble = ((pBuffer[index] & 0xF0) >> 4);
+        if (temp_nibble <= 9)
+{    
+            pString[(index << 1)] = temp_nibble + '0';
+	}   
+        else
+        {
+            pString[(index << 1)] = temp_nibble - 10 + 'A';
+        }
+    }
+
+    /* Put string terminator */
+    pString[(size * 2)] = 0;
+
+    return TI_OK;
+}
+
+
+/* HEX DUMP for BDs !!! Debug code only !!! */
+TI_STATUS report_PrintDump (TI_UINT8 *pData, TI_UINT32 datalen)
+{
+#ifdef TI_DBG
+    TI_INT32  dbuflen=0;
+    TI_UINT32 j;
+    TI_CHAR   dbuf[50];
+    static const TI_CHAR hexdigits[16] = "0123456789ABCDEF";
+
+	if(NULL == pData)
+	{
+		return TI_NOK;
+	}
+
+    for(j=0; j < datalen;)
+    {
+        /* Add a byte to the line*/
+        dbuf[dbuflen] =  hexdigits[(pData[j] >> 4)&0x0f];
+        dbuf[dbuflen+1] = hexdigits[pData[j] & 0x0f];
+        dbuf[dbuflen+2] = ' ';
+        dbuf[dbuflen+3] = '\0';
+        dbuflen += 3;
+        j++;
+        if((j % 16) == 0)
+        {
+            /* Dump a line every 16 hex digits*/
+            WLAN_OS_REPORT(("%04.4x  %s\n", j-16, dbuf));
+            dbuflen = 0;
+        }
+    }
+    /* Flush if something has left in the line*/
+    if(dbuflen)
+        WLAN_OS_REPORT(("%04.4x  %s\n", j & 0xfff0, dbuf));
+#endif
+    return TI_OK;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/report.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,758 @@
+/*
+ * report.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:   report.h                                                    */
+/*    PURPOSE:  Report module internal header API                           */
+/*                                                                          */
+/***************************************************************************/
+#ifndef __REPORT_H__
+#define __REPORT_H__
+
+/** \file  report.h 
+ * \brief Report module API	\n
+ * APIs which are used for reporting messages to the User while running. \n\n
+ * 
+ * The report mechanism: Messages are reported per file and severity Level	\n
+ * Therefore, each file has a report flag which indicate if reporting for that file is enabled, \n
+ * and each severity has a severity flag which indicate if reporting for that severity is enabled.	\n
+ * Only if both flags are enabled, the message is printed. \n
+ * The report flags of all file are indicated in a bit map Table which is contained in the report module handle	\n
+ * The report flags of all severities  are indicated in a bit map Table which is contained in the report module handle	\n
+ */
+
+#include "osApi.h"
+#include "commonTypes.h"
+    
+#define MAX_STRING_LEN         32 
+
+
+/*******************************/
+/*      Report Files IDs       */
+/*******************************/
+
+typedef enum
+{
+	FILE_ID_0	   ,    /*   timer                    */
+	FILE_ID_1	   ,    /*   measurementMgr			  */
+	FILE_ID_2	   ,    /*   measurementMgrSM         */
+	FILE_ID_3	   ,    /*   regulatoryDomain         */
+	FILE_ID_4	   ,    /*   requestHandler           */
+	FILE_ID_5	   ,    /*   SoftGemini               */
+	FILE_ID_6	   ,    /*   spectrumMngmntMgr        */
+	FILE_ID_7	   ,    /*   SwitchChannel            */
+	FILE_ID_8	   ,    /*   roamingMngr              */
+	FILE_ID_9	   ,    /*   scanMngr                 */
+	FILE_ID_10	   ,    /*   admCtrlXCC               */
+	FILE_ID_11	   ,    /*   XCCMngr                  */
+	FILE_ID_12	   ,    /*   XCCRMMngr                */
+	FILE_ID_13	   ,    /*   XCCTSMngr                */
+	FILE_ID_14	   ,    /*   rogueAp                  */
+	FILE_ID_15	   ,    /*   TransmitPowerXCC         */
+	FILE_ID_16	   ,    /*   admCtrl                  */
+	FILE_ID_17	   ,    /*   admCtrlNone              */
+	FILE_ID_18	   ,    /*   admCtrlWep               */
+	FILE_ID_19	   ,    /*   admCtrlWpa               */
+	FILE_ID_20	   ,    /*   admCtrlWpa2              */
+	FILE_ID_21	   ,    /*   apConn                   */
+	FILE_ID_22	   ,    /*   broadcastKey802_1x       */
+	FILE_ID_23	   ,    /*   broadcastKeyNone         */
+	FILE_ID_24	   ,    /*   broadcastKeySM           */
+	FILE_ID_25	   ,    /*   conn                     */
+	FILE_ID_26	   ,    /*   connIbss                 */
+	FILE_ID_27	   ,    /*   connInfra                */
+	FILE_ID_28	   ,    /*   keyDerive                */
+	FILE_ID_29	   ,    /*   keyDeriveAes             */
+	FILE_ID_30	   ,    /*   keyDeriveCkip            */
+	FILE_ID_31	   ,    /*   keyDeriveTkip            */
+	FILE_ID_32	   ,    /*   keyDeriveWep             */
+	FILE_ID_33	   ,    /*   keyParser                */
+	FILE_ID_34	   ,    /*   keyParserExternal        */
+	FILE_ID_35	   ,    /*   keyParserWep             */
+	FILE_ID_36	   ,    /*   mainKeysSm               */
+	FILE_ID_37	   ,    /*   mainSecKeysOnly          */
+	FILE_ID_38	   ,    /*   mainSecNull              */
+	FILE_ID_39	   ,    /*   mainSecSm                */
+	FILE_ID_40	   ,    /*   rsn                      */
+	FILE_ID_41	   ,    /*   sme                      */
+	FILE_ID_42	   ,    /*   smeSelect                */
+	FILE_ID_43	   ,    /*   smeSm                    */
+	FILE_ID_44	   ,    /*   unicastKey802_1x         */
+	FILE_ID_45	   ,    /*   unicastKeyNone           */
+	FILE_ID_46	   ,    /*   unicastKeySM             */
+	FILE_ID_47	   ,    /*   CmdDispatcher            */
+	FILE_ID_48	   ,    /*   CmdHndlr                 */
+	FILE_ID_49	   ,    /*   DrvMain                  */
+	FILE_ID_50	   ,    /*   EvHandler                */
+	FILE_ID_51	   ,    /*   Ctrl                     */
+	FILE_ID_52	   ,    /*   GeneralUtil              */
+	FILE_ID_53	   ,    /*   RateAdaptation           */
+	FILE_ID_54	   ,    /*   rx                       */
+	FILE_ID_55	   ,    /*   TrafficMonitor           */
+	FILE_ID_56	   ,    /*   txCtrl                   */
+	FILE_ID_57	   ,    /*   txCtrlParams             */
+	FILE_ID_58	   ,    /*   txCtrlServ               */
+	FILE_ID_59	   ,    /*   TxDataClsfr              */
+	FILE_ID_60	   ,    /*   txDataQueue              */
+	FILE_ID_61	   ,    /*   txMgmtQueue              */
+	FILE_ID_62	   ,    /*   txPort                   */
+	FILE_ID_63	   ,    /*   assocSM                  */
+	FILE_ID_64	   ,    /*   authSm                   */
+	FILE_ID_65	   ,    /*   currBss                  */
+	FILE_ID_66	   ,    /*   healthMonitor            */
+	FILE_ID_67	   ,    /*   mlmeBuilder              */
+	FILE_ID_68	   ,    /*   mlmeParser               */
+	FILE_ID_69	   ,    /*   mlmeSm                   */
+	FILE_ID_70	   ,    /*   openAuthSm               */
+	FILE_ID_71	   ,    /*   PowerMgr                 */
+	FILE_ID_72	   ,    /*   PowerMgrDbgPrint         */
+	FILE_ID_73	   ,    /*   PowerMgrKeepAlive        */
+	FILE_ID_74	   ,    /*   qosMngr                  */
+	FILE_ID_75	   ,    /*   roamingInt               */
+	FILE_ID_76	   ,    /*   ScanCncn                 */
+	FILE_ID_77	   ,    /*   ScanCncnApp              */
+	FILE_ID_78	   ,    /*   ScanCncnOsSm             */
+	FILE_ID_79	   ,    /*   ScanCncnSm               */
+	FILE_ID_80	   ,    /*   ScanCncnSmSpecific       */
+	FILE_ID_81	   ,    /*   scanResultTable          */
+	FILE_ID_82	   ,    /*   scr                      */
+	FILE_ID_83	   ,    /*   sharedKeyAuthSm          */
+	FILE_ID_84	   ,    /*   siteHash                 */
+	FILE_ID_85	   ,    /*   siteMgr                  */
+	FILE_ID_86	   ,    /*   StaCap                   */
+	FILE_ID_87	   ,    /*   systemConfig             */
+	FILE_ID_88	   ,    /*   templates                */
+	FILE_ID_89	   ,    /*   trafficAdmControl        */
+	FILE_ID_90	   ,    /*   CmdBld                   */
+	FILE_ID_91	   ,    /*   CmdBldCfg                */
+	FILE_ID_92	   ,    /*   CmdBldCfgIE              */
+	FILE_ID_93	   ,    /*   CmdBldCmd                */
+	FILE_ID_94	   ,    /*   CmdBldCmdIE              */
+	FILE_ID_95	   ,    /*   CmdBldItr                */
+	FILE_ID_96	   ,    /*   CmdBldItrIE              */
+	FILE_ID_97	   ,    /*   CmdQueue                 */
+	FILE_ID_98	   ,    /*   RxQueue                  */
+	FILE_ID_99	   ,    /*   txCtrlBlk                */
+	FILE_ID_100	   ,    /*   txHwQueue                */
+	FILE_ID_101	   ,    /*   CmdMBox                  */
+	FILE_ID_102	   ,    /*   eventMbox                */
+	FILE_ID_103	   ,    /*   fwDebug                  */
+	FILE_ID_104	   ,    /*   FwEvent                  */
+	FILE_ID_105	   ,    /*   HwInit                   */
+	FILE_ID_106	   ,    /*   RxXfer                   */
+	FILE_ID_107	   ,    /*   txResult                 */
+	FILE_ID_108	   ,    /*   txXfer                   */
+	FILE_ID_109	   ,    /*   MacServices              */
+	FILE_ID_110	   ,    /*   MeasurementSrv           */
+	FILE_ID_111	   ,    /*   measurementSrvDbgPrint   */
+	FILE_ID_112	   ,    /*   MeasurementSrvSM         */
+	FILE_ID_113	   ,    /*   PowerSrv                 */
+	FILE_ID_114	   ,    /*   PowerSrvSM               */
+	FILE_ID_115	   ,    /*   ScanSrv                  */
+	FILE_ID_116	   ,    /*   ScanSrvSM                */
+	FILE_ID_117	   ,    /*   TWDriver                 */
+	FILE_ID_118	   ,    /*   TWDriverCtrl             */
+	FILE_ID_119	   ,    /*   TWDriverRadio            */
+	FILE_ID_120	   ,    /*   TWDriverTx               */
+	FILE_ID_121	   ,    /*   TwIf                     */
+	FILE_ID_122	   ,    /*   SdioBusDrv               */
+	FILE_ID_123	   ,    /*   TxnQueue                 */
+	FILE_ID_124	   ,    /*   WspiBusDrv               */
+	FILE_ID_125	   ,    /*   context                  */
+	FILE_ID_126	   ,    /*   freq                     */
+	FILE_ID_127	   ,    /*   fsm                      */
+	FILE_ID_128	   ,    /*   GenSM                    */
+	FILE_ID_129	   ,    /*   mem                      */
+	FILE_ID_130	   ,    /*   queue                    */
+	FILE_ID_131	   ,    /*   rate                     */
+	FILE_ID_132	   ,    /*   report                   */
+	FILE_ID_133	   ,    /*   stack                    */
+	FILE_ID_134	   ,
+	FILE_ID_135		,
+	FILE_ID_136		,
+	FILE_ID_137		,
+	FILE_ID_138		,
+	FILE_ID_139		,
+	FILE_ID_140		,
+	FILE_ID_141		,
+	FILE_ID_142		,
+	FILE_ID_143		,
+	FILE_ID_144		,
+	FILE_ID_145		,
+	FILE_ID_146		,
+	FILE_ID_147		,
+	FILE_ID_148		,
+
+	REPORT_FILES_NUM	/*   Number of files with trace reports   */
+
+} EReportFiles;
+
+
+/************************************/      
+/*      Report Severity values      */
+/************************************/
+
+/** \enum EReportSeverity
+ * \brief Report Severity Types
+ * 
+ * \par Description
+ * All available severity Levels of the events which are reported to user.\n
+ * 
+ * \sa
+ */
+typedef enum
+{
+    REPORT_SEVERITY_INIT           =  1,	/**< Init Level (event happened during initialization)			*/
+    REPORT_SEVERITY_INFORMATION    =  2,	/**< Information Level											*/
+    REPORT_SEVERITY_WARNING        =  3,	/**< Warning Level												*/
+    REPORT_SEVERITY_ERROR          =  4,	/**< Error Level (error accored)  		 						*/
+    REPORT_SEVERITY_FATAL_ERROR    =  5,	/**< Fatal-Error Level (fatal-error accored)					*/
+    REPORT_SEVERITY_SM             =  6,	/**< State-Machine Level (event happened in State-Machine)		*/
+    REPORT_SEVERITY_CONSOLE        =  7,	/**< Consol Level (event happened in Consol) 					*/
+    REPORT_SEVERITY_MAX            = REPORT_SEVERITY_CONSOLE + 1	/**< Maximum number of report severity levels	*/
+
+} EReportSeverity;
+
+/** \struct TReport
+ * \brief Report Module Object
+ * 
+ * \par Description
+ * All the Databases and other parameters which are needed for reporting messages to user
+ * 
+ * \sa
+ */
+typedef struct 
+{
+    TI_HANDLE       hOs;												/**< Handle to Operating System Object																									*/
+    TI_UINT8        aSeverityTable[REPORT_SEVERITY_MAX];				/**< Severities Table: Table which holds for each severity level a flag which indicates whether the severity is enabled for reporting	*/
+	char            aSeverityDesc[REPORT_SEVERITY_MAX][MAX_STRING_LEN];	/**< Severities Descriptors Table: Table which holds for each severity a string of its name, which is used in severity's reported messages		*/
+    TI_UINT8        aFileEnable[REPORT_FILES_NUM];					    /**< Files table indicating per file if it is enabled for reporting	 */
+
+#ifdef PRINTF_ROLLBACK
+    char            aFileName[REPORT_FILES_NUM][MAX_STRING_LEN];	    /**< Files names table inserted in the file's reported messages		 */
+#endif
+
+} TReport;
+
+/** \struct TReportParamInfo
+ * \brief Report Parameter Information
+ * 
+ * \par Description
+ * Struct which defines all the Databases and other parameters which are needed
+ * for reporting messages to user. 
+ * The actual Content of the Report Parameter Could be one of the followed (held in union): 
+ * Severety Table | Module Table | Enable/Disable indication of debug module usage
+ * 
+ * \sa	EExternalParam, ETwdParam
+ */
+typedef struct
+{
+    TI_UINT32       paramType;								/**< The reported parameter type - one of External Parameters (which includes Set,Get, Module, internal number etc.)
+															* of Report Module. Used by user for Setting or Getting Report Module Paramters, for exaple Set/Get severety table
+															* to/from Report Module
+															*/
+    TI_UINT32       paramLength;							/**< Length of reported parameter	*/
+
+    union
+    {
+        TI_UINT8    aSeverityTable[REPORT_SEVERITY_MAX];	/**< Table which holds severity flag for every available LOG severity level. 
+															* This flag indicates for each severity - whether it is enabled for Logging or not.	
+															* User can Set/Get this Tabel
+															*/
+        TI_UINT8    aFileEnable[REPORT_FILES_NUM]; 		/**< Table which holds file flag for every available LOG file.
+															* This flag indicates for each file - whether it is enabled for Logging or not.				
+															* User can Set/Get this Tabel
+															*/															
+        TI_UINT32   uReportPPMode;							/**< Used by user for Indicating if Debug Module should be enabled/disabled																	*/
+
+    } content;
+
+} TReportParamInfo;
+
+/** \struct TReportInitParams
+ * \brief Report Init Parameters
+ * 
+ * \par Description
+ * Struct which defines all the Databases needed for init and set the defualts of the Report Module.
+ * 
+ */
+typedef struct
+{
+    /* Note: The arrays sizes are aligned to 4 byte to avoid padding added by the compiler! */
+	TI_UINT8	    aSeverityTable[(REPORT_SEVERITY_MAX + 3) & ~3];	/**< Table in the size of all available LOG severity levels which indicates for each severity - whether it is enabled for Logging or not.	*/
+	TI_UINT8   aFileEnable   [(REPORT_FILES_NUM    + 3) & ~3];	/**< Table in the size of all available LOG files which indicates for each file - whether it is enabled for Logging or not				*/				
+
+} TReportInitParams;
+
+
+
+/****************************/
+/* report module Macros		*/
+/****************************/
+
+/* The report mechanism is like that:
+    Each file has a report flag. Each severity has a severity flag.
+    Only if bits are enabled, the message is printed */
+/* The modules which have their report flag enable are indicated by a bit map in the reportModule 
+    variable contained in the report handle*/
+/* The severities which have are enabled are indicated by a bit map in the reportSeverity
+    variable contained in the report handle*/
+/* general trace messages */
+#ifndef PRINTF_ROLLBACK
+
+#define TRACE0(hReport, level, str) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 0); } } while(0)
+
+#define TRACE1(hReport, level, str, p1) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 1, (TI_UINT32)p1); } } while(0)
+
+#define TRACE2(hReport, level, str, p1, p2) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 2, (TI_UINT32)p1, (TI_UINT32)p2); } } while(0)
+
+#define TRACE3(hReport, level, str, p1, p2, p3) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 3, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3); } } while(0)
+
+#define TRACE4(hReport, level, str, p1, p2, p3, p4) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 4, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4); } } while(0)
+
+#define TRACE5(hReport, level, str, p1, p2, p3, p4, p5) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 5, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5); } } while(0)
+
+#define TRACE6(hReport, level, str, p1, p2, p3, p4, p5, p6) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 6, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6); } } while(0)
+
+#define TRACE7(hReport, level, str, p1, p2, p3, p4, p5, p6, p7) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 7, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7); } } while(0)
+
+#define TRACE8(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 8, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8); } } while(0)
+
+#define TRACE9(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 9, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9); } } while(0)
+
+#define TRACE10(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 10, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10); } } while(0)
+
+#define TRACE11(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 11, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11); } } while(0)
+
+#define TRACE12(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 12, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12); } } while(0)
+
+#define TRACE13(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 13, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13); } } while(0)
+
+#define TRACE14(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 14, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14); } } while(0)
+
+#define TRACE15(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 15, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15); } } while(0)
+
+#define TRACE16(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 16, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16); } } while(0)
+
+#define TRACE17(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 17, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16, (TI_UINT32)p17); } } while(0)
+
+#define TRACE18(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 18, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16, (TI_UINT32)p17, (TI_UINT32)p18); } } while(0)
+
+#define TRACE19(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 19, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16, (TI_UINT32)p17, (TI_UINT32)p18, (TI_UINT32)p19); } } while(0)
+
+#define TRACE20(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 20, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16, (TI_UINT32)p17, (TI_UINT32)p18, (TI_UINT32)p19, (TI_UINT32)p20); } } while(0)
+
+#define TRACE21(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 21, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16, (TI_UINT32)p17, (TI_UINT32)p18, (TI_UINT32)p19, (TI_UINT32)p20, (TI_UINT32)p21); } } while(0)
+
+#define TRACE22(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 22, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16, (TI_UINT32)p17, (TI_UINT32)p18, (TI_UINT32)p19, (TI_UINT32)p20, (TI_UINT32)p21, (TI_UINT32)p22); } } while(0)
+
+#define TRACE25(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 22, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16, (TI_UINT32)p17, (TI_UINT32)p18, (TI_UINT32)p19, (TI_UINT32)p20, (TI_UINT32)p21, (TI_UINT32)p22, (TI_UINT32)p23, (TI_UINT32)p24, (TI_UINT32)p25); } } while(0)
+
+#define TRACE31(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_Trace((((TReport *)hReport)->hOs), level, __FILE_ID__, __LINE__, 22, (TI_UINT32)p1, (TI_UINT32)p2, (TI_UINT32)p3, (TI_UINT32)p4, (TI_UINT32)p5, (TI_UINT32)p6, (TI_UINT32)p7, (TI_UINT32)p8, (TI_UINT32)p9, (TI_UINT32)p10, (TI_UINT32)p11, (TI_UINT32)p12, (TI_UINT32)p13, (TI_UINT32)p14, (TI_UINT32)p15, (TI_UINT32)p16, (TI_UINT32)p17, (TI_UINT32)p18, (TI_UINT32)p19, (TI_UINT32)p20, (TI_UINT32)p21, (TI_UINT32)p22, (TI_UINT32)p23, (TI_UINT32)p24, (TI_UINT32)p25, (TI_UINT32)p26, (TI_UINT32)p27, (TI_UINT32)p28, (TI_UINT32)p29, (TI_UINT32)p30, (TI_UINT32)p31); } } while(0)
+
+
+#else /* PRINTF_ROLLBACK */
+
+#define TRACE0(hReport, level, str) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str); } } while(0)
+
+#define TRACE1(hReport, level, str, p1) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1); } } while(0)
+
+#define TRACE2(hReport, level, str, p1, p2) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2); } } while(0)
+
+#define TRACE3(hReport, level, str, p1, p2, p3) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3); } } while(0)
+
+#define TRACE4(hReport, level, str, p1, p2, p3, p4) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4); } } while(0)
+
+#define TRACE5(hReport, level, str, p1, p2, p3, p4, p5) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5); } } while(0)
+
+#define TRACE6(hReport, level, str, p1, p2, p3, p4, p5, p6) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6); } } while(0)
+
+#define TRACE7(hReport, level, str, p1, p2, p3, p4, p5, p6, p7) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7); } } while(0)
+
+#define TRACE8(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8); } } while(0)
+
+#define TRACE9(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9); } } while(0)
+
+#define TRACE10(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); } } while(0)
+
+#define TRACE11(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); } } while(0)
+
+#define TRACE12(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12); } } while(0)
+
+#define TRACE13(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13); } } while(0)
+
+#define TRACE14(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); } } while(0)
+
+#define TRACE15(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); } } while(0)
+
+#define TRACE16(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16); } } while(0)
+
+#define TRACE17(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17); } } while(0)
+
+#define TRACE18(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18); } } while(0)
+
+#define TRACE19(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19); } } while(0)
+
+#define TRACE20(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20); } } while(0)
+
+#define TRACE21(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21); } } while(0)
+
+#define TRACE22(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22); } } while(0)
+
+#define TRACE25(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25); } } while(0)
+
+#define TRACE31(hReport, level, str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p26, p27, p28, p29, p30, p31) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[level]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ os_printf ("%s, %s:", ((TReport *)hReport)->aFileName[__FILE_ID__], ((TReport *)hReport)->aSeverityDesc[level]); os_printf (str, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22, p23, p24, p25, p27, p27, p28, p29, p30, p31); } } while(0)
+
+#endif /* #ifdef PRINTF_ROLLBACK */
+
+
+/****************************/
+/* report module Macros		*/
+/****************************/
+
+/* The report mechanism is like that:
+Each file has a report flag. Each severity has a severity flag.
+Only if bits are enabled, the message is printed */
+/* The modules which have their report flag enable are indicated by a bit map in the reportModule 
+variable contained in the report handle*/
+/* The severities which have are enabled are indicated by a bit map in the reportSeverity
+variable contained in the report handle*/
+
+#ifdef REPORT_LOG
+
+/** \def WLAN_OS_REPORT
+ * \brief Macro which writes a message to user via specific Operating System printf.
+ * E.g. print is done using the relevant used OS printf method.
+ */
+#define WLAN_OS_REPORT(msg)                                           \
+	do { os_printf msg;} while(0)
+
+
+#ifdef INIT_MESSAGES
+/** \def WLAN_INIT_REPORT
+ * \brief Macro which writes a message to user via specific Operating System printf.
+ * E.g. print is done using the relevant used OS printf method.
+ */
+#define WLAN_INIT_REPORT(msg)                                         \
+    do { os_printf msg;} while(0)
+#else
+/** \def WLAN_INIT_REPORT
+ * \brief Macro which writes a message to user via specific Operating System printf.
+ * E.g. print is done using the relevant used OS printf method.
+ */
+#define WLAN_INIT_REPORT(msg) 
+#endif
+
+#define TRACE_INFO_HEX(hReport, data, datalen) \
+	do { if (hReport && (((TReport *)hReport)->aSeverityTable[REPORT_SEVERITY_INFORMATION]) && (((TReport *)hReport)->aFileEnable[__FILE_ID__])) \
+{ report_PrintDump (data, datalen); } } while(0)
+
+#else   /* REPORT_LOG */
+
+/* NOTE: Keep a dummy report function call to treat compilation warnings */
+
+/** \def WLAN_OS_REPORT
+ * \brief Dummy macro: Nothing is done 
+ */
+#define WLAN_OS_REPORT(msg)                                           \
+    do { } while (0)
+
+/** \def WLAN_INIT_REPORT
+ * \brief Dummy macro: Nothing is done 
+ */
+#define WLAN_INIT_REPORT(msg)                                         \
+    do { } while (0)
+
+                            
+#define TRACE_INFO_HEX(hReport, data, datalen) \
+   do { } while (0)
+
+#endif  /* REPORT_LOG */
+
+
+/****************************/
+/* report module prototypes */
+/****************************/
+
+/** \brief  Create Report Module Object
+ * \param  hOs   			- OS module object handle
+ * \return Handle to the report module on success, NULL otherwise
+ * 
+ * \par Description
+ * Report module creation function, called by the config mgr in creation phase	\n
+ * performs the following:	\n
+ *	-   Allocate the report handle
+ */ 
+TI_HANDLE report_Create (TI_HANDLE hOs);
+/** \brief  Set Report Module Defaults
+ * \param  hReport   	- Report module object handle
+ * \param  pInitParams	- Pointer to Input Init Parameters
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Report module configuration function, called by the config mgr in configuration phase	\n
+ * performs the following:	\n
+ *	-   Reset & init local variables
+ *	-   Resets all report modules bits
+ *	-   Resets all severities bits
+ *	-   Init the description strings * 
+ */ 
+TI_STATUS report_SetDefaults            (TI_HANDLE hReport, TReportInitParams *pInitParams);
+/** \brief  Unload Report Module
+ * \param  hReport   	- Report module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Report Module unload function, called by the config mgr in the unload phase	\n
+ * performs the following:	\n
+ *	-   Free all memory allocated by the module		
+ */ 
+TI_STATUS report_Unload                 (TI_HANDLE hReport);
+/** \brief  Set Report Module
+ * \param  hReport   	- Report module object handle
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Enables the relevant module for reporting -  according to the received module index 
+ */ 
+TI_STATUS report_SetReportModule        (TI_HANDLE hReport, TI_UINT8 module_index);
+/** \brief  Clear Report Module
+ * \param  hReport   	- Report module object handle
+ * \param  module_index	- Index of file to be disable for reporting 
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Disables the relevant module for reporting -  according to the received module index 
+ */ 
+TI_STATUS report_ClearReportModule      (TI_HANDLE hReport, TI_UINT8 module_index);
+/** \brief  Get Report files Table
+ * \param  hReport   	- Report module object handle
+ * \param  pFiles		- Pointer to output files Table
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Returns the Modules Table (the table which holds Modules reporting indication) held in Report Module Object
+ */ 
+TI_STATUS report_GetReportFilesTable    (TI_HANDLE hReport, TI_UINT8 *pFiles); 
+/** \brief  Set Report Files Table
+ * \param  hReport   	- Report module object handle
+ * \param  pFiles		- Pointer to input files Table
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Updates the Modules Table: copies the input Modules Table (the table which holds Modules reporting indication) 
+ * to the Modules Table which is held in Report Module Object
+ */ 
+TI_STATUS report_SetReportFilesTable    (TI_HANDLE hReport, TI_UINT8 *pFiles); 
+/** \brief  Get Report Severity Table
+ * \param  hReport   	- Report module object handle
+ * \param  pSeverities	- Pointer to input Severity Table
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Returns the Severities Table (the table which holds Severities reporting indication) held in Report Module Object
+ */ 
+TI_STATUS report_GetReportSeverityTable (TI_HANDLE hReport, TI_UINT8 *pSeverities);
+/** \brief  Set Report Severity Table
+ * \param  hReport   	- Report module object handle
+ * \param  pSeverities	- Pointer to input Severity Table
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Updates the Severities Table: copies the input Severities Table (the table which holds Severities reporting indication) 
+ * to the Severities Table which is held in Report Module Object
+ */ 
+TI_STATUS report_SetReportSeverityTable (TI_HANDLE hReport, TI_UINT8 *pSeverities);
+/** \brief  Set Report Parameters
+ * \param  hReport   	- Report module object handle
+ * \param  pParam		- Pointer to input Report Parameters Information
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Report set param function sets parameter/s to Report Module Object. 
+ * Called by the following:
+ *	-   configuration Manager in order to set a parameter/s from the OS abstraction layer
+ *	-   Form inside the driver 
+ */ 
+TI_STATUS report_SetParam               (TI_HANDLE hReport, TReportParamInfo *pParam);                   
+/** \brief  Get Report Parameters
+ * \param  hReport   	- Report module object handle
+ * \param  pParam		- Pointer to output Report Parameters Information
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Report get param function gets parameter/s from Report Module Object. 
+ * Called by the following:
+ *	-   configuration Manager in order to get a parameter/s from the OS abstraction layer
+ *	-   from inside the driver 
+ */ 
+TI_STATUS report_GetParam               (TI_HANDLE hReport, TReportParamInfo *pParam); 
+/** \brief Report Dump
+ * \param  pBuffer  - Pointer to input HEX buffer
+ * \param  pString	- Pointer to output string
+ * \param  size		- size of output string
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Converts hex buffer to string buffer
+ * NOTE:	1. The caller has to make sure that the string size is at lease: ((Size * 2) + 1)
+ * 	      	2. A string terminator is inserted into lase char of the string 
+ */ 
+TI_STATUS report_Dump 					(TI_UINT8 *pBuffer, char *pString, TI_UINT32 size);
+/** \brief Report Print Dump
+ * \param  pData  	- Pointer to input data buffer
+ * \param  datalen	- size of input data buffer
+ * \return TI_OK on success or TI_NOK on failure
+ * 
+ * \par Description
+ * Performs HEX dump of input Data buffer. Used for debug only! 
+ */ 
+TI_STATUS report_PrintDump 				(TI_UINT8 *pData, TI_UINT32 datalen);
+
+/** \brief Sets bRedirectOutputToLogger
+* \param  value  	    - True if to direct output to remote PC
+* \param  hEvHandler	- Event handler
+*/ 
+void os_setDebugOutputToLogger(TI_BOOL value);
+
+
+#endif /* __REPORT_H__ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/stack.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,168 @@
+/*
+ * stack.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 stack.c
+ *  \brief Seport module API
+ *
+ *  \see stack.h
+ */
+
+/***************************************************************************/
+/*                                                                         */
+/*    MODULE:   stack.c                                                    */
+/*    PURPOSE:  Stack module implementation                                */
+/*                                                                         */
+/***************************************************************************/
+
+
+#define __FILE_ID__  FILE_ID_133
+#include "tidef.h"
+#include "osApi.h"
+#include "stack.h"
+
+
+/**
+ * \date 30-May-2006\n
+ * \brief initialize stack object
+ *
+ * Function Scope \e Public.\n
+ * \param pStack    - pointer to the Stack_t structure\n
+ * \param hOS       - handle to the OS object\n
+ * \param uElemSize - size of a one stack element\n
+ * \param uDep      - stack depth\n
+ * \param pBuf      - pointer to the stack buffer; if NULL a memory for the stack buffer will be dynamically allocated\n
+ * \param fCpy      - pointer to function copying the stack element; if NULL a default copy function will be used\n
+ * \return 0 - on success, -1 - on failure\n
+ */
+unsigned stackInit 
+(
+    Stack_t   *pStack, 
+    TI_HANDLE  hOs,
+    unsigned   uElemSize, 
+    unsigned   uDep, 
+    void      *pBuf, 
+    void     (*fCpy) (TI_HANDLE, void*, void*, unsigned)
+)
+{
+    pStack->hOs       = hOs;
+    pStack->uPtr      = 0;
+    pStack->uElemSize = uElemSize;
+    pStack->uDep      = uDep * uElemSize;
+
+    if (pBuf)
+    {
+        pStack->pBuf  = pBuf;
+        pStack->bBuf  = 0;
+    }
+
+    else
+    {
+        pStack->pBuf  = _os_memoryAlloc (hOs, pStack->uDep);
+        pStack->bBuf  = TI_TRUE;
+    }
+
+    if (fCpy)
+        pStack->fCpy  = fCpy;
+    else
+        pStack->fCpy  = os_memoryCopy; 
+
+    return 0; 
+}
+
+
+/**
+ * \date 30-May-2006\n
+ * \brief destroy stack object
+ *
+ * Function Scope \e Public.\n
+ * \param pStack    - pointer to the Stack_t structure\n
+ * \return 0 - on success, -1 - on failure\n
+ */
+unsigned stackDestroy (Stack_t *pStack)
+{
+    if (pStack->bBuf)
+        _os_memoryFree (pStack->hOs, pStack->pBuf, pStack->uDep);
+
+    return 0;
+}
+
+
+/**
+ * \date 30-May-2006\n
+ * \brief destroy stack object
+ *
+ * Function Scope \e Public.\n
+ * \param pStack    - pointer to the Stack_t structure\n
+ * \param pVal      - the pointer to the pushed value\n
+ * \return 0 - on success, -1 - on failure\n
+ */
+unsigned stackPush (Stack_t *pStack, void *pVal)
+{
+    if (pStack->uPtr < pStack->uDep)
+    {
+        pStack->fCpy (pStack->hOs, (unsigned char*)pStack->pBuf + pStack->uPtr, pVal, pStack->uElemSize);
+        pStack->uPtr += pStack->uElemSize;
+
+        return 0;
+    }
+
+    return -1;
+}
+
+
+/**
+ * \date 30-May-2006\n
+ * \brief destroy stack object
+ *
+ * Function Scope \e Public.\n
+ * \param pStack    - pointer to the Stack_t structure\n
+ * \param pVal      - the pointer to the popped value\n
+ * \return 0 - on success, -1 - on failure\n
+ */
+unsigned stackPop (Stack_t *pStack, void *pVal)
+{
+    if (pStack->uPtr > 0)
+    {
+        pStack->uPtr -= pStack->uElemSize;
+        pStack->fCpy (pStack->hOs, pVal, (unsigned char*)pStack->pBuf + pStack->uPtr, pStack->uElemSize);
+
+        return 0;
+    }
+
+    return -1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/stack.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,78 @@
+/*
+ * stack.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 stack.h
+ *  \brief Seport module API
+ *
+ *  \see stack.c
+ */
+
+/***************************************************************************/
+/*                                                                         */
+/*    MODULE:   stack.h                                                    */
+/*    PURPOSE:  Stack module internal header API                           */
+/*                                                                         */
+/***************************************************************************/
+
+
+#ifndef STACK_H
+#define STACK_H
+
+
+typedef struct _Stack_t
+{
+    TI_HANDLE   hOs;
+    void       *pBuf;
+    unsigned    uPtr;
+    unsigned    uDep;
+    unsigned    uElemSize;
+    TI_BOOL        bBuf;
+
+    void      (*fCpy) (TI_HANDLE, void*, void*, unsigned);
+
+} Stack_t;
+
+
+
+unsigned stackInit    (Stack_t *pStack, TI_HANDLE hOs, unsigned uElemSize, unsigned uDep, void *pBuf, void (*fCpy) (TI_HANDLE, void*, void*, unsigned));
+unsigned stackDestroy (Stack_t *pStack);
+unsigned stackPush    (Stack_t *pStack, void *pVal);
+unsigned stackPop     (Stack_t *pStack, void *pVal);
+
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/tiQosTypes.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,366 @@
+/*
+ * tiQosTypes.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:      tiQosTypes.h*/
+/**/
+/* Purpose:     */
+/**/
+/*--------------------------------------------------------------------------*/
+
+#ifndef TI_QOS_TYPES_H
+#define TI_QOS_TYPES_H
+
+
+#include "TWDriver.h"
+
+/*
+ * This enum defines the protocol modes of the QOS management object
+ */
+typedef enum
+{
+    QOS_WME,
+    QOS_NONE
+
+} EQosProtocol;
+
+
+/*
+ * This enum includes the header converting modes configured to dataCtrl object.
+ */
+typedef enum
+{
+    HDR_CONVERT_NONE,
+    HDR_CONVERT_QOS,
+    HDR_CONVERT_LEGACY
+
+} EHeaderConvertMode;
+
+
+typedef enum
+{
+    QOS_AC_BE = 0,
+    QOS_AC_BK,
+    QOS_AC_VI,
+    QOS_AC_VO,
+    QOS_HIGHEST_AC_INDEX = QOS_AC_VO
+
+} EAcTrfcType;
+
+
+#define FIRST_AC_INDEX                  QOS_AC_BE
+#define AC_PARAMS_MAX_TSID              15
+#define MAX_APSD_CONF                   0xffff
+
+
+typedef enum
+{
+    DROP_NEW_PACKET = 0,
+    DROP_OLD_PACKET
+
+} EQOverflowPolicy;
+
+
+typedef enum
+{
+    AC_NOT_ADMITTED,
+    AC_WAIT_ADMISSION,
+    AC_ADMITTED
+
+} ETrafficAdmState;
+
+
+/* 
+ * This enum defines the admission state configured to dataCtrl object.
+ */
+typedef enum
+{
+    ADMISSION_NOT_REQUIRED,
+    ADMISSION_REQUIRED
+
+} EAdmissionState;
+
+
+typedef struct
+{
+    /* Power save mode */
+    TI_UINT8                PsMode;             
+    TI_UINT16               TxQueueSize;
+    TI_UINT8                QueueIndex;
+    EQOverflowPolicy        QueueOvFlowPolicy;
+    TI_UINT8                ackPolicy;
+    TI_UINT32               MsduLifeTime;
+
+} TAcTrfcCtrl;
+
+typedef struct
+{
+    /* header converting mode */
+    EHeaderConvertMode      headerConverMode;                           
+    /* flag for converting zero tags */
+    TI_BOOL                 convertTagZeroFrames;                       
+    /* AC admission state */
+    ETrafficAdmState        admissionState;                             
+    /* AC admission is mandatory */
+    EAdmissionState         admissionRequired;                          
+    /* Tag to AC classification */
+    EAcTrfcType             tag_ToAcClsfrTable[MAX_NUM_OF_802_1d_TAGS]; 
+
+} TQosParams;
+
+
+typedef struct
+{
+    TAcTrfcCtrl             acTrfcCtrl;
+    TQosParams              qosParams;
+    TI_UINT8                *tsrsArr;
+    TI_UINT8                tsrsArrLen;
+    TI_UINT8                acID;
+
+} TTxDataQosParams;
+
+
+typedef struct _OS_802_11_QOS_PARAMS
+{
+    TI_UINT32               acID;
+    TI_UINT32               MaxLifeTime;
+    TI_UINT32               PSDeliveryProtocol;
+	TI_UINT32				VoiceDeliveryProtocol;
+
+} OS_802_11_QOS_PARAMS;
+
+
+typedef struct  
+{
+    TI_UINT32               psPoll;
+    TI_UINT32               UPSD;
+
+} OS_802_11_QOS_RX_TIMEOUT_PARAMS;
+
+
+typedef struct _OS_802_11_AC_QOS_PARAMS
+{
+    TI_UINT32               uAC;
+    TI_UINT32               uAssocAdmissionCtrlFlag;
+    TI_UINT32               uAIFS;
+    TI_UINT32               uCwMin;
+    TI_UINT32               uCwMax;
+    TI_UINT32               uTXOPLimit;
+
+} OS_802_11_AC_QOS_PARAMS;
+
+
+typedef struct _OS_802_11_AP_QOS_CAPABILITIES_PARAMS
+{
+    TI_UINT32               uQOSFlag;
+    TI_UINT32               uAPSDFlag;
+
+} OS_802_11_AP_QOS_CAPABILITIES_PARAMS;
+
+
+typedef struct _OS_802_11_QOS_TSPEC_PARAMS
+{
+    TI_UINT32               uUserPriority;
+    TI_UINT32               uNominalMSDUsize; /* in bytes */
+    TI_UINT32               uMeanDataRate;        /* bits per second */
+    TI_UINT32               uMinimumPHYRate;  /* 1,2,5,6,9,11,12,18,......*/
+    TI_UINT32               uSurplusBandwidthAllowance;
+    TI_UINT32               uAPSDFlag;
+    TI_UINT32               uMediumTime;
+    TI_UINT32               uReasonCode;
+
+} OS_802_11_QOS_TSPEC_PARAMS;
+
+
+typedef struct _OS_802_11_QOS_DELETE_TSPEC_PARAMS
+{
+    TI_UINT32               uUserPriority;
+    TI_UINT32               uReasonCode;
+} OS_802_11_QOS_DELETE_TSPEC_PARAMS;
+
+
+typedef struct _OS_802_11_QOS_DESIRED_PS_MODE
+{
+    TI_UINT32               uDesiredPsMode;
+    TI_UINT32               uDesiredWmeAcPsMode[QOS_HIGHEST_AC_INDEX + 1];
+
+} OS_802_11_QOS_DESIRED_PS_MODE;
+
+
+/* When this value is added to reason code in TSPEC events, it indicates a TSPEC response which was unexpected at the time */
+/* For example, a TSPEC response arrives after a TSPEC timeout */
+#define TSPEC_RESPONSE_UNEXPECTED      0x1000   
+
+
+typedef enum
+{
+    ADDTS_RESPONSE_ACCEPT = 0,
+/*  ADDTS_RESPONSE_REJECT,  - according to the standard*/
+    ADDTS_RESPONSE_AP_PARAM_INVALID = 253,
+    ADDTS_RESPONSE_TIMEOUT = 254,
+    TSPEC_DELETED_BY_AP = 255
+
+} ETspecStatus;
+
+
+typedef struct _OS_802_11_AC_UPSD_STATUS_PARAMS
+{
+   TI_UINT32                uAC;
+   TI_UINT32                uCurrentUAPSDStatus;
+   TI_UINT32                pCurrentAdmissionStatus;
+
+} OS_802_11_AC_UPSD_STATUS_PARAMS;
+
+
+typedef struct _OS_802_11_THRESHOLD_CROSS_PARAMS
+{
+    TI_UINT32               uAC;
+    TI_UINT32               uHighThreshold;
+    TI_UINT32               uLowThreshold;
+
+} OS_802_11_THRESHOLD_CROSS_PARAMS;
+
+
+typedef struct OS_802_11_THRESHOLD_CROSS_INDICATION_PARAMS
+{
+    TI_UINT32               uAC;
+    TI_UINT32               uHighOrLowThresholdFlag;  /* According to thresholdCross_e enum */
+    TI_UINT32               uAboveOrBelowFlag;        /* According to thresholdCrossDirection_e enum */
+
+} OS_802_11_THRESHOLD_CROSS_INDICATION_PARAMS;
+
+
+typedef enum
+{
+    HIGH_THRESHOLD_CROSS,
+    LOW_THRESHOLD_CROSS
+
+} EThresholdCross;
+
+
+typedef enum
+{
+    CROSS_ABOVE,
+    CROSS_BELOW
+
+} EThresholdCrossDirection;
+
+
+typedef struct
+{
+   TI_UINT32                dstIpAddress;
+   TI_UINT32                dstPort;
+   TI_UINT32                PktTag;
+   TI_UINT32                userPriority;
+
+} TStreamTrafficProperties;
+
+
+typedef enum
+{
+   UPLINK_DIRECTION = 0,
+   DOWNLINK_DIRECTION = 1,
+   RESERVED_DIRECTION = 2,
+   BI_DIRECTIONAL = 3
+
+} EStreamDirection;
+
+
+/* classification algorithms: 
+  0) D-tag to D-tag
+  1) DSCP to D-tag
+  2) Destination port number to D-tag 
+  3) Destination IP&Port to D-tag
+*/
+typedef enum
+{
+    D_TAG_CLSFR    = 0,
+    DSCP_CLSFR     = 1,
+    PORT_CLSFR     = 2,
+    IPPORT_CLSFR   = 3,
+    CLSFR_MAX_TYPE = IPPORT_CLSFR
+
+} EClsfrType;
+
+
+
+/*************************/
+/*   classifier params   */
+/*************************/
+
+/* Destination IP address and port number */
+typedef struct 
+{
+    TI_UINT32               DstIPAddress;
+    TI_UINT16               DstPortNum;
+
+} TIpPort;
+
+/* Classification mapping table */
+typedef struct 
+{
+    union   
+    {
+        TIpPort             DstIPPort;  /* for destination IP&Port classifier*/
+        TI_UINT16           DstPortNum; /* for destination Port classifier*/
+        TI_UINT8            CodePoint;  /* for DSCP classifier*/
+    } Dscp;
+
+    TI_UINT8                DTag;
+
+} TClsfrTableEntry;
+
+/* number of classifier entries in the classification table */
+#define NUM_OF_CLSFR_TABLE_ENTRIES  16
+
+typedef struct
+{
+    EClsfrType              eClsfrType; /* The type of the classifier: D-tag, DSCP, Port or IP&Port */
+    TI_UINT32               uNumActiveEntries; /* The number of active entries in the classification table */
+    TClsfrTableEntry        ClsfrTable[NUM_OF_CLSFR_TABLE_ENTRIES]; /* Classification table - size changed from 15 to 16*/
+
+} TClsfrParams;
+
+typedef struct{
+	TI_UINT8                       voiceTspecConfigure;
+	TI_UINT8                       videoTspecConfigure;
+}TSpecConfigure;
+
+#endif /* TI_QOS_TYPES_H */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/tidef.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,427 @@
+/*
+ * tidef.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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 TIDEF_H
+#define TIDEF_H
+
+#include "osTIType.h"
+
+/** \file  tidef.h 
+ * \brief TI User Definitions APIs 
+ * \n\n
+ * Note: TI_ prefix implies TI wrapping of primitives which is used for partability.
+ * E.g. using these interfaces enables porting between different OS under these 
+ * interfaces without user notice.
+ * \n\n
+ */
+
+/**********************
+ *	Definitions
+ **********************/
+
+/**
+ * \def TI_FALSE
+ * \brief False value
+ */
+#define TI_FALSE                    0
+/**
+ * \def TI_TRUE
+ * \brief True value
+ */
+#define TI_TRUE                     1
+
+/**
+ * \def TI_OK
+ * \brief OK return value
+ */
+#define TI_OK                       0
+/**
+ * \def TI_NOK
+ * \brief NOT OK return value
+ */
+#define TI_NOK                      1
+/**
+ * \def TI_PENDING
+ * \brief Pending return value
+ */
+#define TI_PENDING					2
+/**
+ * \def MAC_ADDR_LEN
+ * \brief Length of Standart MAC address
+ */
+#define MAC_ADDR_LEN                6
+/**
+ * \def IP_V4_ADDR_LEN
+ * \brief Length of Standart IP V4 address
+ */
+#define REGISTER_SIZE		        4
+#define IP_V4_ADDR_LEN              4
+/**
+ * \def IP_V4_ADDR_LEN
+ * \brief Length of Standart IP V6 address
+ */
+#define IP_V6_ADDR_LEN              6
+
+/**********************
+ *	Macros
+ **********************/
+
+
+#ifndef TI_MAX
+/**
+ * \def TI_MAX
+ * \brief Macro which returns the maximum of two values
+ */
+#define TI_MAX(a,b)                 (((a) > (b)) ? (a) : (b))
+#endif
+
+#ifndef TI_MIN
+/**
+ * \def TI_MAX
+ * \brief Macro which returns the minimum of two values
+ */
+#define TI_MIN(a,b)                 (((a) < (b)) ? (a) : (b))
+#endif
+
+#ifndef NULL
+/**
+ * \def NULL
+ * \brief Macro which returns NULL
+ */
+#define NULL                        ((void *)0)
+#endif
+
+/**
+ * \def TI_VOIDCAST
+ * \brief Macro which Casts to void
+ */
+#ifndef TI_VOIDCAST 
+#define TI_VOIDCAST(p)             ((void)p)
+#endif
+
+
+#ifndef SIZE_ARR
+/**
+ * \def SIZE_ARR
+ * \brief Macro which returns number of elements in array a
+ */
+#define SIZE_ARR(a)                 (sizeof(a)/sizeof(a[0]))
+#endif
+
+
+#ifndef TI_FIELD_OFFSET
+/**
+ * \def TI_FIELD_OFFSET
+ * \brief Macro which returns a field offset from structure begine
+ */
+#define TI_FIELD_OFFSET(type,field)    ((TI_UINT32)(&(((type*)0)->field)))
+#endif                                 
+
+
+#ifndef TI_BIT
+#define TI_BIT(x)                   (1 << (x))
+#endif
+
+
+#ifndef IS_MASK_ON
+/**
+ * \def IS_MASK_ON
+ * \brief Macro which returns True if bitmask in field is on (==1) \n
+ * Otherwise returns False
+ */
+#define IS_MASK_ON(  field, bitmask ) (  (bitmask) == ( (field) &  (bitmask) ) )
+#endif
+
+#ifndef IS_MASK_OFF
+/**
+ * \def IS_MASK_OFF
+ * \brief Macro which returns True if bitmask in field is off (==0) \n
+ * Otherwise returns False
+ */
+#define IS_MASK_OFF( field, bitmask ) ( ~(bitmask) == ( (field) | ~(bitmask) ) )
+#endif
+
+
+#ifndef INRANGE
+/**
+ * \def INRANGE
+ * \brief Macro which returns True if value (x) in range (law <= x <= high) \n
+ * Otherwise returns False
+ */
+#define INRANGE(x,low,high)         (((x) >= (low)) && ((x) <= (high)))
+#endif
+
+#ifndef OUTRANGE
+/**
+ * \def OUTRANGE
+ * \brief Macro which returns True if value (x) out of range (x < law | x > high) \n
+ * Otherwise returns False
+ */
+#define OUTRANGE(x,low,high)        (((x) < (low)) || ((x) > (high)))
+#endif
+
+/* Due to alignment exceptions MAC_COPY and MAC_EQUAL are done byte by byte */
+
+/**
+ * \def MAC_COPY
+ * \brief Macro which copies 6 bytes source to 6 bytes destination \n
+ * Due to alignment exceptions MAC_COPY is done byte by byte
+ */
+#define MAC_COPY(dst,src)           *((TI_UINT8*)&((dst)[0])) = *((TI_UINT8*)&((src)[0])); \
+                                    *((TI_UINT8*)&((dst)[1])) = *((TI_UINT8*)&((src)[1])); \
+                                    *((TI_UINT8*)&((dst)[2])) = *((TI_UINT8*)&((src)[2])); \
+                                    *((TI_UINT8*)&((dst)[3])) = *((TI_UINT8*)&((src)[3])); \
+                                    *((TI_UINT8*)&((dst)[4])) = *((TI_UINT8*)&((src)[4])); \
+                                    *((TI_UINT8*)&((dst)[5])) = *((TI_UINT8*)&((src)[5]))
+/**
+ * \def MAC_EQUAL
+ * \brief Macro which compares 6 bytes ofmac1 to 6 bytes of mac2 and returns True if all are equall \n
+ * Otherwise returns False \n
+ * Due to alignment exceptions MAC_EQUAL is done byte by byte
+ */
+#define MAC_EQUAL(mac1,mac2)        (*((TI_UINT8*)&((mac1)[0])) == *((TI_UINT8*)&((mac2)[0])) && \
+                                     *((TI_UINT8*)&((mac1)[1])) == *((TI_UINT8*)&((mac2)[1])) && \
+                                     *((TI_UINT8*)&((mac1)[2])) == *((TI_UINT8*)&((mac2)[2])) && \
+                                     *((TI_UINT8*)&((mac1)[3])) == *((TI_UINT8*)&((mac2)[3])) && \
+                                     *((TI_UINT8*)&((mac1)[4])) == *((TI_UINT8*)&((mac2)[4])) && \
+                                     *((TI_UINT8*)&((mac1)[5])) == *((TI_UINT8*)&((mac2)[5])))
+/**
+ * \def MAC_BROADCAST
+ * \brief Macro which returns True if MAC address is broadcast (equals "\xff\xff\xff\xff\xff\xff") \n
+ * Otherwise returns False
+ */
+#define MAC_BROADCAST(mac)          MAC_EQUAL (mac, "\xff\xff\xff\xff\xff\xff")
+/**
+ * \def MAC_NULL
+ * \brief Macro which returns True if MAC address is Null (equals "\x0\x0\x0\x0\x0\x0") \n
+ * Otherwise returns False
+ */
+#define MAC_NULL(mac)               MAC_EQUAL (mac, "\x0\x0\x0\x0\x0\x0")
+/**
+ * \def MAC_MULTICAST
+ * \brief Macro which returns True if MAC address is Multicast\n
+ * Otherwise returns False
+ */
+#define MAC_MULTICAST(mac)          ((mac)[0] & 0x01)
+/**
+ * \def IP_COPY
+ * \brief Macro which copies IP V4 source to IP V4 destination 
+ */
+#define IP_COPY(dst,src)            *((TI_UINT32*)(dst)) = *((TI_UINT32*)(src))
+/**
+ * \def BYTE_SWAP_WORD
+ * \brief Macro which swaps Word's bytes. Used for Endian handling
+ */
+#define BYTE_SWAP_WORD(x)           ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8))
+/**
+ * \def BYTE_SWAP_LONG
+ * \brief Macro which swaps Long's bytes. Used for Endian handling
+ */
+#define BYTE_SWAP_LONG(x)           ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) | \
+                                     (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
+
+
+/* TI always supports Little Endian */
+#if defined (__BYTE_ORDER_BIG_ENDIAN)
+
+#define WLANTOHL(x)                 (x)
+#define WLANTOHS(x)                 (x)
+#define HTOWLANL(x)                 (x)
+#define HTOWLANS(x)                 (x)
+
+#define ENDIAN_HANDLE_WORD(x)       BYTE_SWAP_WORD (x)
+#define ENDIAN_HANDLE_LONG(x)       BYTE_SWAP_LONG (x)
+
+#define INT64_LOWER(x)              *(((TI_UINT32*)&(x))+1)
+#define INT64_HIGHER(x)             *((TI_UINT32*)&(x))
+
+#define COPY_WLAN_WORD(dst,src)     ((TI_UINT8 *)(dst))[0] = ((TI_UINT8 *)(src))[1]; \
+                                    ((TI_UINT8 *)(dst))[1] = ((TI_UINT8 *)(src))[0]
+#define COPY_WLAN_LONG(dst,src)     ((TI_UINT8 *)(dst))[0] = ((TI_UINT8 *)(src))[3]; \
+                                    ((TI_UINT8 *)(dst))[1] = ((TI_UINT8 *)(src))[2]; \
+                                    ((TI_UINT8 *)(dst))[2] = ((TI_UINT8 *)(src))[1]; \
+                                    ((TI_UINT8 *)(dst))[3] = ((TI_UINT8 *)(src))[0]
+
+#define SET_WLAN_WORD(dst,val)      ((TI_UINT8 *)(dst))[1] =  (val)        & 0xff; \
+                                    ((TI_UINT8 *)(dst))[0] = ((val) >> 8)  & 0xff
+
+#define SET_WLAN_LONG(dst,val)      ((TI_UINT8 *)(dst))[3] =  (val)        & 0xff; \
+                                    ((TI_UINT8 *)(dst))[2] = ((val) >> 8)  & 0xff; \
+                                    ((TI_UINT8 *)(dst))[1] = ((val) >> 16) & 0xff; \
+                                    ((TI_UINT8 *)(dst))[0] = ((val) >> 24) & 0xff
+
+#define WLAN_WORD(src)              (((TI_UINT8 *)(src))[1]) | (((TI_UINT8 *)(src))[0] << 8)
+#define WLAN_LONG(src)              (((TI_UINT8 *)(src))[3]) | (((TI_UINT8 *)(src))[2] << 8) | (((TI_UINT8 *)(src))[1] << 16) | (((TI_UINT8 *)(src))[0] << 24)
+
+#elif defined (__BYTE_ORDER_LITTLE_ENDIAN)
+
+/**
+ * \def WLANTOHL
+ * \brief Macro which performs bytes swap of Long in Little Endian
+ */
+#define WLANTOHL(x)                 BYTE_SWAP_LONG (x)
+/**
+ * \def WLANTOHS
+ * \brief Macro which performs bytes swap of Word in Little Endian
+ */
+#define WLANTOHS(x)                 BYTE_SWAP_WORD (x)
+/**
+ * \def HTOWLANL
+ * \brief Macro which performs bytes swap of Long in Little Endian
+ */
+#define HTOWLANL(x)                 BYTE_SWAP_LONG (x)
+/**
+ * \def HTOWLANL
+ * \brief Macro which performs bytes swap of Word in Little Endian
+ */
+#define HTOWLANS(x)                 BYTE_SWAP_WORD (x)
+
+/**
+ * \def ENDIAN_HANDLE_WORD
+ * \brief Macro which handles Word in Little Endian 
+ */
+#define ENDIAN_HANDLE_WORD(x)       (x)
+/**
+ * \def ENDIAN_HANDLE_WORD
+ * \brief Macro which handles Long in Little Endian 
+ */
+#define ENDIAN_HANDLE_LONG(x)       (x)
+
+/**
+ * \def INT64_HIGHER
+ * \brief Macro which returns the content of higher address of INT64 variable in Little Endian
+ */
+#define INT64_HIGHER(x)             *(((TI_UINT32*)&(x))+1)
+/**
+ * \def INT64_LOWER
+ * \brief Macro which returns the content of lower address of INT64 variable in Little Endian
+ */
+#define INT64_LOWER(x)              *((TI_UINT32*)&(x))
+
+/**
+ * \def COPY_WLAN_WORD
+ * \brief Macro which copies word source to word destination byte by byte in Little Endian
+ */
+#define COPY_WLAN_WORD(dst,src)     ((TI_UINT8 *)(dst))[0] = ((TI_UINT8 *)(src))[0]; \
+                                    ((TI_UINT8 *)(dst))[1] = ((TI_UINT8 *)(src))[1]
+/**
+ * \def COPY_WLAN_LONG
+ * \brief Macro which copies long source to long destination byte by byte in Little Endian
+ */
+#define COPY_WLAN_LONG(dst,src)     ((TI_UINT8 *)(dst))[0] = ((TI_UINT8 *)(src))[0]; \
+                                    ((TI_UINT8 *)(dst))[1] = ((TI_UINT8 *)(src))[1]; \
+                                    ((TI_UINT8 *)(dst))[2] = ((TI_UINT8 *)(src))[2]; \
+                                    ((TI_UINT8 *)(dst))[3] = ((TI_UINT8 *)(src))[3]
+/**
+ * \def SET_WLAN_WORD
+ * \brief Macro which copies Word from val source to desrination in Little Endian
+ */
+#define SET_WLAN_WORD(dst,val)      ((TI_UINT8 *)(dst))[0] =  (val)        & 0xff; \
+                                    ((TI_UINT8 *)(dst))[1] = ((val) >> 8)  & 0xff
+/**
+ * \def SET_WLAN_LONG
+ * \brief Macro which copies Long from val source to desrination in Little Endian
+ */
+#define SET_WLAN_LONG(dst,val)      ((TI_UINT8 *)(dst))[0] =  (val)        & 0xff; \
+                                    ((TI_UINT8 *)(dst))[1] = ((val) >> 8)  & 0xff; \
+                                    ((TI_UINT8 *)(dst))[2] = ((val) >> 16) & 0xff; \
+                                    ((TI_UINT8 *)(dst))[3] = ((val) >> 24) & 0xff
+/**
+ * \def WLAN_WORD
+ * \brief Macro which returns Word value from source address in Little Endian
+ */
+#define WLAN_WORD(src)              (((TI_UINT8 *)(src))[0]) | (((TI_UINT8 *)(src))[1] << 8)
+/**
+ * \def WLAN_LONG
+ * \brief Macro which returns Long value from source address in Little Endian
+ */
+#define WLAN_LONG(src)              (((TI_UINT8 *)(src))[0]) | (((TI_UINT8 *)(src))[1] << 8) | (((TI_UINT8 *)(src))[2] << 16) | (((TI_UINT8 *)(src))[3] << 24)
+#else
+
+#error "Must define byte order (BIG/LITTLE ENDIAN)"
+
+#endif
+
+/********************
+* Memory Types
+********************/
+#define MemoryNormal        0
+#define MemoryDMA           1
+
+
+/**********************
+ *	types
+ **********************/
+
+/**
+ * \typedef TI_HANDLE
+ * \brief Handle type - Pointer to void
+ */
+typedef void*                       TI_HANDLE;
+/**
+ * \typedef TI_BOOL
+ * \brief Boolean type
+ * \n
+ * Used for indicating True or False ( TI_TRUE | TI_FALSE )
+ */
+typedef TI_UINT32                   TI_BOOL;
+/**
+ * \typedef TI_STATUS
+ * \brief Return Status type
+ * \n
+ * Used as return status ( TI_OK | TI_NOK | TI_PENDING )
+ */
+typedef TI_UINT32                   TI_STATUS;
+/**
+ * \typedef TMacAddr
+ * \brief MAC Address Type
+ * \n
+ * A buffer (size of Standart MAC Address Length in bytes) which holds a MAC address
+ */
+typedef TI_UINT8                    TMacAddr [MAC_ADDR_LEN];
+/**
+ * \typedef TIpAddr
+ * \brief IP V4 Address Type
+ * \n
+ * A buffer (size of Standart IP V4 Address Length in bytes) which holds IP V4 address
+ */
+typedef TI_UINT8                    TIpAddr [IP_V4_ADDR_LEN];
+
+#endif /* TIDEF_H */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/timer.c	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,600 @@
+/*
+ * timer.c
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   timer.c 
+ *  \brief  The timers services OS-Independent layer over the OS-API timer services which are OS-Dependent.
+ *  
+ *  \see    timer.h, osapi.c
+ */
+
+
+#define __FILE_ID__  FILE_ID_0
+#include "osApi.h"
+#include "report.h"
+#include "queue.h"
+#include "context.h"
+#include "timer.h"
+
+
+#define EXPIRY_QUE_SIZE  64  /* support case where all timers expire during recovery or error */
+
+/* The timer module structure (common to all timers) */
+typedef struct 
+{
+	TI_HANDLE   hOs;
+	TI_HANDLE   hReport;
+	TI_HANDLE   hContext;
+    TI_UINT32   uContextId;     /* The ID allocated to this module on registration to context module */
+    TI_HANDLE   hInitQueue;     /* Handle of the Init-Queue */
+    TI_HANDLE   hOperQueue;     /* Handle of the Operational-Queue */
+    TI_BOOL     bOperState;     /* TRUE when the driver is in operational state (not init or recovery) */
+    TI_UINT32   uTwdInitCount;  /* Increments on each TWD init (i.e. recovery) */
+    TI_UINT32   uTimersCount;   /* Number of created timers */
+} TTimerModule;	
+
+/* Per timer structure */
+typedef struct 
+{
+    TI_HANDLE    hTimerModule;             /* The timer module handle (see TTimerModule, needed on expiry) */
+    TI_HANDLE    hOsTimerObj;              /* The OS-API timer object handle */
+    TQueNodeHdr  tQueNodeHdr;              /* The header used for queueing the timer */
+    TTimerCbFunc fExpiryCbFunc;            /* The CB-function provided by the timer user for expiration */
+    TI_HANDLE    hExpiryCbHndl;            /* The CB-function handle */
+    TI_UINT32    uIntervalMsec;            /* The timer duration in Msec */
+    TI_BOOL      bPeriodic;                /* If TRUE, restarted after each expiry */
+    TI_BOOL      bOperStateWhenStarted;    /* The bOperState value when the timer was started */
+    TI_UINT32    uTwdInitCountWhenStarted; /* The uTwdInitCount value when the timer was started */
+} TTimerInfo;	
+
+
+
+
+/** 
+ * \fn     tmr_Create 
+ * \brief  Create the timer module
+ * 
+ * Allocate and clear the timer module object.
+ * 
+ * \note   This is NOT a specific timer creation! (see tmr_CreateTimer)
+ * \param  hOs - Handle to Os Abstraction Layer
+ * \return Handle of the allocated object 
+ * \sa     tmr_Destroy
+ */ 
+TI_HANDLE tmr_Create (TI_HANDLE hOs)
+{
+	TI_HANDLE hTimerModule;
+
+	/* allocate module object */
+	hTimerModule = os_memoryAlloc (hOs, sizeof(TTimerModule),MemoryNormal);
+	
+	if (!hTimerModule)
+	{
+		WLAN_OS_REPORT (("tmr_Create():  Allocation failed!!\n"));
+		return NULL;
+	}
+	
+    os_memoryZero (hOs, hTimerModule, (sizeof(TTimerModule)));
+
+	return (hTimerModule);
+}
+
+
+/** 
+ * \fn     tmr_Destroy
+ * \brief  Destroy the module. 
+ * 
+ * Free the module's queues and object.
+ * 
+ * \note   This is NOT a specific timer destruction! (see tmr_DestroyTimer)
+ * \param  hTimerModule - The module object
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     tmr_Create
+ */ 
+TI_STATUS tmr_Destroy (TI_HANDLE hTimerModule)
+{
+    TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
+
+    /* Alert if there are still timers that were not destroyed */
+    if (pTimerModule->uTimersCount)
+    {
+		WLAN_OS_REPORT (("tmr_Destroy():  ERROR - Destroying Timer module but not all timers were destroyed!!\n"));
+    }
+
+    /* Clear queues */
+    tmr_ClearInitQueue (hTimerModule);
+    tmr_ClearOperQueue (hTimerModule);
+
+    /* Destroy the module's queues */
+    que_Destroy (pTimerModule->hInitQueue);
+    que_Destroy (pTimerModule->hOperQueue);
+
+    /* free module object */
+	os_memoryFree (pTimerModule->hOs, pTimerModule, sizeof(TTimerModule));
+	
+    return TI_OK;
+}
+/** 
+ * \fn     tmr_Free
+ * \brief  Free the memory. 
+ * 
+ * Free the module's queues and object.
+ * 
+ * \param  hTimerModule - The module object
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     tmr_Create
+ */ 
+TI_STATUS tmr_Free(TI_HANDLE hTimerModule)
+{
+    TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
+
+    /* free module object */
+	os_memoryFree (pTimerModule->hOs, pTimerModule, sizeof(TTimerModule));
+	
+    return TI_OK;
+}
+
+
+/** 
+ * \fn     tmr_ClearInitQueue & tmr_ClearOperQueue
+ * \brief  Clear Init/Operationsl queue
+ * 
+ * Dequeue all queued timers.
+ * 
+ * \note   
+ * \param  hTimerModule - The object                                          
+ * \return void 
+ * \sa     
+ */ 
+void tmr_ClearInitQueue (TI_HANDLE hTimerModule)
+{
+    TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
+
+    while (que_Dequeue (pTimerModule->hInitQueue) != NULL) {}
+}
+
+void tmr_ClearOperQueue (TI_HANDLE hTimerModule)
+{
+    TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
+
+    while (que_Dequeue (pTimerModule->hOperQueue) != NULL) {}
+}
+
+
+/** 
+ * \fn     tmr_Init 
+ * \brief  Init required handles 
+ * 
+ * Init required handles and module variables, create the init-queue and 
+ *     operational-queue, and register as the context-engine client.
+ * 
+ * \note    
+ * \param  hTimerModule  - The queue object
+ * \param  hOs       - Handle to Os Abstraction Layer
+ * \param  hReport   - Handle to report module
+ * \param  hContext  - Handle to context module
+ * \return void        
+ * \sa     
+ */ 
+void tmr_Init (TI_HANDLE hTimerModule, TI_HANDLE hOs, TI_HANDLE hReport, TI_HANDLE hContext)
+{
+	TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
+    TI_UINT32     uNodeHeaderOffset;
+
+    pTimerModule->hOs           = hOs;
+    pTimerModule->hReport       = hReport;
+    pTimerModule->hContext      = hContext;
+	
+    pTimerModule->bOperState    = TI_FALSE;
+    pTimerModule->uTimersCount  = 0;
+    pTimerModule->uTwdInitCount = 0;
+
+    /* The offset of the queue-node-header from timer structure entry is needed by the queue */
+    uNodeHeaderOffset = TI_FIELD_OFFSET(TTimerInfo, tQueNodeHdr); 
+
+    /* Create and initialize the Init and Operational queues (for timers expiry events) */
+    pTimerModule->hInitQueue = que_Create (pTimerModule->hOs, 
+                                           pTimerModule->hReport, 
+                                           EXPIRY_QUE_SIZE, 
+                                           uNodeHeaderOffset);
+    pTimerModule->hOperQueue = que_Create (pTimerModule->hOs, 
+                                           pTimerModule->hReport, 
+                                           EXPIRY_QUE_SIZE, 
+                                           uNodeHeaderOffset);
+
+    /* Register to the context engine and get the client ID */
+    pTimerModule->uContextId = context_RegisterClient (pTimerModule->hContext,
+                                                       tmr_HandleExpiry,
+                                                       hTimerModule,
+                                                       TI_TRUE,
+                                                       "TIMER",
+                                                       sizeof("TIMER"));
+}
+
+
+/** 
+ * \fn     tmr_UpdateDriverState 
+ * \brief  Update driver state 
+ * 
+ * Under critical section, update driver state (operational or not),
+ *   and if opertional, clear init queue.
+ * Leave critical section and if operational state, request schedule for handling 
+ *   timer events in driver context (if any).
+ * 
+ * \note    
+ * \param  hTimerModule - The timer module object
+ * \param  bOperState   - TRUE if driver state is now operational, FALSE if not.
+ * \return void  
+ * \sa     
+ */ 
+void tmr_UpdateDriverState (TI_HANDLE hTimerModule, TI_BOOL bOperState)
+{
+	TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
+
+    if (bOperState == pTimerModule->bOperState) 
+    {
+        TRACE1(pTimerModule->hReport, REPORT_SEVERITY_ERROR, "tmr_UpdateDriverState(): New bOperState (%d) is as current!\n", bOperState);
+        return;
+    }
+
+    /* Enter critical section */
+    CONTEXT_ENTER_CRITICAL_SECTION (pTimerModule->hContext);
+
+    /* Save new state (TRUE means operational). */
+    pTimerModule->bOperState = bOperState;
+
+    /* If new state is operational */
+    if (bOperState) 
+    {
+        /* Increment the TWD initializations counter (for detecting recovery events). */
+        pTimerModule->uTwdInitCount++;
+
+        /* Empty the init queue (obsolete). */
+        while (que_Dequeue (pTimerModule->hInitQueue) != NULL) {}
+    }
+	
+    /* Leave critical section */
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTimerModule->hContext);
+
+    /* If new state is operational, request switch to driver context for handling timer events */
+    if (bOperState) 
+    {
+        context_RequestSchedule (pTimerModule->hContext, pTimerModule->uContextId);
+    }
+}
+
+
+
+
+/** 
+ * \fn     tmr_CreateTimer
+ * \brief  Create a new timer
+ * 
+ * Create a new timer object, icluding creating a timer in the OS-API.  
+ * 
+ * \note   This timer creation may be used only after tmr_Create() and tmr_Init() were executed!!
+ * \param  hTimerModule - The module handle
+ * \return TI_HANDLE    - The created timer handle
+ * \sa     tmr_DestroyTimer
+ */ 
+TI_HANDLE tmr_CreateTimer (TI_HANDLE hTimerModule)
+{
+	TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */
+    TTimerInfo   *pTimerInfo;  /* The created timer handle */
+
+	/* Allocate timer object */
+	pTimerInfo = os_memoryAlloc (pTimerModule->hOs, sizeof(TTimerInfo),MemoryNormal);
+	if (!pTimerInfo)
+	{
+		WLAN_OS_REPORT (("tmr_CreateTimer():  Timer allocation failed!!\n"));
+		return NULL;
+	}
+    os_memoryZero (pTimerModule->hOs, pTimerInfo, (sizeof(TTimerInfo)));
+
+    /* Allocate OS-API timer, providing the common expiry callback with the current timer handle */
+    pTimerInfo->hOsTimerObj = os_timerCreate(pTimerModule->hOs, tmr_GetExpiry, (TI_HANDLE)pTimerInfo);
+	if (!pTimerInfo->hOsTimerObj)
+	{
+        os_memoryFree (pTimerModule->hOs, pTimerInfo, sizeof(TTimerInfo));
+		WLAN_OS_REPORT (("tmr_CreateTimer():  OS-API Timer allocation failed!!\n"));
+		return NULL;
+	}
+
+    /* Save the timer module handle in the created timer object (needed for the expiry callback) */
+    pTimerInfo->hTimerModule = hTimerModule;
+    pTimerModule->uTimersCount++;  /* count created timers */
+
+    /* Return the created timer handle */
+    return (TI_HANDLE)pTimerInfo;
+}
+
+
+/** 
+ * \fn     tmr_DestroyTimer
+ * \brief  Destroy the specified timer
+ * 
+ * Destroy the specified timer object, icluding the timer in the OS-API.  
+ * 
+ * \note   This timer destruction function should be used before tmr_Destroy() is executed!!
+ * \param  hTimerInfo - The timer handle
+ * \return TI_OK on success or TI_NOK on failure 
+ * \sa     tmr_CreateTimer
+ */ 
+TI_STATUS tmr_DestroyTimer (TI_HANDLE hTimerInfo)
+{
+    TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */     
+	TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
+
+    /* Free the OS-API timer */
+    os_timerDestroy (pTimerModule->hOs, pTimerInfo->hOsTimerObj);
+
+    /* Free the timer object */
+    os_memoryFree (pTimerModule->hOs, hTimerInfo, sizeof(TTimerInfo));
+	
+    pTimerModule->uTimersCount--;  /* update created timers number */
+
+    return TI_OK;
+}
+
+
+
+/** 
+ * \fn     tmr_StartTimer
+ * \brief  Start a timer
+ * 
+ * Start the specified timer running.
+ * 
+ * \note   Periodic-Timer may be used by applications that serve the timer expiry 
+ *           in a single context.
+ *         If an application can't finish serving the timer expiry in a single context, 
+ *           e.g. periodic scan, then it isn't recommended to use the periodic timer service.
+ *         If such an application uses the periodic timer then it should protect itself from cases
+ *            where the timer expires again before the previous timer expiry processing is finished!!
+ * \param  hTimerInfo    - The specific timer handle
+ * \param  fExpiryCbFunc - The timer's expiry callback function.
+ * \param  hExpiryCbHndl - The client's expiry callback function handle.
+ * \param  uIntervalMsec - The timer's duration in Msec.
+ * \param  bPeriodic     - If TRUE, the timer is restarted after expiry.
+ * \return void
+ * \sa     tmr_StopTimer, tmr_GetExpiry
+ */ 
+void tmr_StartTimer (TI_HANDLE     hTimerInfo,
+                     TTimerCbFunc  fExpiryCbFunc,
+                     TI_HANDLE     hExpiryCbHndl,
+                     TI_UINT32     uIntervalMsec,
+                     TI_BOOL       bPeriodic)
+{
+    TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */     
+	TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
+
+    /* Save the timer parameters. */
+    pTimerInfo->fExpiryCbFunc            = fExpiryCbFunc;
+    pTimerInfo->hExpiryCbHndl            = hExpiryCbHndl;
+    pTimerInfo->uIntervalMsec            = uIntervalMsec;
+    pTimerInfo->bPeriodic                = bPeriodic;
+    pTimerInfo->bOperStateWhenStarted    = pTimerModule->bOperState;
+    pTimerInfo->uTwdInitCountWhenStarted = pTimerModule->uTwdInitCount;
+
+    /* Start OS-API timer running */
+    os_timerStart(pTimerModule->hOs, pTimerInfo->hOsTimerObj, uIntervalMsec);
+}
+
+
+/** 
+ * \fn     tmr_StopTimer
+ * \brief  Stop a running timer
+ * 
+ * Stop the specified timer.
+ * 
+ * \note   When using this function, it must be considered that timer expiry may happen
+ *           right before the timer is stopped, so it can't be assumed that this completely 
+ *           prevents the timer expiry event!
+ * \param  hTimerInfo - The specific timer handle
+ * \return void
+ * \sa     tmr_StartTimer
+ */ 
+void tmr_StopTimer (TI_HANDLE hTimerInfo)
+{
+    TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */     
+	TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
+
+    /* Stop OS-API timer running */
+    os_timerStop(pTimerModule->hOs, pTimerInfo->hOsTimerObj);
+
+    /* Clear periodic flag to prevent timer restart if we are in tmr_HandleExpiry context. */
+    pTimerInfo->bPeriodic = TI_FALSE;
+}
+
+
+/** 
+ * \fn     tmr_GetExpiry
+ * \brief  Called by OS-API upon any timer expiry
+ * 
+ * This is the common callback function called upon expiartion of any timer.
+ * It is called by the OS-API in timer expiry context and handles the transition
+ *   to the driver's context for handling the expiry event.
+ * 
+ * \note   
+ * \param  hTimerInfo - The specific timer handle
+ * \return void
+ * \sa     tmr_HandleExpiry
+ */ 
+void tmr_GetExpiry (TI_HANDLE hTimerInfo)
+{
+    TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */     
+	TTimerModule *pTimerModule = (TTimerModule *)pTimerInfo->hTimerModule; /* The timer module handle */
+
+    /* Enter critical section */
+    CONTEXT_ENTER_CRITICAL_SECTION (pTimerModule->hContext);
+
+    /* 
+     * If the expired timer was started when the driver's state was Operational,
+     *   insert it to the Operational-queue 
+     */
+    if (pTimerInfo->bOperStateWhenStarted)
+    {
+        que_Enqueue (pTimerModule->hOperQueue, hTimerInfo);
+    }
+
+    /* 
+     * Else (started when driver's state was NOT-Operational), if now the state is still
+     *   NOT Operational insert it to the Init-queue.
+     *   (If state changed from non-operational to operational the event is ignored)
+     */
+    else if (!pTimerModule->bOperState)
+    {
+        que_Enqueue (pTimerModule->hInitQueue, hTimerInfo);
+    }
+
+    /* Leave critical section */
+    CONTEXT_LEAVE_CRITICAL_SECTION (pTimerModule->hContext);
+
+    /* Request switch to driver context for handling timer events */
+    context_RequestSchedule (pTimerModule->hContext, pTimerModule->uContextId);
+}
+
+
+/** 
+ * \fn     tmr_HandleExpiry
+ * \brief  Handles queued expiry events in driver context
+ * 
+ * This is the Timer module's callback that is registered to the ContextEngine module to be invoked
+ *   from the driver task (after requested by tmr_GetExpiry through context_RequestSchedule ()).
+ * It dequeues all expiry events from the queue that correlates to the current driver state,
+ *   and calls their users callbacks.
+ * 
+ * \note   
+ * \param  hTimerModule - The module object
+ * \return void
+ * \sa     tmr_GetExpiry
+ */ 
+void tmr_HandleExpiry (TI_HANDLE hTimerModule)
+{
+	TTimerModule *pTimerModule = (TTimerModule *)hTimerModule; /* The timer module handle */
+    TTimerInfo   *pTimerInfo;      /* The timer handle */     
+    TI_BOOL       bTwdInitOccured; /* Indicates if TWD init occured since timer start */
+
+    while (1)
+    {
+        /* Enter critical section */
+        CONTEXT_ENTER_CRITICAL_SECTION (pTimerModule->hContext);
+    
+        /* If current driver state is Operational, dequeue timer object from Operational-queue */
+        if (pTimerModule->bOperState)
+        {
+            pTimerInfo = (TTimerInfo *) que_Dequeue (pTimerModule->hOperQueue);
+        }
+    
+        /* Else (driver state is NOT-Operational), dequeue timer object from Init-queue */
+        else
+        {
+            pTimerInfo = (TTimerInfo *) que_Dequeue (pTimerModule->hInitQueue);
+        }
+    
+        /* Leave critical section */
+        CONTEXT_LEAVE_CRITICAL_SECTION (pTimerModule->hContext);
+
+        /* If no more objects in queue, exit */
+        if (!pTimerInfo) 
+        {
+            return;  /** EXIT Point **/
+        }
+
+        /* If current TWD-Init-Count is different than when the timer was started, Init occured. */
+        bTwdInitOccured = (pTimerModule->uTwdInitCount != pTimerInfo->uTwdInitCountWhenStarted);
+
+        /* Call specific timer callback function */
+        pTimerInfo->fExpiryCbFunc (pTimerInfo->hExpiryCbHndl, bTwdInitOccured);
+
+        /* If the expired timer is periodic, start it again. */
+        if (pTimerInfo->bPeriodic) 
+        {
+            tmr_StartTimer ((TI_HANDLE)pTimerInfo,
+                            pTimerInfo->fExpiryCbFunc,
+                            pTimerInfo->hExpiryCbHndl,
+                            pTimerInfo->uIntervalMsec,
+                            pTimerInfo->bPeriodic);
+        }
+    }
+}
+
+
+/** 
+ * \fn     tmr_PrintModule / tmr_PrintTimer
+ * \brief  Print module / timer information
+ * 
+ * Print the module's information / a specific timer information.
+ * 
+ * \note   
+ * \param  The module / timer handle
+ * \return void
+ * \sa     
+ */ 
+
+#ifdef TI_DBG
+
+void tmr_PrintModule (TI_HANDLE hTimerModule)
+{
+	TTimerModule *pTimerModule = (TTimerModule *)hTimerModule;
+
+    /* Print module parameters */
+    WLAN_OS_REPORT(("tmr_PrintModule(): uContextId=%d, bOperState=%d, uTwdInitCount=%d, uTimersCount=%d\n", 
+        pTimerModule->uContextId, pTimerModule->bOperState, 
+        pTimerModule->uTwdInitCount, pTimerModule->uTimersCount));
+
+    /* Print Init Queue Info */
+    WLAN_OS_REPORT(("tmr_PrintModule(): Init-Queue:\n")); 
+    que_Print(pTimerModule->hInitQueue);
+
+    /* Print Operational Queue Info */
+    WLAN_OS_REPORT(("tmr_PrintModule(): Operational-Queue:\n")); 
+    que_Print(pTimerModule->hOperQueue);
+}
+
+void tmr_PrintTimer (TI_HANDLE hTimerInfo)
+{
+    TTimerInfo   *pTimerInfo   = (TTimerInfo *)hTimerInfo;                 /* The timer handle */     
+
+    WLAN_OS_REPORT(("tmr_PrintTimer(): uIntervalMs=%d, bPeriodic=%d, bOperStateWhenStarted=%d, uTwdInitCountWhenStarted=%d, hOsTimerObj=0x%x, fExpiryCbFunc=0x%x\n", 
+        pTimerInfo->uIntervalMsec, pTimerInfo->bPeriodic, pTimerInfo->bOperStateWhenStarted, 
+        pTimerInfo->uTwdInitCountWhenStarted, pTimerInfo->hOsTimerObj, pTimerInfo->fExpiryCbFunc));
+}
+
+#endif /* TI_DBG */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/timer.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,83 @@
+/*
+ * timer.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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   timer.h 
+ *  \brief  timer module header file.                                  
+ *
+ *  \see    timer.c
+ */
+
+#ifndef _TIMER_H_
+#define _TIMER_H_
+
+
+/* The callback function type for timer clients */
+typedef void (*TTimerCbFunc)(TI_HANDLE hCbHndl, TI_BOOL bTwdInitOccured);
+
+
+/* External Functions Prototypes */
+/* ============================= */
+TI_HANDLE tmr_Create (TI_HANDLE hOs);
+TI_STATUS tmr_Destroy (TI_HANDLE hTimerModule);
+TI_STATUS tmr_Free (TI_HANDLE hTimerModule);
+void      tmr_ClearInitQueue (TI_HANDLE hTimerModule);
+void      tmr_ClearOperQueue (TI_HANDLE hTimerModule);
+void      tmr_Init (TI_HANDLE hTimerModule, TI_HANDLE hOs, TI_HANDLE hReport, TI_HANDLE hContext);
+void      tmr_UpdateDriverState (TI_HANDLE hTimerModule, TI_BOOL bOperState);
+TI_HANDLE tmr_CreateTimer (TI_HANDLE hTimerModule);
+TI_STATUS tmr_DestroyTimer (TI_HANDLE hTimerInfo);
+void      tmr_StartTimer (TI_HANDLE     hTimerInfo,
+                          TTimerCbFunc  fExpiryCbFunc,
+                          TI_HANDLE     hExpiryCbHndl,
+                          TI_UINT32     uIntervalMsec,
+                          TI_BOOL       bPeriodic);
+void      tmr_StopTimer (TI_HANDLE hTimerInfo);
+void      tmr_GetExpiry (TI_HANDLE hTimerInfo);
+void      tmr_HandleExpiry (TI_HANDLE hTimerModule);
+
+#ifdef TI_DBG
+void      tmr_PrintModule (TI_HANDLE hTimerModule);
+void      tmr_PrintTimer (TI_HANDLE hTimerInfo);
+#endif /* TI_DBG */
+
+
+#endif  /* _TIMER_H_ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utils/version.h	Tue Jun 29 12:34:26 2010 +0100
@@ -0,0 +1,64 @@
+/*
+ * version.h
+ *
+ * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
+ * All rights reserved.      
+ * 
+ * This program and the accompanying materials are made available under the 
+ * terms of the Eclipse Public License v1.0 or BSD License which accompanies
+ * this distribution. The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
+ *                                                                       
+ * 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:  version.h                                                   */                                                                                                             
+/*   PURPOSE: release specific definitions file.                          */                                                                                                             
+/*                                                                        */                                                                                                             
+/**************************************************************************/                                                                                                             
+                                                                                                              
+                                                                                                             
+#ifndef _VERSION_H_                                                                                                             
+#define _VERSION_H_                                                                                                             
+
+#define SW_VERSION_STR      "WiLink_Driver_6.1.1.0.8"
+
+/* based on versions
+#define SW_VERSION_STR  "WiLink_Driver_6.1.0.10.168" 
+*/
+
+#define SW_RELEASE_DAY      15
+#define SW_RELEASE_MONTH    06
+#define SW_RELEASE_YEAR     2010
+
+
+#endif /* _VERSION_H_ */
+                                                                                                       
+
Binary file wilink-firmware-nvs-6.1.0.0.299-win-Install.exe has changed