diff options
Diffstat (limited to 'wl1271/TWD')
78 files changed, 0 insertions, 48006 deletions
diff --git a/wl1271/TWD/Ctrl/CmdBld.c b/wl1271/TWD/Ctrl/CmdBld.c deleted file mode 100644 index 82b3d0c4..00000000 --- a/wl1271/TWD/Ctrl/CmdBld.c +++ /dev/null @@ -1,2597 +0,0 @@ -/* - * CmdBld.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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)); - 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)); - 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; - - /* Indicate that the reconfig process is over. */ - pCmdBld->bReconfigInProgress = TI_FALSE; - - /* 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; - pCmdBld->bReconfigInProgress = TI_TRUE; - /* 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_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, - (EArpFilterType)DB_WLAN(hCmdBld).arpFilterType, - (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); -} - - -#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 - -static TI_STATUS __cfg_cca_threshold (TI_HANDLE hCmdBld) -{ - return cmdBld_CfgIeCcaThreshold (hCmdBld, - DB_WLAN(hCmdBld).ch14TelecCca, - (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_extended_radio_params (TI_HANDLE hCmdBld) -{ - return cmdBld_CfgIeExtendedRadioParams (hCmdBld, - &DB_EXT_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_arp_rsp (TI_HANDLE hCmdBld) -{ - - return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, - NULL, - DB_WLAN(hCmdBld).ArpRspTemplateSize, - TEMPLATE_ARP_RSP, - 0, - (void *)cmdBld_ConfigSeq, - hCmdBld); -} - - -static TI_STATUS __cmd_arp_rsp_join (TI_HANDLE hCmdBld) -{ - - if ((DB_WLAN(hCmdBld).bJoin) && (DB_TEMP(hCmdBld).ArpRsp.Size != 0)) - { - return cmdBld_CmdIeConfigureTemplateFrame (hCmdBld, - &(DB_TEMP(hCmdBld).ArpRsp), - DB_TEMP(hCmdBld).ArpRsp.Size, - TEMPLATE_ARP_RSP, - 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, - (ScanBssType_e)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, (Preamble_e) 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) -{ - TI_STATUS tRes = TI_NOK; - - if (DB_WLAN(hCmdBld).bJoin) - { - TI_UINT32 uTid; - TI_UINT32 uLastTid = MAX_NUM_OF_802_1d_TAGS; /* initial value is "not found" */ - - /* Look through configured BA sessions in data base to find the last set TID */ - for (uTid = 0; uTid < MAX_NUM_OF_802_1d_TAGS; uTid++) - { - /* Is BA initiator or responder configured? */ - if (DB_BSS(hCmdBld).bBaInitiator[uTid] || DB_BSS(hCmdBld).bBaResponder[uTid]) - { - uLastTid = uTid; - } - } - - if (uLastTid != MAX_NUM_OF_802_1d_TAGS) - { - /* At least one TID is set */ - for (uTid = 0; uTid < uLastTid; ++uTid) - { - if (DB_BSS(hCmdBld).bBaInitiator[uTid]) - { - /* set BA Initiator */ - tRes = 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, - NULL, - NULL); - if (tRes != TI_OK) - { - return tRes; - } - } - - if (DB_BSS(hCmdBld).bBaResponder[uTid]) - { - /* set BA Responder */ - tRes = 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, - NULL, - NULL); - if (tRes != TI_OK) - { - return tRes; - } - } - } - - /* Push the last command of the last TID entry into queue with a call back function */ - if (DB_BSS(hCmdBld).bBaInitiator[uLastTid] && !(DB_BSS(hCmdBld).bBaResponder[uLastTid])) - { - - tRes = cmdBld_CfgIeSetBaSession (hCmdBld, - ACX_BA_SESSION_INITIATOR_POLICY, - uLastTid, - DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uPolicy, - DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].aMacAddress, - DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uWinSize, - DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uInactivityTimeout, - (void *)cmdBld_ConfigSeq, - hCmdBld); - } - else if (!(DB_BSS(hCmdBld).bBaInitiator[uLastTid]) && DB_BSS(hCmdBld).bBaResponder[uLastTid]) - { - tRes = cmdBld_CfgIeSetBaSession (hCmdBld, - ACX_BA_SESSION_RESPONDER_POLICY, - uLastTid, - DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uPolicy, - DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].aMacAddress, - DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uWinSize, - DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uInactivityTimeout, - (void *)cmdBld_ConfigSeq, - hCmdBld); - } - else - { - /* Initiator & Responsder policy is to be set */ - tRes = cmdBld_CfgIeSetBaSession (hCmdBld, - ACX_BA_SESSION_INITIATOR_POLICY, - uLastTid, - DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uPolicy, - DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].aMacAddress, - DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uWinSize, - DB_BSS(hCmdBld).tBaSessionInitiatorPolicy[uLastTid].uInactivityTimeout, - NULL, - NULL); - if (tRes != TI_OK) - { - return tRes; - } - - tRes = cmdBld_CfgIeSetBaSession (hCmdBld, - ACX_BA_SESSION_RESPONDER_POLICY, - uLastTid, - DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uPolicy, - DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].aMacAddress, - DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uWinSize, - DB_BSS(hCmdBld).tBaSessionResponderPolicy[uLastTid].uInactivityTimeout, - (void *)cmdBld_ConfigSeq, - hCmdBld); - } - } - } - - return tRes; -} - - -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 = (rateAdaptParam_e) 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, - __cfg_extended_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, - __cmd_arp_rsp, - __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, - __cfg_rate_management, - __cmd_arp_rsp_join, - /* 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, ¶m); - 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 = (TI_UINT8)DB_WLAN(hCmdBld).arpFilterType; - - 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 */ - diff --git a/wl1271/TWD/Ctrl/CmdBld.h b/wl1271/TWD/Ctrl/CmdBld.h deleted file mode 100644 index dbc1084c..00000000 --- a/wl1271/TWD/Ctrl/CmdBld.h +++ /dev/null @@ -1,271 +0,0 @@ -/* - * CmdBld.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - - -#ifndef 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_SUPPORTED - 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_UINT8 bEnabled, EIpVer eIpVer, void *fCb, TI_HANDLE hCb); -TI_STATUS cmdBld_CfgArpIpFilter (TI_HANDLE hCmdBld, TIpAddr tIpAddr, 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); - - -/* this is a solution for the EMP project Enable/Disable Rx Data*/ -TI_STATUS cmdBld_SetDownlinkData (TI_HANDLE hCmdBld, TI_BOOL bDownlinkFlag); - - -#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_BOOL bReconfigInProgress; - - 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_EXT_RADIO(HCMDBLD) (((TCmdBld *)HCMDBLD)->tDb.tExtRadioIniParams) -#define DB_GEN(HCMDBLD) (((TCmdBld *)HCMDBLD)->tDb.tPlatformGenParams) -#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 - diff --git a/wl1271/TWD/Ctrl/CmdBldCfg.c b/wl1271/TWD/Ctrl/CmdBldCfg.c deleted file mode 100644 index 3411cdf2..00000000 --- a/wl1271/TWD/Ctrl/CmdBldCfg.c +++ /dev/null @@ -1,1325 +0,0 @@ -/* - * CmdBldCfg.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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_UINT8 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).arpFilterType = (EArpFilterType)bEnabled; - - /* Set the new ip with the current state (e/d) */ - return cmdBld_CfgIeArpIpFilter (hCmdBld, tIpAddr, (EArpFilterType)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, TIpAddr tIpAddr, void *fCb, TI_HANDLE hCb) -{ - /* no support for IPV6 */ - IP_COPY (DB_WLAN(hCmdBld).arp_IP_addr, tIpAddr); - - return cmdBld_CfgIeArpIpFilter (hCmdBld, - tIpAddr, - DB_WLAN(hCmdBld).arpFilterType, - 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 = pRateMngParams->InverseCuriosityFactor; - 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; - } - - - 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); -} - diff --git a/wl1271/TWD/Ctrl/CmdBldCfgIE.c b/wl1271/TWD/Ctrl/CmdBldCfgIE.c deleted file mode 100644 index 495770a9..00000000 --- a/wl1271/TWD/Ctrl/CmdBldCfgIE.c +++ /dev/null @@ -1,2014 +0,0 @@ -/* - * CmdBldCfgIE.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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 = pDmaParams->NumRxBlocks; - 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, - EArpFilterType filterType, - 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_UINT8)filterType; - - /* 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), filterType); - - 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; - - /* 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 - { - twIf_Sleep(pCmdBld->hTwIf); - } - } - - /* 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); - - return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL); -} - - -/**************************************************************************** - * 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; - TI_STATUS status = TI_NOK; - ACXStatistics_t *pCfg; - - pCfg = os_memoryAlloc(pCmdBld->hOs, sizeof(ACXStatistics_t)); - if (!pCfg) - { - return status; - } - - /* Set information element header */ - pCfg->EleHdr.id = ACX_STATISTICS; - pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct); - - status = cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_CONFIGURE, pCfg, sizeof(*pCfg), fCb, hCb, NULL); - os_memoryFree(pCmdBld->hOs, pCfg, sizeof(ACXStatistics_t)); - return status; -} - - -/**************************************************************************** - * 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; - AcxRateMangeParams RateMng; - AcxRateMangeParams *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 = pRateMngParams->InverseCuriosityFactor; - 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; - - 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; - TI_STATUS status = TI_NOK; - TTestCmd *pTestCmd; - - pTestCmd = os_memoryAlloc(pCmdBld->hOs, sizeof(TTestCmd)); - if (!pTestCmd) - { - return status; - } - - pTestCmd->testCmdId = TEST_CMD_INI_FILE_RADIO_PARAM; - - os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileRadioParams, pIniFileRadioParams, sizeof(IniFileRadioParam)); - - status = cmdQueue_SendCommand (pCmdBld->hCmdQueue, - CMD_TEST, - (void *)pTestCmd, - sizeof(IniFileRadioParam) + 4, - fCb, - hCb, - NULL); - os_memoryFree(pCmdBld->hOs, pTestCmd, sizeof(TTestCmd)); - return status; -} - - -/** - * \fn cmdBld_CfgIeExtendedRadioParams - * \brief configure extended radio parameters setting in the - * FW. - * - * \note - * \return TI_OK on success or TI_NOK on failure - * \sa - */ -TI_STATUS cmdBld_CfgIeExtendedRadioParams (TI_HANDLE hCmdBld, - IniFileExtendedRadioParam *pIniFileExtRadioParams, - void *fCb, - TI_HANDLE hCb) -{ - TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; - TI_STATUS status = TI_NOK; - TTestCmd *pTestCmd; - - pTestCmd = os_memoryAlloc(pCmdBld->hOs, sizeof(TTestCmd)); - if (!pTestCmd) - { - return status; - } - - pTestCmd->testCmdId = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM; - - os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileExtendedRadioParams, - pIniFileExtRadioParams, sizeof(IniFileExtendedRadioParam)); - - status = cmdQueue_SendCommand (pCmdBld->hCmdQueue, - CMD_TEST, - (void *)pTestCmd, - sizeof(IniFileExtendedRadioParam) + 4, - fCb, - hCb, - NULL); - os_memoryFree(pCmdBld->hOs, pTestCmd, sizeof(TTestCmd)); - return status; -} - - -TI_STATUS cmdBld_CfgPlatformGenParams (TI_HANDLE hCmdBld, IniFileGeneralParam *pGenParams, void *fCb, TI_HANDLE hCb) -{ - TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; - TI_STATUS status = TI_NOK; - TTestCmd *pTestCmd; - - pTestCmd = os_memoryAlloc(pCmdBld->hOs, sizeof(TTestCmd)); - if (!pTestCmd) - { - return status; - } - - pTestCmd->testCmdId = TEST_CMD_INI_FILE_GENERAL_PARAM; - - os_memoryCopy(pCmdBld->hOs, &pTestCmd->testCmd_u.IniFileGeneralParams, pGenParams, sizeof(IniFileGeneralParam)); - - status = cmdQueue_SendCommand (pCmdBld->hCmdQueue, - CMD_TEST, - (void *)pTestCmd, - sizeof(IniFileGeneralParam), - fCb, - hCb, - NULL); - os_memoryFree(pCmdBld->hOs, pTestCmd, sizeof(TTestCmd)); - return status; -} - - -/**************************************************************************** - * 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_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); -} diff --git a/wl1271/TWD/Ctrl/CmdBldCfgIE.h b/wl1271/TWD/Ctrl/CmdBldCfgIE.h deleted file mode 100644 index 60b8c5c5..00000000 --- a/wl1271/TWD/Ctrl/CmdBldCfgIE.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * CmdBldCfgIE.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * MODULE: 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, EArpFilterType filterType, 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_CfgIeExtendedRadioParams (TI_HANDLE hCmdBld, IniFileExtendedRadioParam *pIniFileExtRadioParams, 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_CfgIeRateMngDbg (TI_HANDLE hCmdBld, RateMangeParams_t *pRateMngParams, void *fCb, TI_HANDLE hCb); -#endif - diff --git a/wl1271/TWD/Ctrl/CmdBldCmd.c b/wl1271/TWD/Ctrl/CmdBldCmd.c deleted file mode 100644 index 14e195db..00000000 --- a/wl1271/TWD/Ctrl/CmdBldCmd.c +++ /dev/null @@ -1,1689 +0,0 @@ -/* - * CmdBldCmd.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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) -#define RX_CONFIG_OPTION (CFG_RX_RAW | CFG_RX_INT_FCS_ERROR | CFG_RX_WR_RX_STATUS | CFG_RX_TIMESTAMP_TSF) - - - -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 = ENDIAN_HANDLE_LONG(RX_CONFIG_OPTION) ; - tnetScanParams.basicScanParameters.rxCfg.FilterOptions = ENDIAN_HANDLE_LONG( RX_FILTER_CFG_ ); - - /* If the SSID is not broadcast SSID, filter according to SSID and local MAC address */ - if (pScanVals->desiredSsid.len != 0) - { - tnetScanParams.basicScanParameters.rxCfg.ConfigOptions = ENDIAN_HANDLE_LONG(RX_CONFIG_OPTION | CFG_SSID_FILTER_EN | CFG_UNI_FILTER_EN) ; - } - /* 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 = ENDIAN_HANDLE_LONG(RX_CONFIG_OPTION); - 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 ].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 ].passiveScanDuration = ENDIAN_HANDLE_WORD ((TI_UINT16)pPeriodicScanParams->tChannels[ uIndex ].uMaxDwellTimeMs); - 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 *pFWSsidList; - 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; - - default: /* More than one SSID - copy SSIDs to SSID list command */ - pFWSsidList = os_memoryAlloc(pCmdBld->hOs, sizeof(ConnScanSSIDList_t)); - if (!pFWSsidList) - { - return TI_NOK; - } - - if ((TI_UINT8)pPeriodicScanParams->uSsidListFilterEnabled == 1) - tFWPeriodicScanParams.ssidFilterType = (ScanSsidFilterType_e)SCAN_SSID_FILTER_TYPE_LIST; - else - tFWPeriodicScanParams.ssidFilterType = (ScanSsidFilterType_e)SCAN_SSID_FILTER_TYPE_LIST_FILTER_DISABLED; - tFWPeriodicScanParams.ssidLength = 0; - pFWSsidList->numOfSSIDEntries = (TI_UINT8)pPeriodicScanParams->uSsidNum; - for (uIndex = 0; uIndex < pPeriodicScanParams->uSsidNum; uIndex++) - { - pFWSsidList->SSIDList[ uIndex ].ssidType = - (TI_UINT8)pPeriodicScanParams->tDesiredSsid[ uIndex ].eVisability; - pFWSsidList->SSIDList[ uIndex ].ssidLength = - (TI_UINT8)pPeriodicScanParams->tDesiredSsid[ uIndex ].tSsid.len; - os_memoryCopy (pCmdBld->hOs, (void*)&(pFWSsidList->SSIDList[ uIndex ].ssid[ 0 ]), - (void*)&(pPeriodicScanParams->tDesiredSsid[ uIndex ].tSsid.str[ 0 ]), - pFWSsidList->SSIDList[ uIndex ].ssidLength); - } - - /* print the SSID list parameters */ - cmdBld_debugPrintPeriodicScanSsidList (hCmdBld, pFWSsidList); - - /* send the SSID list command */ - tStatus = cmdBld_CmdIeScanSsidList (hCmdBld, pFWSsidList, NULL, NULL); - os_memoryFree(pCmdBld->hOs, pFWSsidList, sizeof(ConnScanSSIDList_t)); - 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; - tStatus = cmdBld_CmdIeStartPeriodicScan (hCmdBld, &tScanStart, fScanCommandResponseCB, hCb); - return tStatus; -} - -/** - * \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; - - 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; - - case ARP_RSP_TEMPLATE: - eType = TEMPLATE_ARP_RSP; - pTemplate = &(DB_TEMP(hCmdBld).ArpRsp); - break; - - default: - TRACE1( pCmdBld->hReport, REPORT_SEVERITY_ERROR, - "cmdBld_CmdTemplate. Invalid template type:%d\n", pTemplateParams->type); - 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); - /* if (eType == TEMPLATE_ARP_RSP) - { - WLAN_OS_REPORT(("cmdBld_CmdTemplate: template (len=%d):\n>>>", pTemplate->Size)); - for (i=0; i<sizeof(ArpRspTemplate_t); i++ ) - { - WLAN_OS_REPORT((" %2x", *(pTemplate->Buffer+i))); - if (i%8 == 7) WLAN_OS_REPORT(("\n>>>")); - } - WLAN_OS_REPORT(("\n")); - } - */ - /* 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); - - /* WLAN_OS_REPORT(("cmdBld_CmdTemplate: template %d config rc=%d\n", eType, Stt)); */ - 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_CmdAddWepDefaultKey (hCmdBld, pKey, fCb, hCb); - - case TWD_CIPHER_TKIP: - case TWD_CIPHER_AES_CCMP: - #ifdef GEM_SUPPORTED - 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_SUPPORTED - 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_CmdRemoveWepDefaultKey (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_SUPPORTED - 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_CmdRemoveWepDefaultKey (hCmdBld, pKey, fCb, hCb); - case TWD_CIPHER_TKIP: - case TWD_CIPHER_AES_CCMP: - #ifdef GEM_SUPPORTED - case TWD_CIPHER_GEM: - #endif - return cmdBld_CmdRemoveWpaKey (hCmdBld, pKey, fCb, hCb); - - default: - return TI_NOK; - } -} - - -/**************************************************************************** - * 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}; - - /* Non WEP keys are trashed*/ - if (aSecurityKey->keyType != KEY_WEP) - { - return TI_NOK; - } - - 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}; - - /* Non WEP keys are trashed*/ - if (aSecurityKey->keyType != KEY_WEP) - { - return TI_NOK; - } - - 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_SUPPORTED -/**************************************************************************** - * 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; - - keyType = CIPHER_SUITE_GEM; - - return cmdBld_CmdIeSetKey (hCmdBld, - KEY_ADD_OR_REPLACE, - aSecurityKey->macAddress, - MAX_KEY_SIZE, - keyType, - aSecurityKey->keyIndex, - aSecurityKey->encKey, - 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_SUPPORTED*/ - -/**************************************************************************** - * 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); -} - diff --git a/wl1271/TWD/Ctrl/CmdBldCmdIE.c b/wl1271/TWD/Ctrl/CmdBldCmdIE.c deleted file mode 100644 index f5edb52d..00000000 --- a/wl1271/TWD/Ctrl/CmdBldCmdIE.c +++ /dev/null @@ -1,1100 +0,0 @@ -/* - * CmdBldCmdIE.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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 aEnableRx_buf[4]; - - aEnableRx_buf[0] = DB_DEFAULT_CHANNEL (hCmdBld); - aEnableRx_buf[1] = 0; /* padding */ - aEnableRx_buf[2] = 0; /* padding */ - aEnableRx_buf[3] = 0; /* padding */ - - - return cmdQueue_SendCommand (pCmdBld->hCmdQueue, - CMD_ENABLE_RX, - (TI_CHAR *)aEnableRx_buf, - sizeof(aEnableRx_buf), - 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; - TI_UINT8 aEnableTx_buf[4]; - - aEnableTx_buf[0] = channel; - aEnableTx_buf[1] = 0; /* padding */ - aEnableTx_buf[2] = 0; /* padding */ - aEnableTx_buf[3] = 0; /* padding */ - - return cmdQueue_SendCommand (pCmdBld->hCmdQueue, - CMD_ENABLE_TX, - (TI_CHAR *)aEnableTx_buf, - sizeof(aEnableTx_buf), - 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) - { - EReportSeverity eReportSeverity = (pTemplate == NULL) ? REPORT_SEVERITY_WARNING : REPORT_SEVERITY_ERROR; - - /* Report as error only if this is the actual template and not just a space holder */ - TRACE3(pCmdBld->hReport, eReportSeverity, "cmdBld_CmdIeConfigureTemplateFrame: Frame size (=%d) of CmdType (=%d) is bigger than MAX_TEMPLATES_SIZE(=%d) !!!\n", uFrameSize, eTemplateType, MAX_TEMPLATES_SIZE); - - /* Truncate length to the template size limit */ - uFrameSize = MAX_TEMPLATES_SIZE; - } - /* WLAN_OS_REPORT(("DloadTempl type =%d size=%d\n", eTemplateType, uFrameSize)); */ - /* 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. - * If not in reconfig set to 0 so the FW will ignore it and keep its own number. - * Note that our STA Tx is currently using only one sequence-counter - * for all ACs (unlike the Rx which is separated per AC). - */ - if (pCmdBld->bReconfigInProgress == TI_FALSE) - { - uSecuritySeqNumLow = uSecuritySeqNumHigh = 0; - } - 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_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); -} diff --git a/wl1271/TWD/Ctrl/CmdBldCmdIE.h b/wl1271/TWD/Ctrl/CmdBldCmdIE.h deleted file mode 100644 index 3f919e3c..00000000 --- a/wl1271/TWD/Ctrl/CmdBldCmdIE.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * CmdBldCmdIE.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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 diff --git a/wl1271/TWD/Ctrl/CmdBldDb.h b/wl1271/TWD/Ctrl/CmdBldDb.h deleted file mode 100644 index a3c438fb..00000000 --- a/wl1271/TWD/Ctrl/CmdBldDb.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - * CmdBldDb.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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; - EArpFilterType arpFilterType; - 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_UINT32 ArpRspTemplateSize; - TI_BOOL ch14TelecCca; - 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; - TTemplateParams ArpRsp; - -} 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 -{ - 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 */ - IniFileExtendedRadioParam tExtRadioIniParams; /* Extended Radio ini params from public_radio.h */ - TRateMngParams tRateMngParams; /* rate management params */ -} TCmdBldDb; - -#endif - - - diff --git a/wl1271/TWD/Ctrl/CmdBldItr.c b/wl1271/TWD/Ctrl/CmdBldItr.c deleted file mode 100644 index 90fde0ea..00000000 --- a/wl1271/TWD/Ctrl/CmdBldItr.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * CmdBldItr.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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); -} - - -TI_STATUS cmdBld_ItrPowerConsumptionstat (TI_HANDLE hTWD, void *fCb, TI_HANDLE hCb, void* pCb) -{ - TTwd *pTWD = (TTwd *)hTWD; - - return cmdBld_ItrIePowerConsumptionstat (pTWD->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); -} - diff --git a/wl1271/TWD/Ctrl/CmdBldItrIE.c b/wl1271/TWD/Ctrl/CmdBldItrIE.c deleted file mode 100644 index 2d1efca0..00000000 --- a/wl1271/TWD/Ctrl/CmdBldItrIE.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * CmdBldItrIE.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#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_ItrIePowerConsumptionstat() - **************************************************************************** - * DESCRIPTION: Get the Power consumption statistic from the Fw - * - * - * OUTPUT: None - * - * RETURNS: TI_OK or TI_NOK - ****************************************************************************/ -TI_STATUS cmdBld_ItrIePowerConsumptionstat(TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb) -{ - TCmdBld *pCmdBld = (TCmdBld *)hCmdBld; - ACXPowerConsumptionTimeStat_t AcxPowerConsumptionStat; - ACXPowerConsumptionTimeStat_t* pCfg = &AcxPowerConsumptionStat; - - TRACE0(pCmdBld->hReport, REPORT_SEVERITY_INFORMATION, "cmdBld_ItrIePowerConsumptionstat \n"); - - /* Set information element header */ - pCfg->EleHdr.id = ACX_PWR_CONSUMPTION_STATISTICS; - pCfg->EleHdr.len = sizeof(*pCfg) - sizeof(EleHdrStruct); - - return cmdQueue_SendCommand (pCmdBld->hCmdQueue, CMD_INTERROGATE, pCfg, sizeof(AcxPowerConsumptionStat), 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); -} - - diff --git a/wl1271/TWD/Ctrl/CmdBldItrIE.h b/wl1271/TWD/Ctrl/CmdBldItrIE.h deleted file mode 100644 index b3f0c36c..00000000 --- a/wl1271/TWD/Ctrl/CmdBldItrIE.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CmdBldItrIE.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -#ifndef 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_ItrIePowerConsumptionstat (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb); -TI_STATUS cmdBld_ItrIeRateParams (TI_HANDLE hCmdBld, void *fCb, TI_HANDLE hCb, void* pCb); - -#endif - diff --git a/wl1271/TWD/Ctrl/CmdQueue.c b/wl1271/TWD/Ctrl/CmdQueue.c deleted file mode 100644 index 97893ecd..00000000 --- a/wl1271/TWD/Ctrl/CmdQueue.c +++ /dev/null @@ -1,1100 +0,0 @@ -/* - * CmdQueue.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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); -#ifdef REPORT_LOG -static char * cmdQueue_GetIEString (TI_INT32 MboxCmdType, TI_UINT16 id); -static char * cmdQueue_GetCmdString (TI_INT32 MboxCmdType); -#endif -#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)); - 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; - CommandStatus_e cmdStatus; - - 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, &cmdStatus); - if (status != TI_OK) - { - if (cmdStatus == CMD_STATUS_REJECT_MEAS_SG_ACTIVE) - { - /* return reject status in the callback */ - status = SG_REJECT_MEAS_SG_ACTIVE; - pCmdQueue->bErrorFlag = TI_FALSE; - } - else - { - WLAN_OS_REPORT(("cmdQueue_SM: ** ERROR ** Mbox status error %d, set bErrorFlag !!!!!\n", cmdStatus)); - TRACE1(pCmdQueue->hReport, REPORT_SEVERITY_ERROR, "cmdQueue_SM: ** ERROR ** Mbox status error %d, set bErrorFlag !!!!!\n", cmdStatus); - 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_StartReconfig - */ -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 -#ifdef REPORT_LOG - 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)); -#endif - /* 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) -{ -#ifdef REPORT_LOG - 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")); -#endif -} - -#ifdef REPORT_LOG -/* - * \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 -#endif /* TI_DBG */ - - diff --git a/wl1271/TWD/Ctrl/CmdQueue.h b/wl1271/TWD/Ctrl/CmdQueue.h deleted file mode 100644 index fa8ebbd4..00000000 --- a/wl1271/TWD/Ctrl/CmdQueue.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * CmdQueue.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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 - diff --git a/wl1271/TWD/Ctrl/Export_Inc/CmdQueue_api.h b/wl1271/TWD/Ctrl/Export_Inc/CmdQueue_api.h deleted file mode 100644 index fe8473e2..00000000 --- a/wl1271/TWD/Ctrl/Export_Inc/CmdQueue_api.h +++ /dev/null @@ -1,296 +0,0 @@ -/* - * CmdQueue_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - - -/** \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_ */ diff --git a/wl1271/TWD/Data_Service/Export_Inc/RxQueue_api.h b/wl1271/TWD/Data_Service/Export_Inc/RxQueue_api.h deleted file mode 100644 index 1c497490..00000000 --- a/wl1271/TWD/Data_Service/Export_Inc/RxQueue_api.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * RxQueue_api.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - - -/** \file 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, TI_HANDLE hTimerModule); -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_ */ - - diff --git a/wl1271/TWD/Data_Service/Export_Inc/txCtrlBlk_api.h b/wl1271/TWD/Data_Service/Export_Inc/txCtrlBlk_api.h deleted file mode 100644 index a324816c..00000000 --- a/wl1271/TWD/Data_Service/Export_Inc/txCtrlBlk_api.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * txCtrlBlk_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/***************************************************************************/ -/* */ -/* 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_ */ - - diff --git a/wl1271/TWD/Data_Service/Export_Inc/txHwQueue_api.h b/wl1271/TWD/Data_Service/Export_Inc/txHwQueue_api.h deleted file mode 100644 index 681c4620..00000000 --- a/wl1271/TWD/Data_Service/Export_Inc/txHwQueue_api.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * txHwQueue_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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); -ETxnStatus 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 */ - - - - diff --git a/wl1271/TWD/Data_Service/RxQueue.c b/wl1271/TWD/Data_Service/RxQueue.c deleted file mode 100644 index ec5ce9b4..00000000 --- a/wl1271/TWD/Data_Service/RxQueue.c +++ /dev/null @@ -1,1044 +0,0 @@ -/* - * RxQueue.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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" -#include "timer.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 -#define BA_SESSION_TIME_TO_SLEEP (50) - -#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; - -typedef struct -{ - TI_BOOL bPacketMiss; /* True - Wait for missing packets start timer - False - all packets received in order */ - TI_UINT16 aPacketsStored; /* Represent the number of packets in Queue, 0 - Queue is empty */ - TI_UINT8 aFrameTid; /* save the TID of the missing packet */ -} TPacketTimeout; - - -/* main RxQueue structure in order to management the packets disordered array. */ -typedef struct -{ - TI_HANDLE hOs; /* OS handler */ - TI_HANDLE hReport; /* Report handler */ - TI_HANDLE hTimer; /* Timer Handle */ - TRxQueueArraysMng tRxQueueArraysMng; /* manage each Source Address RxQueue arrays */ - TPacketReceiveCb tReceivePacketCB; /* Receive packets CB address */ - TI_HANDLE hReceivePacketCB_handle; /* Receive packets CB handler */ - TPacketTimeout tPacketTimeout; /* save information about the missing packet */ -} TRxQueue; - -/************************ static function declaration *****************************/ -static TI_STATUS RxQueue_PassPacket (TI_HANDLE hRxQueue, TI_STATUS tStatus, const void *pBuffer); -static void RxQueue_PacketTimeOut (TI_HANDLE hRxQueue, TI_BOOL bTwdInitOccured); - -/** - * \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)); - - 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; - - if (hRxQueue) { - pRxQueue = (TRxQueue *)hRxQueue; - - if (pRxQueue->hTimer) { - tmr_DestroyTimer (pRxQueue->hTimer); - pRxQueue->hTimer = NULL; - } - - /* free module object */ - os_memoryFree (pRxQueue->hOs, pRxQueue, sizeof(TRxQueue)); - - return TI_OK; - } - - return TI_NOK; -} - - -/** - * \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, TI_HANDLE hTimerModule) -{ - TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; - - pRxQueue->hReport = hReport; - - pRxQueue->hTimer = tmr_CreateTimer (hTimerModule); - - 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; - - pRxQueue->tPacketTimeout.aPacketsStored--; - } - - pTidDataBase->aWinStartArrayInex ++; - - /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ - pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; - } - - if (pRxQueue->tPacketTimeout.bPacketMiss) - { - tmr_StopTimer (pRxQueue->hTimer); - pRxQueue->tPacketTimeout.bPacketMiss = TI_FALSE; - } - } -} - - -/** - * \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 winStart 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 than 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 session 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 sends packet, in establish TID BA, with SN less than ESN !!! - */ - - /* Part 1 - 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"); - - /* Stop timer in case that the expected SN received and timer was running */ - - - /* If we wait for 2 consecutive packets we should not stop the timer - This is why we are checking after the while loop, if we have - more packets stored, and if we have, we start the timer again. - */ - if (pRxQueue->tPacketTimeout.bPacketMiss) - { - tmr_StopTimer (pRxQueue->hTimer); - pRxQueue->tPacketTimeout.bPacketMiss = TI_FALSE; - } - - - /* Pass the packet */ - RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); - - /* Increase expected SN to the next */ - pTidDataBase->aTidExpectedSn++; - pTidDataBase->aTidExpectedSn &= 0xfff; /* SN is 12 bits long */ - - /* 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 than 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 than the expected one that was just received."); - 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++; - pTidDataBase->aTidExpectedSn &= 0xfff; /* SN is 12 bits long */ - - /* Decrease the packets in queue */ - pRxQueue->tPacketTimeout.aPacketsStored--; - } - - - /* aTidExpectedSn % 0xfff in order to tack care of wrap around */ - pTidDataBase->aTidExpectedSn &= 0xfff; - - /* If there are still packets stored in the queue - start timer */ - if (pRxQueue->tPacketTimeout.aPacketsStored) - { - tmr_StartTimer (pRxQueue->hTimer, RxQueue_PacketTimeOut, pRxQueue, BA_SESSION_TIME_TO_SLEEP, TI_FALSE); - - pRxQueue->tPacketTimeout.bPacketMiss = TI_TRUE; - pRxQueue->tPacketTimeout.aFrameTid = uFrameTid; - } - - return; - } - - /* Frame Sequence Number is lower than Expected sequence number (ISN) ? */ - if (! BA_SESSION_IS_A_BIGGER_THAN_B (uFrameSn, pTidDataBase->aTidExpectedSn)) - { - /* WLAN_OS_REPORT(("%s: ERROR - SN=%u is less than ESN=%u\n", __FUNCTION__, uFrameSn, pTidDataBase->aTidExpectedSn)); */ - TRACE0(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: frame Sequence Number is lower than expected sequence number.\n"); - - RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); - - return; - } - - /* Part 2 - 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 uSaveIndex = pTidDataBase->aWinStartArrayInex + (TI_UINT16)((uFrameSn + SEQ_NUM_WRAP - pTidDataBase->aTidExpectedSn) & SEQ_NUM_MASK); - - /* uSaveIndex % RX_QUEUE_ARRAY_SIZE */ - uSaveIndex &= 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: uSaveIndex = 0x%x(%d)",uSaveIndex,uSaveIndex); - - /* Before storing packet in queue, make sure the place in the queue is vacant */ - if (pTidDataBase->aPaketsQueue[uSaveIndex].pPacket == NULL) - { - TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: Enter packet to Reorder Queue"); - - /* Store the packet in the queue */ - pTidDataBase->aPaketsQueue[uSaveIndex].tStatus = tStatus; - pTidDataBase->aPaketsQueue[uSaveIndex].pPacket = (void *)pBuffer; - pTidDataBase->aPaketsQueue[uSaveIndex].uFrameSn = uFrameSn; - - pRxQueue->tPacketTimeout.aPacketsStored++; - - - /* Start Timer [only if timer is not already started - according to bPacketMiss] */ - if(pRxQueue->tPacketTimeout.bPacketMiss == TI_FALSE) - { - tmr_StartTimer (pRxQueue->hTimer, RxQueue_PacketTimeOut, pRxQueue, BA_SESSION_TIME_TO_SLEEP, TI_FALSE); - pRxQueue->tPacketTimeout.bPacketMiss = TI_TRUE; - pRxQueue->tPacketTimeout.aFrameTid = uFrameTid; - } - } - else - { - TRACE1(pRxQueue->hReport, REPORT_SEVERITY_ERROR, "RxQueue_ReceivePacket: frame Sequence has already saved. uFrameSn = %d\n", uFrameSn); - - RxQueue_PassPacket (pRxQueue, TI_NOK, pBuffer); - return; - } - return; - } - - - /* - Part 3 - Frame Sequence Number higher than 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 uSaveIndex; - - - TRACE0(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: frame Sequence Number higher than winEnd.\n"); - TRACE2(pRxQueue->hReport, REPORT_SEVERITY_INFORMATION, "RxQueue_ReceivePacket: uNewWinStartSn = 0x%x(%d) STOP TIMER",uNewWinStartSn,uNewWinStartSn); - - /* If timer is on - stop it */ - if (pRxQueue->tPacketTimeout.bPacketMiss) - { - tmr_StopTimer (pRxQueue->hTimer); - pRxQueue->tPacketTimeout.bPacketMiss = TI_FALSE; - } - - /* 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 than 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; - - pRxQueue->tPacketTimeout.aPacketsStored--; - } - - 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"); - /* In case 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; - - pRxQueue->tPacketTimeout.aPacketsStored--; - } - } - - 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++; - pTidDataBase->aTidExpectedSn &= 0xfff; - } - else - { - uSaveIndex = 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: uSaveIndex = 0x%x(%d)", uSaveIndex, uSaveIndex); - - /* uSaveIndex % RX_QUEUE_ARRAY_SIZE */ - uSaveIndex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; - - /* Save the packet in the last entry of the queue */ - pTidDataBase->aPaketsQueue[uSaveIndex].tStatus = tStatus; - pTidDataBase->aPaketsQueue[uSaveIndex].pPacket = (void *)pBuffer; - pTidDataBase->aPaketsQueue[uSaveIndex].pPacket = (void *)pBuffer; - - pRxQueue->tPacketTimeout.aPacketsStored++; - } - - - /* aTidExpectedSn % 0xfff in order to tack care of wrap around */ - pTidDataBase->aTidExpectedSn &= 0xfff; - - /* If there are still packets stored in the queue - start timer */ - if (pRxQueue->tPacketTimeout.aPacketsStored) - { - tmr_StartTimer (pRxQueue->hTimer, RxQueue_PacketTimeOut, pRxQueue, BA_SESSION_TIME_TO_SLEEP, TI_FALSE); - pRxQueue->tPacketTimeout.bPacketMiss = TI_TRUE; - pRxQueue->tPacketTimeout.aFrameTid = uFrameTid; - } - - 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 than winStart ? */ - if ( BA_SESSION_IS_A_BIGGER_THAN_B (uStartingSequenceNumber, pTidDataBase->aTidExpectedSn) ) - { - uWinStartDelta = uStartingSequenceNumber - pTidDataBase->aTidExpectedSn; - if (pRxQueue->tPacketTimeout.bPacketMiss) - { - tmr_StopTimer (pRxQueue->hTimer); - pRxQueue->tPacketTimeout.bPacketMiss = TI_FALSE; - } - - /* pass all saved queue packets with SN lower than 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; - pRxQueue->tPacketTimeout.aPacketsStored--; - } - - pTidDataBase->aWinStartArrayInex++; - - /* aWinStartArrayInex % RX_QUEUE_ARRAY_SIZE */ - pTidDataBase->aWinStartArrayInex &= RX_QUEUE_ARRAY_SIZE_BIT_MASK; - } - - if (pRxQueue->tPacketTimeout.aPacketsStored) - { - tmr_StartTimer (pRxQueue->hTimer, RxQueue_PacketTimeOut, pRxQueue, BA_SESSION_TIME_TO_SLEEP, TI_FALSE); - pRxQueue->tPacketTimeout.bPacketMiss = TI_TRUE; - pRxQueue->tPacketTimeout.aFrameTid = uFrameTid; - } - - - 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: - - - /* 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 than 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: - - - /* get TID field and winSize from ADDBA action frame */ - pDataFrameBody = pDataFrameBody + 1; - 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_INFORMATION, "RxQueue_ReceivePacket: unknow type tag. tag = %d\n", pRxParams->packet_class_tag); - - RxQueue_PassPacket (pRxQueue, tStatus, pBuffer); - - return; -} - - -/* -Function Name : RxQueue_PacketTimeOut - -Description : This function sends all consecutive old packets stored in a specific TID queue to the upper layer. - - This function is called on timer wake up. - [The timer is started when we have stored packets in the RxQueue]. - - -Parameters : hRxQueue - A handle to the RxQueue structure. - bTwdInitOccured - Not used. - -Returned Value: void -*/ -static void RxQueue_PacketTimeOut (TI_HANDLE hRxQueue, TI_BOOL bTwdInitOccured) -{ - TRxQueue *pRxQueue = (TRxQueue *)hRxQueue; - TRxQueueTidDataBase *pTidDataBase; - - pRxQueue->tPacketTimeout.bPacketMiss = TI_FALSE; - - /* Set the SA Tid pointer */ - pTidDataBase = &(pRxQueue->tRxQueueArraysMng.tSa1ArrayMng[pRxQueue->tPacketTimeout.aFrameTid]); - - - if (pRxQueue->tPacketTimeout.aPacketsStored) - { - - /* Find the first stored packet */ - while (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; - } - - - /* Send all packets in order */ - while ((pRxQueue->tPacketTimeout.aPacketsStored > 0) && (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++; - pTidDataBase->aTidExpectedSn &= 0xFFF; - - pRxQueue->tPacketTimeout.aPacketsStored--; - - } - } - - if (pRxQueue->tPacketTimeout.aPacketsStored) - { - tmr_StartTimer (pRxQueue->hTimer, RxQueue_PacketTimeOut, pRxQueue, BA_SESSION_TIME_TO_SLEEP, TI_FALSE); - pRxQueue->tPacketTimeout.bPacketMiss = TI_TRUE; - } -} diff --git a/wl1271/TWD/Data_Service/txCtrlBlk.c b/wl1271/TWD/Data_Service/txCtrlBlk.c deleted file mode 100644 index 41b867b1..00000000 --- a/wl1271/TWD/Data_Service/txCtrlBlk.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * txCtrlBlk.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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)); - 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; - TTxnStruct *pTxn; - 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; - - /* Prepare the Txn fields to the host-slave register (fixed address) */ - pTxn = &(pTxCtrlBlk->aTxCtrlBlkTbl[entry].tTxnStruct); - TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_FIXED_ADDR) - } - - /* 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_EnterCriticalSection (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_LeaveCriticalSection (pTxCtrlBlk->hContext); - return NULL; - } - pTxCtrlBlk->uNumUsedEntries++; -#endif - - /* Link the first entry to the next free entry. */ - pFirstFreeEntry->pNextFreeEntry = pCurrentEntry->pNextFreeEntry; - - context_LeaveCriticalSection (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]); - - if (!pTxCtrlBlk) - { - return; - } - -#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_EnterCriticalSection (pTxCtrlBlk->hContext); - - /* Link the freed entry between entry 0 and the next free entry. */ - pCurrentEntry->pNextFreeEntry = pFirstFreeEntry->pNextFreeEntry; - pFirstFreeEntry->pNextFreeEntry = pCurrentEntry; - - context_LeaveCriticalSection (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) -{ -#ifdef REPORT_LOG - 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 -} -#endif /* TI_DBG */ - diff --git a/wl1271/TWD/Data_Service/txHwQueue.c b/wl1271/TWD/Data_Service/txHwQueue.c deleted file mode 100644 index dda6da06..00000000 --- a/wl1271/TWD/Data_Service/txHwQueue.c +++ /dev/null @@ -1,714 +0,0 @@ -/* - * txHwQueue.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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 2 - -/* 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)); - 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 + 20 ) >> 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 + 20) & 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. - ****************************************************************************/ -ETxnStatus 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); - } - - return TXN_STATUS_COMPLETE; -} - - -/**************************************************************************** - * 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) -{ -#ifdef REPORT_LOG - 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 -} - -#endif /* TI_DBG */ - diff --git a/wl1271/TWD/FW_Transfer/CmdMBox.c b/wl1271/TWD/FW_Transfer/CmdMBox.c deleted file mode 100644 index 4c3dfa71..00000000 --- a/wl1271/TWD/FW_Transfer/CmdMBox.c +++ /dev/null @@ -1,513 +0,0 @@ -/* - * CmdMBox.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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; - - pCmdMbox = os_memoryAlloc (hOs, sizeof (TCmdMbox)); - 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; - - 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; - - /* free timer */ - if (pCmdMbox->hCmdMboxTimer) - { - tmr_DestroyTimer (pCmdMbox->hCmdMboxTimer); - } - - /* 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->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].tCmdMbox; - - - 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 */ - pCmdMbox->aRegTxn[0].uRegister = 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].uRegister), 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 - */ -ETxnStatus cmdMbox_CommandComplete (TI_HANDLE hCmdMbox) -{ - TCmdMbox *pCmdMbox = (TCmdMbox *)hCmdMbox; - TTxnStruct *pCmdTxn = (TTxnStruct*)&pCmdMbox->aCmdTxn[1].tTxnStruct; - Command_t *pCmd = (Command_t*)&pCmdMbox->aCmdTxn[1].tCmdMbox; - 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); - } - - return TXN_STATUS_COMPLETE; -} - - -/* - * \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].tCmdMbox; - - 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].uRegister), REGISTER_SIZE,(TTxnDoneCb)cmdMbox_ConfigHwCb, hCmdMbox) - /* Get the command mailbox address */ - rc = twIf_Transact(pCmdMbox->hTwIf, pRegTxn); - if (rc == TXN_STATUS_COMPLETE) - { - pCmdMbox->uFwAddr = pCmdMbox->aRegTxn[1].uRegister; - } - - 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 = pCmdMbox->aRegTxn[1].uRegister; - - /* 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, CommandStatus_e *cmdStatus) -{ - TCmdMbox *pCmdMbox = (TCmdMbox *)hCmdMbox; - Command_t *pCmd = (Command_t*)&pCmdMbox->aCmdTxn[1].tCmdMbox; - 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->tCmdMbox.cmdStatus = %d\n", status, pCmd->cmdStatus); - *cmdStatus = 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].tCmdMbox; - - /* - * 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) -{ -#ifdef REPORT_LOG - 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 -} - -#endif /* TI_DBG */ - - diff --git a/wl1271/TWD/FW_Transfer/CmdMBox.h b/wl1271/TWD/FW_Transfer/CmdMBox.h deleted file mode 100644 index 1e5db432..00000000 --- a/wl1271/TWD/FW_Transfer/CmdMBox.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * CmdMBox.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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 - - - -typedef struct -{ - TTxnStruct tTxnStruct; - Command_t tCmdMbox; -}TCmdTxn; - -typedef struct -{ - TTxnStruct tTxnStruct; - TI_UINT32 uRegister; -}TRegTxn; - - -/***************************************************************************** - ** Structures ** - *****************************************************************************/ - -/** \struct TCmdMbox - * \brief CmdMbox structure - * - * \par Description - * - * \sa - */ -typedef struct -{ - /* handles */ - TI_HANDLE hOs; - TI_HANDLE hReport; - TI_HANDLE hTwIf; - 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[2]; - TRegTxn aRegTxn[2]; - - /* Holds the module state */ - TI_BOOL bCmdInProgress; - TI_UINT32 uFwAddr; - TI_UINT32 uWriteLen; - TI_UINT32 uReadLen; - -} TCmdMbox; - -#endif - - diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/CmdMBox_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/CmdMBox_api.h deleted file mode 100644 index 940fe070..00000000 --- a/wl1271/TWD/FW_Transfer/Export_Inc/CmdMBox_api.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * CmdMBox_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \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 - */ -ETxnStatus 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, CommandStatus_e *cmdStatus); - - -/* - * \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 diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/FwEvent_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/FwEvent_api.h deleted file mode 100644 index e4d14baa..00000000 --- a/wl1271/TWD/FW_Transfer/Export_Inc/FwEvent_api.h +++ /dev/null @@ -1,224 +0,0 @@ -/* - * FwEvent_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file FwEvent_api.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 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 Called by any handler that completed after pending - * - * \param hFwEvent - FwEvent Driver handle - * - * \par Description - * - * Decrement pending handlers counter and if 0 call the SM to complete its process. - * - * \sa - */ -void fwEvent_HandlerCompleted (TI_HANDLE hFwEvent); - - -/* - * \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). - - * - * \sa - */ -void fwEvent_SetInitMask (TI_HANDLE hFwEvent); - - - -#ifdef TI_DBG - -void fwEvent_PrintStat (TI_HANDLE hFwEvent); - -#endif /* TI_DBG */ - - - -#endif /* _FW_EVENT_API_H */ - - - - - - - diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/HwInit_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/HwInit_api.h deleted file mode 100644 index 52220019..00000000 --- a/wl1271/TWD/FW_Transfer/Export_Inc/HwInit_api.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * HwInit_api.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/***************************************************************************/ -/* */ -/* MODULE: 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 hTimer, - 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_ */ diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/eventMbox_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/eventMbox_api.h deleted file mode 100644 index 8f8417d6..00000000 --- a/wl1271/TWD/FW_Transfer/Export_Inc/eventMbox_api.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * eventMbox_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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" - - -/* - * 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); -ETxnStatus eventMbox_Handle (TI_HANDLE hEventMbox, FwStatus_t *pFwStatus); -#ifdef TI_DBG -TI_STATUS eventMbox_Print (TI_HANDLE hEventMbox); -#endif - -#endif /* _EVENT_MBOX_API_H */ diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/fwDebug_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/fwDebug_api.h deleted file mode 100644 index 988b6d4a..00000000 --- a/wl1271/TWD/FW_Transfer/Export_Inc/fwDebug_api.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * fwDebug_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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 */ - - - - diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/rxXfer_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/rxXfer_api.h deleted file mode 100644 index fa4c024f..00000000 --- a/wl1271/TWD/FW_Transfer/Export_Inc/rxXfer_api.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * rxXfer_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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); - -void rxXfer_SetDefaults (TI_HANDLE hRxXfer, TTwdInitParams *pInitParams); - -void rxXfer_SetBusParams (TI_HANDLE hRxXfer, TI_UINT32 uDmaBufLen); - -ETxnStatus 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); - -void rxXfer_RegisterErrCb (TI_HANDLE hRxXfer, void *fErrCb, TI_HANDLE hErrCb); - -void rxXfer_Restart (TI_HANDLE hRxXfer); - - -#ifdef TI_DBG - -void rxXfer_ClearStats( TI_HANDLE hRxXfer ); - -void rxXfer_PrintStats( TI_HANDLE hRxXfer ); - -#endif /* TI_DBG */ - - -#endif /* _RX_XFER_API_H */ - - - - diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/txResult_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/txResult_api.h deleted file mode 100644 index d6ce41d0..00000000 --- a/wl1271/TWD/FW_Transfer/Export_Inc/txResult_api.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * txResult_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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); -ETxnStatus 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 */ - diff --git a/wl1271/TWD/FW_Transfer/Export_Inc/txXfer_api.h b/wl1271/TWD/FW_Transfer/Export_Inc/txXfer_api.h deleted file mode 100644 index ba4ceda4..00000000 --- a/wl1271/TWD/FW_Transfer/Export_Inc/txXfer_api.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * txXfer_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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: - * ============================ - */ - - -/** - * \fn txXfer_Create - * \brief Create module - * - * Create module - * - * \note - * \param hOs - The OS API handle - * \return The created module handle - * \sa - */ -TI_HANDLE txXfer_Create (TI_HANDLE hOs); - - -/** - * \fn txXfer_Destroy - * \brief Destroy module - * - * Destroy module - * - * \note - * \param hTxXfer - Module handle - * \return TI_OK - * \sa - */ -TI_STATUS txXfer_Destroy (TI_HANDLE hTxXfer); - - -/** - * \fn txXfer_Init - * \brief Initialize module variables - * - * Initialize module variables including saving other modules handles - * - * \note - * \param hTxXfer - Module handle - * \param hXXX - Other modules handles - * \return TI_OK - * \sa - */ -TI_STATUS txXfer_Init (TI_HANDLE hTxXfer, TI_HANDLE hReport, TI_HANDLE hTwIf); - - -/** - * \fn txXfer_Restart - * \brief Restart some module variables - * - * Restart some module variables upon init, stop or recovery - * - * \note - * \param hTxXfer - Module handle - * \return TI_OK - * \sa - */ -TI_STATUS txXfer_Restart (TI_HANDLE hTxXfer); - - -/** - * \fn txXfer_SetDefaults - * \brief Configure module default settings - * - * Configure module default settings from ini file - * - * \note - * \param hTxXfer - Module handle - * \param pInitParams - The default paremeters structure - * \return void - * \sa - */ -void txXfer_SetDefaults (TI_HANDLE hTxXfer, TTwdInitParams *pInitParams); - - -/** - * \fn txXfer_SetBusParams - * \brief Configure bus related parameters - * - * Configure bus driver DMA-able buffer length to be used as a limit to the aggragation length. - * - * \note - * \param hTxXfer - Module handle - * \param uDmaBufLen - The bus driver DMA-able buffer length - * \return void - * \sa - */ -void txXfer_SetBusParams (TI_HANDLE hTxXfer, TI_UINT32 uDmaBufLen); - - -/** - * \fn txXfer_RegisterCb - * \brief Register callback functions - * - * Called by Tx upper layers to register their CB for packet transfer completion. - * Registered only if needed (currently used only by WHA layer). - * - * \note - * \param hTxXfer - Module handle - * \param CallBackID - Type of CB being registered (currently only transfer completion) - * \param CBFunc - The CB function - * \param CBObj - The parameter to provide when calling the CB - * \return void - * \sa - */ -void txXfer_RegisterCb (TI_HANDLE hTxXfer, TI_UINT32 CallBackID, void *CBFunc, TI_HANDLE CBObj); - - -/** - * \fn txXfer_SendPacket - * \brief Send a Tx packet to the FW - * - * Called by the Tx upper layers to send a new Tx packet to the FW (after FW resources were allocated). - * Aggregate the packet if possible, and if needed call txXfer_SendAggregatedPkts to forward - * the aggregation to the FW. - * - * \note - * \param hTxXfer - Module handle - * \param pPktCtrlBlk - The new packet to send - * \return COMPLETE if completed in this context, PENDING if not, ERROR if failed - * \sa - */ -ETxnStatus txXfer_SendPacket (TI_HANDLE hTxXfer, TTxCtrlBlk *pPktCtrlBlk); - - -/** - * \fn txXfer_EndOfBurst - * \brief Indicates that current packets burst stopped - * - * Called by the Tx upper layers to indicate that the current packets burst stopped. - * Sends the current aggregation of packets to the FW. - * - * \note - * \param hTxXfer - module handle - * \return void - * \sa - */ -void txXfer_EndOfBurst (TI_HANDLE hTxXfer); - - - -#ifdef TI_DBG -void txXfer_ClearStats (TI_HANDLE hTxXfer); -void txXfer_PrintStats (TI_HANDLE hTxXfer); -#endif - - - -#endif /* _TX_XFER_API_H */ diff --git a/wl1271/TWD/FW_Transfer/FwEvent.c b/wl1271/TWD/FW_Transfer/FwEvent.c deleted file mode 100644 index 6672aea5..00000000 --- a/wl1271/TWD/FW_Transfer/FwEvent.c +++ /dev/null @@ -1,792 +0,0 @@ -/* - * FwEvent.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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 "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" -#include "public_host_int.h" -#include "FwEvent_api.h" -#ifdef TI_DBG - #include "tracebuf_api.h" -#endif -#include "bmtrace_api.h" - - -#ifdef _VLCT_ -extern int trigger_another_read; -#endif - - -/* - * Address of FW-Status structure in FW memory ==> Special mapping, see note!! - * - * Note: This structure actually includes two separate areas in the FW: - * 1) Interrupt-Status register - a 32 bit register (clear on read). - * 2) FW-Status structure - 64 bytes memory area - * The two areas are read in a single transaction thanks to a special memory - * partition that maps them as contiguous memory. - */ -#define FW_STATUS_ADDR 0x14FC0 + 0xA000 - - -#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 TXN_FW_EVENT_SET_MASK_ADDR(pFwEvent) pFwEvent->tMaskTxn.tTxnStruct.uHwAddr = HINT_MASK; -#define TXN_FW_EVENT_SET_FW_STAT_ADDR(pFwEvent) pFwEvent->tFwStatusTxn.tTxnStruct.uHwAddr = FW_STATUS_ADDR; - -#define UPDATE_PENDING_HANDLERS_NUMBER(eStatus) if (eStatus == TXN_STATUS_PENDING) {pFwEvent->uNumPendHndlrs++;} - - -typedef enum -{ - FWEVENT_STATE_IDLE, - FWEVENT_STATE_WAIT_INTR_INFO, - FWEVENT_STATE_WAIT_HANDLE_COMPLT - -} EFwEventState; - -typedef struct -{ - TTxnStruct tTxnStruct; - TI_UINT32 uData; - -} TRegisterTxn; - -typedef struct -{ - TTxnStruct tTxnStruct; - FwStatus_t tFwStatus; - -} TFwStatusTxn; - -/* The FwEvent module's main structure */ -typedef struct -{ - EFwEventState eSmState; /* State machine state */ - TI_UINT32 uEventMask; /* Static interrupt event mask */ - TI_UINT32 uEventVector; /* Saves the current active FW interrupts */ - TRegisterTxn tMaskTxn; /* The host mask register transaction */ - TFwStatusTxn tFwStatusTxn; /* The FW status structure transaction (read from FW memory) */ - TI_UINT32 uFwTimeOffset; /* Offset in microseconds between driver and FW clocks */ - TI_UINT32 uContextId; /* Client ID got upon registration to the context module */ - TI_BOOL bIntrPending; /* If TRUE a new interrupt is pending while handling the previous one */ - TI_UINT32 uNumPendHndlrs; /* Number of event handlers that didn't complete their event processing */ - - /* Other modules handles */ - TI_HANDLE hOs; - TI_HANDLE hTWD; - TI_HANDLE hReport; - TI_HANDLE hContext; - TI_HANDLE hTwIf; - TI_HANDLE hHealthMonitor; - TI_HANDLE hEventMbox; - TI_HANDLE hCmdMbox; - TI_HANDLE hRxXfer; - TI_HANDLE hTxXfer; - TI_HANDLE hTxHwQueue; - TI_HANDLE hTxResult; - -} TfwEvent; - - -static void fwEvent_NewEvent (TI_HANDLE hFwEvent); -static void fwEvent_StateMachine (TfwEvent *pFwEvent); -static ETxnStatus fwEvent_SmReadIntrInfo (TfwEvent *pFwEvent); -static ETxnStatus fwEvent_SmHandleEvents (TfwEvent *pFwEvent); -static ETxnStatus fwEvent_CallHandlers (TfwEvent *pFwEvent); - - -/* - * \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)); - if (pFwEvent == NULL) - { - return NULL; - } - - os_memoryZero (hOs, pFwEvent, sizeof(TfwEvent)); - - 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) - { - 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->eSmState = FWEVENT_STATE_IDLE; - pFwEvent->bIntrPending = TI_FALSE; - pFwEvent->uNumPendHndlrs = 0; - pFwEvent->uEventMask = 0; - pFwEvent->uEventVector = 0; - - /* Prepare Interrupts Mask regiter Txn structure */ - /* - * Note!!: The mask transaction is sent in low priority because it is used in the - * init process which includes a long sequence of low priority transactions, - * and the order of this sequence is important so we must use the same priority - */ - pTxn = (TTxnStruct*)&pFwEvent->tMaskTxn.tTxnStruct; - TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_WRITE, TXN_INC_ADDR) - BUILD_TTxnStruct(pTxn, HINT_MASK, &pFwEvent->tMaskTxn.uData, REGISTER_SIZE, NULL, NULL) - - /* Prepare FW status Txn structure (includes 4 bytes interrupt status reg and 64 bytes FW-status from memory area) */ - /* Note: This is the only transaction that is sent in high priority. - * The original reason was to lower the interrupt latency, but we may consider using the - * same priority as all other transaction for simplicity. - */ - 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, FW_STATUS_ADDR, &pFwEvent->tFwStatusTxn.tFwStatus, sizeof(FwStatus_t), (TTxnDoneCb)fwEvent_StateMachine, hFwEvent) - - /* - * 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_NewEvent, - hFwEvent, - TI_FALSE, - "FW_EVENT", - sizeof("FW_EVENT")); - - return TI_OK; -} - - -/* - * \brief FW interrupt handler, just switch to WLAN context for handling - * - * \param hFwEvent - FwEvent Driver handle - * \return void - * - * \par Description - * Called by the FW-Interrupt ISR (external context!). - * Requests the context engine to schedule the driver task for handling the FW-Events. - * - * \sa - */ -void fwEvent_InterruptRequest (TI_HANDLE hFwEvent) -{ - TfwEvent *pFwEvent = (TfwEvent *)hFwEvent; - CL_TRACE_START_L1(); - - TRACE0(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_InterruptRequest()\n"); - - /* Request switch to driver context for handling the FW-Interrupt event */ - context_RequestSchedule (pFwEvent->hContext, pFwEvent->uContextId); - - CL_TRACE_END_L1("tiwlan_drv.ko", "IRQ", "FwEvent", ""); -} - - -/* - * \brief The CB called in the driver context upon new interrupt - * - * \param hFwEvent - FwEvent Driver handle - * \return void - * - * \par Description - * Called by the context module after scheduled by fwEvent_InterruptRequest(). - * If IDLE, start the SM, and if not just indicate pending event for later. - * - * \sa - */ -static void fwEvent_NewEvent (TI_HANDLE hFwEvent) -{ - TfwEvent *pFwEvent = (TfwEvent *)hFwEvent; - CL_TRACE_START_L2(); - - /* If the SM is idle, call it to start handling new events */ - if (pFwEvent->eSmState == FWEVENT_STATE_IDLE) - { - TRACE0(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_NewEvent: Start SM\n"); - - fwEvent_StateMachine (pFwEvent); - } - /* Else - SM is busy so set flag to handle it when finished with current events */ - else - { - TRACE0(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_NewEvent: SM busy, set IntrPending flag\n"); - - pFwEvent->bIntrPending = TI_TRUE; - } - - CL_TRACE_END_L2("tiwlan_drv.ko", "CONTEXT", "FwEvent", ""); -} - - -/* - * \brief FW-Event state machine - * - * \param hFwEvent - FwEvent Driver handle - * \return void - * - * \par Description - * - * Process the current FW events in a sequence that may progress in the same context, - * or exit if pending an Async transaction, which will call back the SM when finished. - * - * \sa - */ -static void fwEvent_StateMachine (TfwEvent *pFwEvent) -{ - ETxnStatus eStatus = TXN_STATUS_ERROR; /* Set to error to detect if used uninitialized */ - CL_TRACE_START_L3(); - - /* - * Loop through the states sequence as long as the process is synchronous. - * Exit when finished or if an Asynchronous process is required. - * In this case the SM will be called back upon Async operation completion. - */ - while (1) - { - switch (pFwEvent->eSmState) - { - /* IDLE: Update TwIf and read interrupt info from FW */ - case FWEVENT_STATE_IDLE: - { - CL_TRACE_START_L5(); - twIf_Awake(pFwEvent->hTwIf); - eStatus = fwEvent_SmReadIntrInfo (pFwEvent); - pFwEvent->eSmState = FWEVENT_STATE_WAIT_INTR_INFO; - CL_TRACE_END_L5("tiwlan_drv.ko", "CONTEXT", "FwEvent", ".ReadInfo"); - break; - } - /* WAIT_INTR_INFO: We have the interrupt info so call the handlers accordingly */ - case FWEVENT_STATE_WAIT_INTR_INFO: - { - CL_TRACE_START_L5(); - eStatus = fwEvent_SmHandleEvents (pFwEvent); - /* If state was changed to IDLE by recovery or stop process, exit (process terminated) */ - if (pFwEvent->eSmState == FWEVENT_STATE_IDLE) - { - CL_TRACE_END_L5("tiwlan_drv.ko", "CONTEXT", "FwEvent", ".HndlEvents"); - CL_TRACE_END_L3("tiwlan_drv.ko", "CONTEXT", "FwEvent", ""); - return; - } - pFwEvent->eSmState = FWEVENT_STATE_WAIT_HANDLE_COMPLT; - CL_TRACE_END_L5("tiwlan_drv.ko", "CONTEXT", "FwEvent", ".HndlEvents"); - break; - } - /* WAIT_HANDLE_COMPLT: Current handling is completed. */ - case FWEVENT_STATE_WAIT_HANDLE_COMPLT: - { - /* If pending interrupt, read interrupt info (back to WAIT_INTR_INFO state) */ - if (pFwEvent->bIntrPending) - { - CL_TRACE_START_L5(); - pFwEvent->bIntrPending = TI_FALSE; - eStatus = fwEvent_SmReadIntrInfo (pFwEvent); - pFwEvent->eSmState = FWEVENT_STATE_WAIT_INTR_INFO; - CL_TRACE_END_L5("tiwlan_drv.ko", "CONTEXT", "FwEvent", ".HndlCmplt"); - } - /* Else - all done so release TwIf to sleep and exit */ - else - { - twIf_Sleep(pFwEvent->hTwIf); - pFwEvent->eSmState = FWEVENT_STATE_IDLE; - - TRACE3(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_StateMachine: Completed, NewState=%d, Status=%d, IntrPending=%d\n", pFwEvent->eSmState, eStatus, pFwEvent->bIntrPending); - CL_TRACE_END_L3("tiwlan_drv.ko", "CONTEXT", "FwEvent", ""); - - /**** Finished all current events handling so exit ****/ - return; - } - break; - } - - } /* switch */ - - TRACE3(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_StateMachine: NewState=%d, Status=%d, IntrPending=%d\n", pFwEvent->eSmState, eStatus, pFwEvent->bIntrPending); - - /* If last status is Pending, exit the SM (to be called back upon Async operation completion) */ - if (eStatus == TXN_STATUS_PENDING) - { - CL_TRACE_END_L3("tiwlan_drv.ko", "CONTEXT", "FwEvent", ""); - return; - } - - /* If error occured, stop the process and exit (should be cleaned by recovery process) */ - else if (eStatus == TXN_STATUS_ERROR) - { - TRACE5(pFwEvent->hReport, REPORT_SEVERITY_ERROR, "fwEvent_StateMachine: NewState=%d, Status=%d, IntrPending=%d, EventVector=0x%x, EventMask=0x%x\n", pFwEvent->eSmState, eStatus, pFwEvent->bIntrPending, pFwEvent->uEventVector, pFwEvent->uEventMask); - CL_TRACE_END_L3("tiwlan_drv.ko", "CONTEXT", "FwEvent", ""); - fwEvent_Stop ((TI_HANDLE)pFwEvent); - return; - } - - /* If we got here the status is COMPLETE so continue in the while loop to the next state */ - - } /* while */ -} - - -/* - * \brief Read interrupt info from FW - * - * \param hFwEvent - FwEvent Driver handle - * \return void - * - * \par Description - * - * Indicate the TwIf that HW is available and initiate transactions for reading - * the Interrupt status and the FW status. - * - * \sa - */ -static ETxnStatus fwEvent_SmReadIntrInfo (TfwEvent *pFwEvent) -{ - ETxnStatus eStatus; - CL_TRACE_START_L4(); - -#ifdef HOST_INTR_MODE_EDGE - /* Acknowledge the host interrupt for EDGE mode (must be before HINT_STT_CLR register clear on read) */ - os_InterruptServiced (pFwEvent->hOs); -#endif - - /* Indicate that the chip is awake (since it interrupted us) */ - twIf_HwAvailable(pFwEvent->hTwIf); - - /* - * Read FW-Status structure from HW ==> Special mapping, see note!! - * - * Note: This structure actually includes two separate areas in the FW: - * 1) Interrupt-Status register - a 32 bit register (clear on read). - * 2) FW-Status structure - 64 bytes memory area - * The two areas are read in a single transaction thanks to a special memory - * partition that maps them as contiguous memory. - */ - TXN_FW_EVENT_SET_FW_STAT_ADDR(pFwEvent) - eStatus = twIf_TransactReadFWStatus (pFwEvent->hTwIf, &(pFwEvent->tFwStatusTxn.tTxnStruct)); - - CL_TRACE_END_L4("tiwlan_drv.ko", "CONTEXT", "FwEvent", ""); - - /* Return the status of the FwStatus read (complete, pending or error) */ - return eStatus; -} - - -/* - * \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_CallHandlers to handle the triggered interrupts. - * - * \sa fwEvent_Handle - */ -static ETxnStatus fwEvent_SmHandleEvents (TfwEvent *pFwEvent) -{ - ETxnStatus eStatus; - CL_TRACE_START_L4(); - - /* Save delta between driver and FW time (needed for Tx packets lifetime) */ - pFwEvent->uFwTimeOffset = (os_timeStampMs (pFwEvent->hOs) * 1000) - - ENDIAN_HANDLE_LONG (pFwEvent->tFwStatusTxn.tFwStatus.fwLocalTime); - -#ifdef HOST_INTR_MODE_LEVEL - /* Acknowledge the host interrupt for LEVEL mode (must be after HINT_STT_CLR register clear on read) */ - os_InterruptServiced (pFwEvent->hOs); -#endif - - /* Save the interrupts status retreived from the FW */ - pFwEvent->uEventVector = pFwEvent->tFwStatusTxn.tFwStatus.intrStatus; - - /* Mask unwanted interrupts */ - pFwEvent->uEventVector &= pFwEvent->uEventMask; - - /* Call the interrupts handlers */ - eStatus = fwEvent_CallHandlers (pFwEvent); - - TRACE5(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_SmHandleEvents: Status=%d, EventVector=0x%x, IntrPending=%d, NumPendHndlrs=%d, FwTimeOfst=%d\n", eStatus, pFwEvent->uEventVector, pFwEvent->bIntrPending, pFwEvent->uNumPendHndlrs, pFwEvent->uFwTimeOffset); - CL_TRACE_END_L4("tiwlan_drv.ko", "CONTEXT", "FwEvent", ""); - - /* Return the status of the handlers processing (complete, pending or error) */ - return eStatus; -} - - -/* - * \brief Call FwEvent clients event handlers - * - * \param hFwEvent - FwEvent Driver handle - * \return void - * - * \par Description - * - * \sa - */ -static ETxnStatus fwEvent_CallHandlers (TfwEvent *pFwEvent) -{ - ETxnStatus eStatus; - CL_TRACE_START_L4(); - - pFwEvent->uNumPendHndlrs = 0; - - if (pFwEvent->uEventVector & ACX_INTR_WATCHDOG) - { - /* Fw watchdog timeout has occured */ - eStatus = TWD_WdExpireEvent (pFwEvent->hTWD); - UPDATE_PENDING_HANDLERS_NUMBER(eStatus) - } - - if (pFwEvent->uEventVector & ACX_INTR_INIT_COMPLETE) - { - TRACE0(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_CallHandlers: INIT_COMPLETE\n"); - } - /* Note: Handle Cmd-MBOX before Event-MBOX to keep command response and command complete order (for WHA) */ - if (pFwEvent->uEventVector & ACX_INTR_CMD_COMPLETE) - { - /* Command Mbox completed */ - eStatus = cmdMbox_CommandComplete(pFwEvent->hCmdMbox); - UPDATE_PENDING_HANDLERS_NUMBER(eStatus) - } - if (pFwEvent->uEventVector & ACX_INTR_EVENT_A) - { - eStatus = eventMbox_Handle(pFwEvent->hEventMbox,&pFwEvent->tFwStatusTxn.tFwStatus); - UPDATE_PENDING_HANDLERS_NUMBER(eStatus) - } - if (pFwEvent->uEventVector & ACX_INTR_EVENT_B) - { - eStatus = eventMbox_Handle(pFwEvent->hEventMbox,&pFwEvent->tFwStatusTxn.tFwStatus); - UPDATE_PENDING_HANDLERS_NUMBER(eStatus) - } - - /* The DATA interrupt is shared by all data path events, so call all Tx and Rx clients */ - if (pFwEvent->uEventVector & ACX_INTR_DATA) - { - eStatus = rxXfer_RxEvent (pFwEvent->hRxXfer, &pFwEvent->tFwStatusTxn.tFwStatus); - UPDATE_PENDING_HANDLERS_NUMBER(eStatus) - - eStatus = txHwQueue_UpdateFreeResources (pFwEvent->hTxHwQueue, &pFwEvent->tFwStatusTxn.tFwStatus); - UPDATE_PENDING_HANDLERS_NUMBER(eStatus) - - eStatus = txResult_TxCmpltIntrCb (pFwEvent->hTxResult, &pFwEvent->tFwStatusTxn.tFwStatus); - UPDATE_PENDING_HANDLERS_NUMBER(eStatus) - } - - CL_TRACE_END_L4("tiwlan_drv.ko", "CONTEXT", "FwEvent", ""); - - /* Return COMPLETE if all handlers completed, and PENDING if not. */ - return ((pFwEvent->uNumPendHndlrs == 0) ? TXN_STATUS_COMPLETE : TXN_STATUS_PENDING); -} - - -/* - * \brief Called by any handler that completed after pending - * - * \param hFwEvent - FwEvent Driver handle - * - * \par Description - * - * Decrement pending handlers counter and if 0 call the SM to complete its process. - * - * \sa - */ -void fwEvent_HandlerCompleted (TI_HANDLE hFwEvent) -{ - TfwEvent *pFwEvent = (TfwEvent *)hFwEvent; - -#ifdef TI_DBG - TRACE2(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_HandlerCompleted: state=%d, NumPendHndlrs=%d\n", pFwEvent->eSmState, pFwEvent->uNumPendHndlrs); - /* Verify that we really have pending handlers, otherwise it an error */ - if (pFwEvent->uNumPendHndlrs == 0) - { - TRACE0(pFwEvent->hReport, REPORT_SEVERITY_ERROR, "fwEvent_HandlerCompleted: Called while no handlers are pending\n"); - return; - } - /* Verify that we are in */ - if (pFwEvent->eSmState != FWEVENT_STATE_WAIT_HANDLE_COMPLT) - { - TRACE1(pFwEvent->hReport, REPORT_SEVERITY_ERROR, "fwEvent_HandlerCompleted: Called while not in WAIT_HANDLE_COMPLT state (state=%d)\n", pFwEvent->eSmState); - return; - } -#endif - - /* Decrement the pending handlers counter and if zero call the SM to complete the process */ - pFwEvent->uNumPendHndlrs--; - if (pFwEvent->uNumPendHndlrs == 0) - { - fwEvent_StateMachine (pFwEvent); - } -} - - -/* - * \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). - * - * \sa - */ -void fwEvent_SetInitMask (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; - pFwEvent->tMaskTxn.uData = ~pFwEvent->uEventMask; - TXN_FW_EVENT_SET_MASK_ADDR(pFwEvent) - twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tMaskTxn.tTxnStruct)); -} - - -/* - * \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->eSmState = FWEVENT_STATE_IDLE; - pFwEvent->bIntrPending = TI_FALSE; - pFwEvent->uNumPendHndlrs = 0; - pFwEvent->uEventMask = 0; - pFwEvent->uEventVector = 0; - - return TI_OK; -} - - -/* - * \brief Unmask all interrupts - * - * \param hFwEvent - FwEvent Driver handle - * \return void - * - * \par Description - * - * Called after driver Start or Recovery process are completed. - * Unmask all interrupts. - * - * \sa - */ -void fwEvent_EnableExternalEvents (TI_HANDLE hFwEvent) -{ - TfwEvent *pFwEvent = (TfwEvent *)hFwEvent; - - /* Unmask all interrupts */ - pFwEvent->uEventMask = ALL_EVENTS_VECTOR; - pFwEvent->tMaskTxn.uData = ~pFwEvent->uEventMask; - TXN_FW_EVENT_SET_MASK_ADDR(pFwEvent) - twIf_Transact(pFwEvent->hTwIf, &(pFwEvent->tMaskTxn.tTxnStruct)); -} - - -/* - * \brief Disable the FwEvent client in the context 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 in the context 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); -} - - -#ifdef TI_DBG - -void fwEvent_PrintStat (TI_HANDLE hFwEvent) -{ -#ifdef REPORT_LOG - TfwEvent *pFwEvent = (TfwEvent *)hFwEvent; - - WLAN_OS_REPORT(("Print FW event module info\n")); - WLAN_OS_REPORT(("==========================\n")); - WLAN_OS_REPORT(("uEventVector = 0x%x\n", pFwEvent->uEventVector)); - WLAN_OS_REPORT(("uEventMask = 0x%x\n", pFwEvent->uEventMask)); - WLAN_OS_REPORT(("eSmState = %d\n", pFwEvent->eSmState)); - WLAN_OS_REPORT(("bIntrPending = %d\n", pFwEvent->bIntrPending)); - WLAN_OS_REPORT(("uNumPendHndlrs = %d\n", pFwEvent->uNumPendHndlrs)); - WLAN_OS_REPORT(("uFwTimeOffset = %d\n", pFwEvent->uFwTimeOffset)); -#endif -} - -#endif /* TI_DBG */ - - - diff --git a/wl1271/TWD/FW_Transfer/HwInit.c b/wl1271/TWD/FW_Transfer/HwInit.c deleted file mode 100644 index addca889..00000000 --- a/wl1271/TWD/FW_Transfer/HwInit.c +++ /dev/null @@ -1,2360 +0,0 @@ -/* - * HwInit.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - - -/*******************************************************************************/ -/* */ -/* MODULE: 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 "timer.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" -#ifdef TI_RANDOM_DEFAULT_MAC -#include <linux/random.h> -#include <linux/jiffies.h> -#endif - - -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_PRE_PARAMETERS_LENGTH) + (NVS_TX_TYPE_INDEX) + 4) - -#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 - -#define DRPw_MASK_CHECK 0xc0 -#define DRPw_MASK_SET 0x2000000 - -/* time to wait till we check if fw is running */ -#define STALL_TIMEOUT 7 - -#ifdef DOWNLOAD_TIMER_REQUIERD -#define FIN_LOOP 10 -#endif - - -#ifdef _VLCT_ -#define FIN_LOOP 10 -#else -#define FIN_LOOP 20000 -#endif - - -/************************************************************************ - * 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); \ - pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData = (TI_UINT32)uVal; \ - BUILD_TTxnStruct(pTxn, uAddr, &(pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData), 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.tFwStaticInfo), 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: \ - 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_UINT32 uData; - -} THwInitTxn; - -typedef struct -{ - TTxnStruct tTxnStruct; - FwStaticData_t tFwStaticInfo; - -} 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; - TI_HANDLE hStallTimer; - - /* 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 auFwTmpBuf [WSPI_PAD_LEN_WRITE + MAX_SDIO_BLOCK]; - - 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); -#ifdef DOWNLOAD_TIMER_REQUIERD -static void hwInit_StallTimerCb (TI_HANDLE hHwInit, TI_BOOL bTwdInitOccured); -#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; - - /* Allocate HwInit module */ - pHwInit = os_memoryAlloc (hOs, sizeof(THwInit)); - - if (pHwInit == NULL) - { - WLAN_OS_REPORT(("Error allocating the HwInit Module\n")); - return NULL; - } - - /* Reset HwInit module */ - os_memoryZero (hOs, pHwInit, sizeof(THwInit)); - - 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; - - if (pHwInit->hStallTimer) - { -#ifdef DOWNLOAD_TIMER_REQUIERD - tmr_DestroyTimer (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 hTimer, - TI_HANDLE hTWD, - TI_HANDLE hFinalizeDownload, - TFinalizeCb fFinalizeDownload, - TEndOfHwInitCb fInitHwCb) -{ - THwInit *pHwInit = (THwInit *)hHwInit; - TTxnStruct* pTxn; -#ifdef TI_RANDOM_DEFAULT_MAC - u32 rand_mac; -#endif - - /* 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) -#ifdef TI_RANDOM_DEFAULT_MAC - /* Create random MAC address: offset 3, 4 and 5 */ - srandom32((u32)jiffies); - rand_mac = random32(); - pHwInit->aDefaultNVS[3] = (u8)rand_mac; - pHwInit->aDefaultNVS[4] = (u8)(rand_mac >> 8); - pHwInit->aDefaultNVS[5] = (u8)(rand_mac >> 16); -#endif - - 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) - } - -#ifdef DOWNLOAD_TIMER_REQUIERD - pHwInit->hStallTimer = tmr_CreateTimer (hTimer); - 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; - - pHwInit->pEEPROMBuf = pbuf; - 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 pPartition - all partition base address - * \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 the bus addresses partition to its "running" mode */ - SET_WORK_PARTITION(pHwInit->aPartition) - 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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - 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 the bus addresses partition to DRPw registers region */ - SET_DRP_PARTITION(pHwInit->aPartition) - 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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - pHwInit->uTxnIndex = 0; /* Reset index only after getting the last read value! */ - clkVal |= ((pGenParams->RefClk & 0x3)<< 1) << 4; - if ((pGenParams->GeneralSettings & DRPw_MASK_CHECK) > 0) - { - clkVal |= DRPw_MASK_SET; - } - 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 the bus addresses partition back to its "running" mode */ - SET_WORK_PARTITION(pHwInit->aPartition) - 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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - - /* 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(("Error!! 1273 PG 1.0 is not supported anymore!!.\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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - /* Now we can zero the index */ - pHwInit->uTxnIndex = 0; - - WLAN_OS_REPORT(("Chip ID is 0x%X.\n", pHwInit->uBootData)); - /* if the WLAN_EN is ON but MainClock is problamtic the chip-id will be zero*/ - if (pHwInit->uBootData == 0) - { - WLAN_OS_REPORT(("Cannot read ChipID stopping\n", pHwInit->uBootData)); - TWD_FinalizeOnFailure (pHwInit->hTWD); - return TXN_STATUS_ERROR; - } - - - - /* 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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - - 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; - 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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - /* 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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - - 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; - -#ifndef DOWNLOAD_TIMER_REQUIERD - 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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - /* 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 ++; - -#ifdef DOWNLOAD_TIMER_REQUIERD - tmr_StartTimer (pHwInit->hStallTimer, hwInit_StallTimerCb, hHwInit, STALL_TIMEOUT, TI_FALSE); - return TXN_STATUS_PENDING; -#endif - } -#ifndef DOWNLOAD_TIMER_REQUIERD - 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 */ - SET_WORK_PARTITION(pHwInit->aPartition) - hwInit_SetPartition (pHwInit,pHwInit->aPartition); - - /* Unmask interrupts needed in the FW configuration phase */ - fwEvent_SetInitMask (pTWD->hFwEvent); - - /* Get FW static information from mailbox area */ - 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, &(pHwInit->tFwStaticTxn.tFwStaticInfo)); - - /* 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) - status = twIf_Transact(pHwInit->hTwIf, pTxn); - pHwInit->uTxnIndex++; - 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 the bus addresses partition to its "running" mode */ - SET_WORK_PARTITION(pHwInit->aPartition) - 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 bus memory partition to current download area */ - SET_FW_LOAD_PARTITION(pHwInit->aPartition,pHwInit->uFwAddress) - 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; - - continue; - - 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 bus memory partition to current download area */ - SET_FW_LOAD_PARTITION(pHwInit->aPartition,pHwInit->uFwAddress) - 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"); - } - continue; - - case 3: - pHwInit->uLoadStage = 2; - - pHwInit->uTxnIndex = 0; - - /* Copy image block to temporary buffer */ - os_memoryCopy (pHwInit->hOs, - (void *)&pHwInit->auFwTmpBuf[WSPI_PAD_LEN_WRITE], - (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->auFwTmpBuf + WSPI_PAD_LEN_WRITE), 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); - continue; - - case 4: - pHwInit->uLoadStage = 5; - - pHwInit->uTxnIndex = 0; - - /* If No Last block to write */ - if ( pHwInit->uFwLength % MAX_SDIO_BLOCK == 0 ) - { - continue; - } - - - /* Copy the last image block */ - os_memoryCopy (pHwInit->hOs, - (void *)&pHwInit->auFwTmpBuf[WSPI_PAD_LEN_WRITE], - (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->auFwTmpBuf + WSPI_PAD_LEN_WRITE), (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); - continue; - - 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 = (pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData); - 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 = (pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData); - - 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 , "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) - - /*BUILD_HW_INIT_TXN_DATA(pHwInit, pTxn, INDIRECT_REG5, 0x1, - REGISTER_SIZE, TXN_DIRECTION_WRITE, NULL, NULL) */ - - 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 = (pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData); - 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 = (pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData); - val &= 0x20000; - if(val) - { - pGenParams->TXBiPFEMManufacturer = FEM_TRIQUINT_TYPE_E; - } - else - { - pGenParams->TXBiPFEMManufacturer = FEM_RFMD_TYPE_E; - } - WLAN_OS_REPORT (("FEM Type %d \n",pGenParams->TXBiPFEMManufacturer)); - pHwInit->uTxnIndex = 0; - pHwInit->uRegSeqStage = 1; - pHwInit->uRegStage = 2; - pHwInit->uRegData = FUNC7_PULL; - continue; - } - else - { - TRACE0(pHwInit->hReport, REPORT_SEVERITY_INFORMATION, "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,value; - TI_UINT32 val=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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - - 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 - TRACE0(pHwInit->hReport, REPORT_SEVERITY_INFORMATION , "Hwinit IRQ polarity active high\n"); - val |= 0x0<<1; - -#else - TRACE0(pHwInit->hReport, REPORT_SEVERITY_INFORMATION , "Hwinit IRQ polarity active low\n"); - 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_TopRegisterWrite () - **************************************************************************** - * 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 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 = pHwInit->aHwInitTxn[pHwInit->uTxnIndex].uData; - - 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 write 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 */ - - } - - -/**************************************************************************** -* hwInit_StallTimerCb () -**************************************************************************** -* DESCRIPTION: CB timer function in fTimerFunction format that calls hwInit_StallTimerCb -* INPUTS: TI_HANDLE hHwInit -* -* OUTPUT: None -* -* RETURNS: None -****************************************************************************/ -#ifdef DOWNLOAD_TIMER_REQUIERD - static void hwInit_StallTimerCb (TI_HANDLE hHwInit, TI_BOOL bTwdInitOccured) -{ - hwInit_FinalizeDownloadSm (hHwInit); -} -#endif diff --git a/wl1271/TWD/FW_Transfer/HwInit.h b/wl1271/TWD/FW_Transfer/HwInit.h deleted file mode 100644 index f34e684c..00000000 --- a/wl1271/TWD/FW_Transfer/HwInit.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * HwInit.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/***************************************************************************/ -/* */ -/* MODULE: HwInit.h */ -/* PURPOSE: HwInit module Header file */ -/* */ -/***************************************************************************/ - - -#ifndef _HW_INIT_H_ -#define _HW_INIT_H_ - - -#endif /* _HW_INIT_H_ */ diff --git a/wl1271/TWD/FW_Transfer/RxXfer.c b/wl1271/TWD/FW_Transfer/RxXfer.c deleted file mode 100644 index 9e829645..00000000 --- a/wl1271/TWD/FW_Transfer/RxXfer.c +++ /dev/null @@ -1,909 +0,0 @@ -/* - * RxXfer.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * MODULE: 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_api.h" -#include "FwEvent_api.h" -#include "TWDriverInternal.h" -#include "RxQueue_api.h" -#include "TwIf.h" -#include "public_host_int.h" -#include "bmtrace_api.h" - -#define RX_DRIVER_COUNTER_ADDRESS 0x300538 -#define PLCP_HEADER_LENGTH 8 -#define WORD_SIZE 4 -#define UNALIGNED_PAYLOAD 0x1 -#define RX_DESCRIPTOR_SIZE (sizeof(RxIfDescriptor_t)) -#define MAX_PACKETS_NUMBER 8 -#define MAX_CONSECUTIVE_READ_TXN 16 -#define MAX_PACKET_SIZE 8192 /* Max Txn size */ - -#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 SLV_MEM_CP_VALUE(desc, offset) (((RX_DESC_GET_MEM_BLK(desc) << 8) + offset)) -#define ALIGNMENT_SIZE(desc) ((RX_DESC_GET_UNALIGNED(desc) & UNALIGNED_PAYLOAD) ? 2 : 0) - -#if (NUM_RX_PKT_DESC & (NUM_RX_PKT_DESC - 1)) - #error NUM_RX_PKT_DESC is not a power of 2 which may degrade performance when we calculate modulo!! -#endif - - -#ifdef TI_DBG -typedef struct -{ - TI_UINT32 uCountFwEvents; - TI_UINT32 uCountPktsForward; - TI_UINT32 uCountBufPend; - TI_UINT32 uCountBufNoMem; - TI_UINT32 uCountPktAggreg[MAX_XFER_BUFS]; - -} TRxXferDbgStat; -#endif - -typedef struct -{ - TTxnStruct tTxnStruct; - TI_UINT32 uRegData; - TI_UINT32 uRegAdata; - -} TRegTxn; - -typedef struct -{ - TTxnStruct tTxnStruct; - TI_UINT32 uCounter; - -} TCounterTxn; - -typedef struct -{ - TI_HANDLE hOs; - TI_HANDLE hReport; - TI_HANDLE hTwIf; - TI_HANDLE hFwEvent; - TI_HANDLE hRxQueue; - - TI_UINT32 aRxPktsDesc[NUM_RX_PKT_DESC]; /* Save Rx packets short descriptors from FwStatus */ - TI_UINT32 uFwRxCntr; /* Save last FW packets counter from FwStatus */ - TI_UINT32 uDrvRxCntr; /* The current driver processed packets counter */ - TI_UINT32 uPacketMemoryPoolStart; /* The FW mem-blocks area base address */ - TI_UINT32 uMaxAggregLen; /* The max length in bytes of aggregated packets transaction */ - TI_UINT32 uMaxAggregPkts; /* The max number of packets that may be aggregated in one transaction */ - TRequestForBufferCb RequestForBufferCB; /* Upper layer CB for allocating buffers for packets */ - TI_HANDLE RequestForBufferCB_handle; /* The upper later CB handle */ - TI_BOOL bPendingBuffer; /* If TRUE, we exited the Rx handler upon pending-buffer */ - - TI_UINT32 uCurrTxnIndex; /* The current Txn structures index to use */ - TI_UINT32 uAvailableTxn; /* Number of Txn structures currently available */ - TRegTxn aSlaveRegTxn[MAX_CONSECUTIVE_READ_TXN]; /* Txn structures for writing mem-block address reg */ - TTxnStruct aTxnStruct[MAX_CONSECUTIVE_READ_TXN]; /* Txn structures for reading the Rx packets */ - TCounterTxn aCounterTxn[MAX_CONSECUTIVE_READ_TXN]; /* Txn structures for writing the driver counter workaround */ - - TI_UINT8 aTempBuffer[MAX_PACKET_SIZE]; /* Dummy buffer to use if we couldn't get a buffer for the packet (so drop the packet) */ - TFailureEventCb fErrCb; /* The upper layer CB function for error handling */ - TI_HANDLE hErrCb; /* The CB function handle */ - -#ifdef TI_DBG - TRxXferDbgStat tDbgStat; -#endif - -} TRxXfer; - - -/************************ static function declaration *****************************/ -static TI_STATUS rxXfer_Handle(TI_HANDLE hRxXfer); -static void rxXfer_TxnDoneCb (TI_HANDLE hRxXfer, TTxnStruct* pTxn); -static void rxXfer_PktDropTxnDoneCb (TI_HANDLE hRxXfer, TTxnStruct *pTxn); -static ETxnStatus rxXfer_IssueTxn (TI_HANDLE hRxXfer, TI_UINT32 uFirstMemBlkAddr); -static void rxXfer_ForwardPacket (TRxXfer* 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) -{ - TRxXfer *pRxXfer; - - pRxXfer = os_memoryAlloc (hOs, sizeof(TRxXfer)); - if (pRxXfer == NULL) - return NULL; - - /* For all the counters */ - os_memoryZero (hOs, pRxXfer, sizeof(TRxXfer)); - - 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) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - - if (pRxXfer) - { - os_memoryFree (pRxXfer->hOs, pRxXfer, sizeof(TRxXfer)); - } -} - - -/**************************************************************************** - * rxXfer_init() - **************************************************************************** - * DESCRIPTION: Init the module object - * - * INPUTS: hRxXfer - module handle; - * other modules handles. - * - * OUTPUT: None - * - * RETURNS: None - ****************************************************************************/ -void rxXfer_Init(TI_HANDLE hRxXfer, - TI_HANDLE hFwEvent, - TI_HANDLE hReport, - TI_HANDLE hTwIf, - TI_HANDLE hRxQueue) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - pRxXfer->hFwEvent = hFwEvent; - pRxXfer->hReport = hReport; - pRxXfer->hTwIf = hTwIf; - pRxXfer->hRxQueue = hRxQueue; - - rxXfer_Restart (hRxXfer); - -#ifdef TI_DBG - rxXfer_ClearStats (pRxXfer); -#endif -} - - -/**************************************************************************** - * rxXfer_SetDefaults() - **************************************************************************** - * DESCRIPTION: Set module parameters default setting - * - * INPUTS: hRxXfer - module handle; - * - * OUTPUT: None - * - * RETURNS: None - ****************************************************************************/ -void rxXfer_SetDefaults (TI_HANDLE hRxXfer, TTwdInitParams *pInitParams) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - - pRxXfer->uMaxAggregPkts = pInitParams->tGeneral.uRxAggregPktsLimit; -} - - -/**************************************************************************** - * rxXfer_SetBusParams() - **************************************************************************** - * DESCRIPTION: Configure bus driver DMA-able buffer length to be used as a limit to the aggragation length. - * - * INPUTS: hRxXfer - module handle - * uDmaBufLen - The bus driver DMA-able buffer length - * - * OUTPUT: None - * - * RETURNS: None - ****************************************************************************/ -void rxXfer_SetBusParams (TI_HANDLE hRxXfer, TI_UINT32 uDmaBufLen) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - - pRxXfer->uMaxAggregLen = uDmaBufLen; -} - - -/**************************************************************************** - * 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) -{ - TRxXfer *pRxXfer = (TRxXfer *)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(s) to the upper layers. - * - * INPUTS: - * - * OUTPUT: - * - * RETURNS: - ****************************************************************************/ -static void rxXfer_ForwardPacket (TRxXfer *pRxXfer, TTxnStruct *pTxn) -{ - TI_UINT32 uBufNum; - RxIfDescriptor_t *pRxInfo = (RxIfDescriptor_t*)(pTxn->aBuf[0]); -#ifdef TI_DBG /* for packet sanity check */ - TI_UINT16 uLenFromRxInfo; -#endif - - /* Go over all occupied Txn buffers and forward their Rx packets upward */ - for (uBufNum = 0; uBufNum < MAX_XFER_BUFS; uBufNum++) - { - /* If no more buffers, exit the loop */ - if (pTxn->aLen[uBufNum] == 0) - { - break; - } - -#ifdef TI_DBG /* Packet sanity check */ - /* Get length from RxInfo, handle endianess and convert to length in bytes */ - pRxInfo = (RxIfDescriptor_t*)(pTxn->aBuf[uBufNum]); - 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[uBufNum] != uLenFromRxInfo) - { - TRACE3(pRxXfer->hReport, REPORT_SEVERITY_ERROR , "rxXfer_ForwardPacket: Bad Length!! RxInfoLength=%d, ShortDescLen=%d, RxInfoStatus=0x%x\n", uLenFromRxInfo, pTxn->aLen[uBufNum], pRxInfo->status); - - pRxInfo->status &= ~RX_DESC_STATUS_MASK; - pRxInfo->status |= RX_DESC_STATUS_DRIVER_RX_Q_FAIL; - pRxInfo->length = ENDIAN_HANDLE_WORD(pTxn->aLen[uBufNum] >> 2); - - /* If error CB available, trigger recovery !! */ - if (pRxXfer->fErrCb) - { - pRxXfer->fErrCb (pRxXfer->hErrCb, RX_XFER_FAILURE); - } - } - else - { - TRACE2(pRxXfer->hReport, REPORT_SEVERITY_INFORMATION , "rxXfer_ForwardPacket: RxInfoLength=%d, RxInfoStatus=0x%x\n", uLenFromRxInfo, pRxInfo->status); - } - pRxXfer->tDbgStat.uCountPktsForward++; -#endif - - /* This is the last packet in the Burst so mark its EndOfBurst flag */ - if (TXN_PARAM_GET_END_OF_BURST(pTxn) && (uBufNum == (MAX_XFER_BUFS - 1) || pTxn->aLen[uBufNum + 1] == 0)) - { - TXN_PARAM_SET_END_OF_BURST(pTxn, 0); - pRxInfo->driverFlags |= DRV_RX_FLAG_END_OF_BURST; - } - /* Forward received packet to the upper layers */ - RxQueue_ReceivePacket (pRxXfer->hRxQueue, (const void *)pTxn->aBuf[uBufNum]); - } - - /* 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 - * - ****************************************************************************/ -ETxnStatus rxXfer_RxEvent (TI_HANDLE hRxXfer, FwStatus_t *pFwStatus) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - TI_UINT32 uTempCounters; - FwStatCntrs_t *pFwStatusCounters; - TI_UINT32 i; - TI_STATUS rc; - CL_TRACE_START_L2(); - - uTempCounters = ENDIAN_HANDLE_LONG (pFwStatus->counters); - pFwStatusCounters = (FwStatCntrs_t*)(&uTempCounters); - - TRACE2(pRxXfer->hReport, REPORT_SEVERITY_INFORMATION , "rxXfer_RxEvent: NewFwCntr=%d, OldFwCntr=%d\n", pFwStatusCounters->fwRxCntr, pRxXfer->uFwRxCntr); - - /* If no new Rx packets - exit */ - if ((pFwStatusCounters->fwRxCntr % NUM_RX_PKT_DESC) == (pRxXfer->uFwRxCntr % NUM_RX_PKT_DESC)) - { - CL_TRACE_END_L2("tiwlan_drv.ko", "CONTEXT", "RX", ""); - return TXN_STATUS_COMPLETE; - } - -#ifdef TI_DBG - pRxXfer->tDbgStat.uCountFwEvents++; -#endif - - /* Save current FW counter and Rx packets short descriptors for processing */ - pRxXfer->uFwRxCntr = pFwStatusCounters->fwRxCntr; - for (i = 0; i < NUM_RX_PKT_DESC; i++) - { - pRxXfer->aRxPktsDesc[i] = ENDIAN_HANDLE_LONG (pFwStatus->rxPktsDesc[i]); - } - - /* Handle all new Rx packets */ - rc = rxXfer_Handle (pRxXfer); - - CL_TRACE_END_L2("tiwlan_drv.ko", "CONTEXT", "RX", ""); - return TXN_STATUS_COMPLETE; -} - - -/**************************************************************************** - * rxXfer_Handle() - **************************************************************************** - * DESCRIPTION: - * - * INPUTS: hRxXfer - RxXfer handle; - * - * OUTPUT: - * - * RETURNS: - ****************************************************************************/ -static TI_STATUS rxXfer_Handle(TI_HANDLE hRxXfer) -{ -#ifndef _VLCT_ - TRxXfer * pRxXfer = (TRxXfer *)hRxXfer; - TI_BOOL bIssueTxn = TI_FALSE; /* If TRUE transact current aggregated packets */ - TI_BOOL bDropLastPkt = TI_FALSE; /* If TRUE, need to drop last packet (RX_BUF_ALLOC_OUT_OF_MEM) */ - TI_BOOL bExit = TI_FALSE; /* If TRUE, can't process further packets so exit (after serving the other flags) */ - TI_UINT32 uAggregPktsNum = 0; /* Number of aggregated packets */ - TI_UINT32 uFirstMemBlkAddr = 0; - TI_UINT32 uRxDesc = 0; - TI_UINT32 uBuffSize = 0; - TI_UINT32 uTotalAggregLen = 0; - TI_UINT32 uDrvIndex; - TI_UINT32 uFwIndex; - TI_UINT8 * pHostBuf; - TTxnStruct * pTxn = NULL; - ETxnStatus eTxnStatus; - ERxBufferStatus eBufStatus; - PacketClassTag_e eRxPacketType; - CL_TRACE_START_L2(); - - - /* If no Txn structures available exit!! (fatal error - not expected to happen) */ - if (pRxXfer->uAvailableTxn == 0 ) - { - TRACE0(pRxXfer->hReport, REPORT_SEVERITY_ERROR, "rxXfer_Handle: No available Txn structures left!\n"); - CL_TRACE_END_L2("tiwlan_drv.ko", "CONTEXT", "RX", ""); - return TI_NOK; - } - - uFwIndex = pRxXfer->uFwRxCntr % NUM_RX_PKT_DESC; - - /* Loop while Rx packets can be transfered from the FW */ - while (1) - { - uDrvIndex = pRxXfer->uDrvRxCntr % NUM_RX_PKT_DESC; - - /* If there are unprocessed Rx packets */ - if (uDrvIndex != uFwIndex) - { - /* Get next packte info */ - uRxDesc = pRxXfer->aRxPktsDesc[uDrvIndex]; - uBuffSize = RX_DESC_GET_LENGTH(uRxDesc) << 2; - eRxPacketType = (PacketClassTag_e)RX_DESC_GET_PACKET_CLASS_TAG (uRxDesc); - - /* If new packet exceeds max aggregation length, set flag to send previous packets (postpone it to next loop) */ - if ((uTotalAggregLen + uBuffSize) > pRxXfer->uMaxAggregLen) - { - bIssueTxn = TI_TRUE; - } - - /* No length limit so try to aggregate new packet */ - else - { - /* Allocate host read buffer */ - /* The RxBufAlloc() add an extra word for MAC header alignment in case of QoS MSDU */ - eBufStatus = pRxXfer->RequestForBufferCB(pRxXfer->RequestForBufferCB_handle, - (void**)&pHostBuf, - uBuffSize, - (TI_UINT32)NULL, - eRxPacketType); - - TRACE6(pRxXfer->hReport, REPORT_SEVERITY_INFORMATION , "rxXfer_Handle: Index=%d, RxDesc=0x%x, DrvCntr=%d, FwCntr=%d, BufStatus=%d, BuffSize=%d\n", uDrvIndex, uRxDesc, pRxXfer->uDrvRxCntr, pRxXfer->uFwRxCntr, eBufStatus, uBuffSize); - - /* If buffer allocated, add it to current Txn (up to 4 packets aggregation) */ - if (eBufStatus == RX_BUF_ALLOC_COMPLETE) - { - /* If first aggregated packet prepare the next Txn struct */ - if (uAggregPktsNum == 0) - { - pTxn = (TTxnStruct*)&(pRxXfer->aTxnStruct[pRxXfer->uCurrTxnIndex]); - pTxn->uHwAddr = SLV_MEM_DATA; - - /* Save first mem-block of first aggregated packet! */ - uFirstMemBlkAddr = SLV_MEM_CP_VALUE(uRxDesc, pRxXfer->uPacketMemoryPoolStart); - } - pTxn->aBuf[uAggregPktsNum] = pHostBuf + ALIGNMENT_SIZE(uRxDesc); - pTxn->aLen[uAggregPktsNum] = uBuffSize; - uAggregPktsNum++; - uTotalAggregLen += uBuffSize; - if (uAggregPktsNum >= pRxXfer->uMaxAggregPkts) - { - bIssueTxn = TI_TRUE; - } - pRxXfer->uDrvRxCntr++; - } - - /* If buffer pending until freeing previous buffer, set Exit flag and if needed set IssueTxn flag. */ - else if (eBufStatus == RX_BUF_ALLOC_PENDING) - { - bExit = TI_TRUE; - pRxXfer->bPendingBuffer = TI_TRUE; - if (uAggregPktsNum > 0) - { - bIssueTxn = TI_TRUE; - } -#ifdef TI_DBG - pRxXfer->tDbgStat.uCountBufPend++; -#endif - } - - /* If no buffer due to out-of-memory, set DropLastPkt flag and if needed set IssueTxn flag. */ - else - { - bDropLastPkt = TI_TRUE; - if (uAggregPktsNum > 0) - { - bIssueTxn = TI_TRUE; - } -#ifdef TI_DBG - pRxXfer->tDbgStat.uCountBufNoMem++; -#endif - } - } - } - - /* If no more packets, set Exit flag and if needed set IssueTxn flag. */ - else - { - bExit = TI_TRUE; - if (uAggregPktsNum > 0) - { - bIssueTxn = TI_TRUE; - } - } - - - /* If required to send Rx packet(s) transaction */ - if (bIssueTxn) - { - if (bExit) - { - TXN_PARAM_SET_END_OF_BURST(pTxn, 1); - } - /* If not all 4 Txn buffers are used, reset first unused buffer length for indication */ - if (uAggregPktsNum < MAX_XFER_BUFS) - { - pTxn->aLen[uAggregPktsNum] = 0; - } - - eTxnStatus = rxXfer_IssueTxn (pRxXfer, uFirstMemBlkAddr); - - if (eTxnStatus == TXN_STATUS_COMPLETE) - { - /* Forward received packet to the upper layers */ - rxXfer_ForwardPacket (pRxXfer, pTxn); - } - else if (eTxnStatus == TXN_STATUS_PENDING) - { - /* Decrease the number of available txn structures */ - pRxXfer->uAvailableTxn--; - } - else - { - TRACE3(pRxXfer->hReport, REPORT_SEVERITY_ERROR , "rxXfer_Handle: Status=%d, DrvCntr=%d, RxDesc=0x%x\n", eTxnStatus, pRxXfer->uDrvRxCntr, uRxDesc); - } - -#ifdef TI_DBG - pRxXfer->tDbgStat.uCountPktAggreg[uAggregPktsNum - 1]++; -#endif - - uAggregPktsNum = 0; - uTotalAggregLen = 0; - bIssueTxn = TI_FALSE; - pRxXfer->uCurrTxnIndex = (pRxXfer->uCurrTxnIndex + 1) % MAX_CONSECUTIVE_READ_TXN; - } - - /* If last packet should be dropped (no memory for host buffer) */ - if (bDropLastPkt) - { - /* Increment driver packets counter before calling rxXfer_IssueTxn() */ - pRxXfer->uDrvRxCntr++; - - /* Read packet to dummy buffer and ignore it (no callback needed) */ - uFirstMemBlkAddr = SLV_MEM_CP_VALUE(uRxDesc, pRxXfer->uPacketMemoryPoolStart); - pTxn = (TTxnStruct*)&pRxXfer->aTxnStruct[pRxXfer->uCurrTxnIndex]; - BUILD_TTxnStruct(pTxn, SLV_MEM_DATA, pRxXfer->aTempBuffer, uBuffSize, (TTxnDoneCb)rxXfer_PktDropTxnDoneCb, hRxXfer) - eTxnStatus = rxXfer_IssueTxn (pRxXfer, uFirstMemBlkAddr); - if (eTxnStatus == TXN_STATUS_PENDING) - { - pRxXfer->uAvailableTxn--; - } - pRxXfer->uCurrTxnIndex = (pRxXfer->uCurrTxnIndex + 1) % MAX_CONSECUTIVE_READ_TXN; - bDropLastPkt = TI_FALSE; - } - - /* Can't process more packets so exit */ - if (bExit) - { - CL_TRACE_END_L2("tiwlan_drv.ko", "CONTEXT", "RX", ""); - return TI_OK; - } - - } /* End of while(1) */ - - /* Unreachable code */ - -#endif -} - - -/**************************************************************************** - * rxXfer_IssueTxn() - **************************************************************************** - * DESCRIPTION: - * - * INPUTS: - * - * OUTPUT: - * - * RETURNS: - ****************************************************************************/ -static ETxnStatus rxXfer_IssueTxn (TI_HANDLE hRxXfer, TI_UINT32 uFirstMemBlkAddr) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - TI_UINT32 uIndex = pRxXfer->uCurrTxnIndex; - TTxnStruct *pTxn; - ETxnStatus eStatus; - - /* Write the next mem block that we want to read */ - pTxn = &pRxXfer->aSlaveRegTxn[uIndex].tTxnStruct; - pTxn->uHwAddr = SLV_REG_DATA; - pRxXfer->aSlaveRegTxn[uIndex].uRegData = ENDIAN_HANDLE_LONG(uFirstMemBlkAddr); - pRxXfer->aSlaveRegTxn[uIndex].uRegAdata = ENDIAN_HANDLE_LONG(uFirstMemBlkAddr + 4); - twIf_Transact(pRxXfer->hTwIf, pTxn); - - /* Issue the packet(s) read transaction (prepared in rxXfer_Handle) */ - pTxn = &pRxXfer->aTxnStruct[uIndex]; - eStatus = twIf_Transact(pRxXfer->hTwIf, pTxn); - - /* Write driver packets counter to FW. This write automatically generates interrupt to FW */ - /* Note: Workaround for WL6-PG1.0 is still needed for PG2.0 ==> if (pRxXfer->bChipIs1273Pg10) */ - pTxn = &pRxXfer->aCounterTxn[uIndex].tTxnStruct; - pTxn->uHwAddr = RX_DRIVER_COUNTER_ADDRESS; - pRxXfer->aCounterTxn[uIndex].uCounter = ENDIAN_HANDLE_LONG(pRxXfer->uDrvRxCntr); - twIf_Transact(pRxXfer->hTwIf, pTxn); - - TRACE5(pRxXfer->hReport, REPORT_SEVERITY_INFORMATION , "rxXfer_IssueTxn: Counter-Txn: HwAddr=0x%x, Len0=%d, Data0=%d, DrvCount=%d, TxnParams=0x%x\n", pTxn->uHwAddr, pTxn->aLen[0], *(TI_UINT32 *)(pTxn->aBuf[0]), pRxXfer->uDrvRxCntr, pTxn->uTxnParams); - - /* Return the status of the packet(s) transaction - COMPLETE, PENDING or ERROR */ - return eStatus; -} - - -/**************************************************************************** - * rxXfer_SetRxDirectAccessParams() - **************************************************************************** - * DESCRIPTION: - * - * INPUTS: - * - * OUTPUT: - * - * RETURNS: - ****************************************************************************/ -void rxXfer_SetRxDirectAccessParams (TI_HANDLE hRxXfer, TDmaParams *pDmaParams) -{ - TRxXfer *pRxXfer = (TRxXfer *)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) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - CL_TRACE_START_L2(); - - /* Increase the number of available txn structures */ - pRxXfer->uAvailableTxn++; - - /* Forward received packet to the upper layers */ - rxXfer_ForwardPacket (pRxXfer, pTxn); - - /* If we exited the handler upon pending-buffer, call it again to handle further packets if any */ - if (pRxXfer->bPendingBuffer) - { - pRxXfer->bPendingBuffer = TI_FALSE; - rxXfer_Handle (hRxXfer); - } - - CL_TRACE_END_L2("tiwlan_drv.ko", "INHERIT", "RX", ""); -} - - -/**************************************************************************** - * rxXfer_PktDropTxnDoneCb() - **************************************************************************** - * DESCRIPTION: Dummy CB for case of dropping a packet due to out-of-memory. - * - * INPUTS: - * - * OUTPUT: - * - * RETURNS: - ****************************************************************************/ -static void rxXfer_PktDropTxnDoneCb (TI_HANDLE hRxXfer, TTxnStruct *pTxn) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - - /* Increase the number of available txn structures */ - pRxXfer->uAvailableTxn++; - - /* Restore the regular TxnDone callback to the used structure */ - pTxn->fTxnDoneCb = (TTxnDoneCb)rxXfer_TxnDoneCb; - pTxn->hCbHandle = 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) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - TTxnStruct* pTxn; - TI_UINT8 i; - - pRxXfer->uFwRxCntr = 0; - pRxXfer->uDrvRxCntr = 0; - pRxXfer->uCurrTxnIndex = 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->aTxnStruct[i]); - - /* Check if buffer allocated and not the dummy one (has a different callback) */ - if ((pTxn->aBuf[0] != 0) && (pTxn->fTxnDoneCb == (TTxnDoneCb)rxXfer_TxnDoneCb)) - { - TI_UINT32 uBufNum; - RxIfDescriptor_t *pRxParams; - - /* Go over the Txn occupied buffers and mark them as TAG_CLASS_UNKNOWN to be freed */ - for (uBufNum = 0; uBufNum < MAX_XFER_BUFS; uBufNum++) - { - /* If no more buffers, exit the loop */ - if (pTxn->aLen[uBufNum] == 0) - { - break; - } - - pRxParams = (RxIfDescriptor_t *)(pTxn->aBuf[uBufNum]); - pRxParams->packet_class_tag = TAG_CLASS_UNKNOWN; - } - - /* Call upper layer only to release the allocated buffer */ - rxXfer_ForwardPacket (pRxXfer, pTxn); - } - } - - /* Fill the transaction structures fields that have constant values */ - for (i = 0; i < MAX_CONSECUTIVE_READ_TXN; i++) - { - /* First mem-block address (two consecutive registers) */ - 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].uRegData, REGISTER_SIZE*2, NULL, NULL) - - /* The packet(s) read transaction */ - pTxn = &(pRxXfer->aTxnStruct[i]); - TXN_PARAM_SET(pTxn, TXN_LOW_PRIORITY, TXN_FUNC_ID_WLAN, TXN_DIRECTION_READ, TXN_FIXED_ADDR) - pTxn->fTxnDoneCb = (TTxnDoneCb)rxXfer_TxnDoneCb; - pTxn->hCbHandle = hRxXfer; - - /* The driver packets counter */ - pTxn = &(pRxXfer->aCounterTxn[i].tTxnStruct); - 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[i].uCounter, REGISTER_SIZE, NULL, NULL) - } - -} - - -/**************************************************************************** - * rxXfer_RegisterErrCb() - **************************************************************************** - * DESCRIPTION: Register Error CB - * - * INPUTS: - * hRxXfer - The object - * ErrCb - The upper layer CB function for error handling - * hErrCb - The CB function handle - * - * OUTPUT: None - * - * RETURNS: void - ****************************************************************************/ -void rxXfer_RegisterErrCb (TI_HANDLE hRxXfer, void *fErrCb, TI_HANDLE hErrCb) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - - /* Save upper layer (health monitor) CB for recovery from fatal error */ - pRxXfer->fErrCb = (TFailureEventCb)fErrCb; - pRxXfer->hErrCb = hErrCb; -} - - -#ifdef TI_DBG -/**************************************************************************** - * rxXfer_ClearStats() - **************************************************************************** - * DESCRIPTION: - * - * INPUTS: - * pRxXfer The object - * - * OUTPUT: None - * - * RETURNS: TI_OK. - ****************************************************************************/ -void rxXfer_ClearStats (TI_HANDLE hRxXfer) -{ - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - - os_memoryZero (pRxXfer->hOs, &pRxXfer->tDbgStat, sizeof(TRxXferDbgStat)); -} - - -/**************************************************************************** - * rxXfer_PrintStats() - **************************************************************************** - * DESCRIPTION: . - * - * INPUTS: - * pRxXfer The object - * - * OUTPUT: None - * - * RETURNS: TI_OK. - ****************************************************************************/ -void rxXfer_PrintStats (TI_HANDLE hRxXfer) -{ -#ifdef REPORT_LOG - TRxXfer *pRxXfer = (TRxXfer *)hRxXfer; - - WLAN_OS_REPORT(("Print RX Xfer module info\n")); - WLAN_OS_REPORT(("=========================\n")); - WLAN_OS_REPORT(("uMaxAggregPkts = %d\n", pRxXfer->uMaxAggregPkts)); - WLAN_OS_REPORT(("uMaxAggregLen = %d\n", pRxXfer->uMaxAggregLen)); - WLAN_OS_REPORT(("FW counter = %d\n", pRxXfer->uFwRxCntr)); - WLAN_OS_REPORT(("Drv counter = %d\n", pRxXfer->uDrvRxCntr)); - WLAN_OS_REPORT(("AvailableTxn = %d\n", pRxXfer->uAvailableTxn)); - WLAN_OS_REPORT(("uCountFwEvents = %d\n", pRxXfer->tDbgStat.uCountFwEvents)); - WLAN_OS_REPORT(("uCountPktsForward = %d\n", pRxXfer->tDbgStat.uCountPktsForward)); - WLAN_OS_REPORT(("uCountBufPend = %d\n", pRxXfer->tDbgStat.uCountBufPend)); - WLAN_OS_REPORT(("uCountBufNoMem = %d\n", pRxXfer->tDbgStat.uCountBufNoMem)); - WLAN_OS_REPORT(("uCountPktAggreg-1 = %d\n", pRxXfer->tDbgStat.uCountPktAggreg[0])); - WLAN_OS_REPORT(("uCountPktAggreg-2 = %d\n", pRxXfer->tDbgStat.uCountPktAggreg[1])); - WLAN_OS_REPORT(("uCountPktAggreg-3 = %d\n", pRxXfer->tDbgStat.uCountPktAggreg[2])); - WLAN_OS_REPORT(("uCountPktAggreg-4 = %d\n", pRxXfer->tDbgStat.uCountPktAggreg[3])); -#endif -} -#endif diff --git a/wl1271/TWD/FW_Transfer/RxXfer.h b/wl1271/TWD/FW_Transfer/RxXfer.h deleted file mode 100644 index c0751281..00000000 --- a/wl1271/TWD/FW_Transfer/RxXfer.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * RxXfer.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * MODULE: 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_UINT32 uRegData; - TI_UINT32 uRegAdata; - -} TRegTxn; - -typedef struct -{ - TTxnStruct tTxnStruct; - TI_UINT32 uCounter; - -} TCounterTxn; - -typedef struct -{ - TTxnStruct tTxnStruct; - TI_UINT32 uData; - -} 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_BOOL bChipIs1273Pg10; - - TI_UINT8 aTempBuffer[MAX_PACKET_SIZE]; - - TI_UINT32 uAvailableTxn; - -#ifdef TI_DBG - RxXferStats_T DbgStats; -#endif /* TI_DBG */ - -} RxXfer_t; - - -#endif /* _RX_XFER_H */ diff --git a/wl1271/TWD/FW_Transfer/eventMbox.c b/wl1271/TWD/FW_Transfer/eventMbox.c deleted file mode 100644 index 571908a6..00000000 --- a/wl1271/TWD/FW_Transfer/eventMbox.c +++ /dev/null @@ -1,754 +0,0 @@ -/* - * eventMbox.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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_UINT32 iRegBuffer; - -} tTxnGenReg; - - -typedef struct -{ - TTxnStruct tEventMbox; - EventMailBox_t iEventMboxBuf; - -} 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)); - if (pEventMbox == NULL) - { - WLAN_OS_REPORT (("eventMbox_Create: Error creating EventMbox object\n")); - return NULL; - } - os_memoryZero (hOs, pEventMbox, sizeof(TEventMbox)); - pEventMbox->hOs = hOs; - pEventMbox->iTxnEventMbox.iEventMboxBuf.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) - { - 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; - pEventMbox->iTxnEventMbox.iEventMboxBuf.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 = (TI_UINT8*)&pEventMbox->iTxnEventMbox.iEventMboxBuf; - 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.iRegBuffer, REGISTER_SIZE, eventMbox_ReadAddrCb, hEventMbox) - rc = twIf_Transact(pEventMbox->hTwif,pTxn); - if (rc == TXN_STATUS_COMPLETE) - { - pEventMbox->EventMboxAddr[0] = pEventMbox->iTxnGenRegSize.iRegBuffer; - 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] = pEventMbox->iTxnGenRegSize.iRegBuffer; - 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", pEventMbox->iTxnEventMbox.iEventMboxBuf.eventsMask); - - cmdBld_CfgEventMask(pEventMbox->hCmdBld,pEventMbox->iTxnEventMbox.iEventMboxBuf.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*)&pEventMbox->iTxnEventMbox.iEventMboxBuf.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*)&pEventMbox->iTxnEventMbox.iEventMboxBuf.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 - */ -ETxnStatus 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.iEventMboxBuf, 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); - } - - return TXN_STATUS_COMPLETE; -} - - -/* - * \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",pEventMbox->iTxnEventMbox.iEventMboxBuf.eventsVector); - - pEventMbox->iTxnGenRegSize.iRegBuffer = INTR_TRIG_EVENT_ACK; - - for (EvID = 0; EvID < TWD_OWN_EVENT_ALL; EvID++) - { - if (pEventMbox->iTxnEventMbox.iEventMboxBuf.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.iRegBuffer, sizeof(pEventMbox->iTxnGenRegSize.iRegBuffer), 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 = pEventMbox->iTxnEventMbox.iEventMboxBuf.eventsMask; - TI_UINT32 EvVector = pEventMbox->iTxnEventMbox.iEventMboxBuf.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 */ - - - diff --git a/wl1271/TWD/FW_Transfer/fwDebug.c b/wl1271/TWD/FW_Transfer/fwDebug.c deleted file mode 100644 index aab35e50..00000000 --- a/wl1271/TWD/FW_Transfer/fwDebug.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * fwDebug.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - - -/** \file 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)); - - if (pFwDebug == NULL) - { - WLAN_OS_REPORT (("FATAL ERROR: fwDbg_Create(): Error Creating TFwDebug - Aborting\n")); - return NULL; - } - - /* reset module object */ - os_memoryZero (hOs, pFwDebug, sizeof (TFwDebug)); - pFwDebug->hOs = hOs; - - 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; - - /* Allocate DMA memory for read write transact */ - pFwDebug->pDMABuf = (TI_UINT8*)os_memoryAlloc(pFwDebug->hOs,DMA_SIZE_BUF); -} - - -/* - * \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,DMA_SIZE_BUF); - } - 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); -} - diff --git a/wl1271/TWD/FW_Transfer/txResult.c b/wl1271/TWD/FW_Transfer/txResult.c deleted file mode 100644 index b1b80db9..00000000 --- a/wl1271/TWD/FW_Transfer/txResult.c +++ /dev/null @@ -1,463 +0,0 @@ -/* - * txResult.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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_UINT32 uCounter; -} THostCounterWriteTxn; - -/* The Tx-results counters and table read transaction structure. */ -typedef struct -{ - TTxnStruct tTxnStruct; - TxResultInterface_t tTxResultInfo; -} 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)); - if (pTxResult == NULL) - return NULL; - - os_memoryZero(hOs, pTxResult, sizeof(TTxResultObj)); - - 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) - 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.uCounter, 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.tTxResultInfo, - 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: ETxnStatus - ***************************************************************************/ -ETxnStatus 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 TXN_STATUS_COMPLETE; - } -#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 TXN_STATUS_COMPLETE; - } - - /* Call the SM to handle the new Tx results */ - txResult_StateMachine (hTxResult); - return TXN_STATUS_COMPLETE; -} - - -/**************************************************************************** - * 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(pTxResult->tResultsInfoReadTxn.tTxResultInfo.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). */ - pTxResult->tHostCounterWriteTxn.uCounter = 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 = &(pTxResult->tResultsInfoReadTxn.tTxResultInfo.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) -{ -#ifdef REPORT_LOG - 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")); -#endif -} - - -/**************************************************************************** - * txResult_ClearInfo() - **************************************************************************** - * DESCRIPTION: Clears TX result debug information. - ****************************************************************************/ -void txResult_ClearInfo (TI_HANDLE hTxResult) -{ - TTxResultObj* pTxResult = (TTxResultObj*)hTxResult; - - pTxResult->uInterruptsCounter = 0; -} - -#endif /* TI_DBG */ - - diff --git a/wl1271/TWD/FW_Transfer/txXfer.c b/wl1271/TWD/FW_Transfer/txXfer.c deleted file mode 100644 index 1497a092..00000000 --- a/wl1271/TWD/FW_Transfer/txXfer.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * txXfer.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file txXfer.c - * \brief Handle Tx packets transfer to the firmware. - * - * This module gets the upper driver's Tx packets after FW resources were - * allocated for them, aggregates them if possible, and handles their transfer - * to the FW via the host slave (indirect) interface, using the TwIf Transaction API. - * The aggregation processing is completed by the BusDrv where the packets are combined - * and sent to the FW in one transaction. - * - * \see - */ - - -#define __FILE_ID__ FILE_ID_108 -#include "tidef.h" -#include "osApi.h" -#include "report.h" -#include "TwIf.h" -#include "TWDriver.h" -#include "txXfer_api.h" - - -#ifdef TI_DBG -#define DBG_MAX_AGGREG_PKTS 16 -#endif - -typedef struct -{ - TTxnStruct tTxnStruct; - TI_UINT32 uPktsCntr; -} TPktsCntrTxn; - -/* The TxXfer module object. */ -typedef struct -{ - TI_HANDLE hOs; - TI_HANDLE hReport; - TI_HANDLE hTwIf; - - TI_UINT32 uAggregMaxPkts; /* Max number of packets that may be aggregated */ - TI_UINT32 uAggregMaxLen; /* Max length in bytes of a single aggregation */ - TI_UINT32 uAggregPktsNum; /* Number of packets in current aggregation */ - TI_UINT32 uAggregPktsLen; /* Aggregated length of current aggregation */ - TTxCtrlBlk * pAggregFirstPkt; /* Pointer to the first packet of current aggregation */ - TTxCtrlBlk * pAggregLastPkt; /* Pointer to the last packet of current aggregation */ - TSendPacketTranferCb fSendPacketTransferCb; /* Upper layer Xfer-Complete callback */ - TI_HANDLE hSendPacketTransferHndl; /* Upper layer Xfer-Complete callback handle */ - TTxnDoneCb fXferCompleteLocalCb; /* TxXfer local CB for pkt transfer completion (NULL is not needed!) */ - TI_UINT32 uPktsCntr; /* Counts all Tx packets. Written to FW after each packet transaction */ - TI_UINT32 uPktsCntrTxnIndex; /* The current indext of the aPktsCntrTxn[] used for the counter workaround transactions */ - TPktsCntrTxn aPktsCntrTxn[CTRL_BLK_ENTRIES_NUM]; /* Transaction structures for sending the packets counter */ -#ifdef TI_DBG - TI_UINT32 aDbgCountPktAggreg[DBG_MAX_AGGREG_PKTS]; -#endif - -} TTxXferObj; - -static ETxnStatus txXfer_SendAggregatedPkts (TTxXferObj *pTxXfer, TI_BOOL bLastPktSentNow); -static void txXfer_TransferDoneCb (TI_HANDLE hTxXfer, TTxnStruct *pTxn); - - -/******************************************************************************** -* * -* PUBLIC FUNCTIONS IMPLEMENTATION * -* * -*********************************************************************************/ - - -TI_HANDLE txXfer_Create(TI_HANDLE hOs) -{ - TTxXferObj *pTxXfer; - - pTxXfer = os_memoryAlloc (hOs, sizeof(TTxXferObj)); - if (pTxXfer == NULL) - { - return NULL; - } - - os_memoryZero (hOs, pTxXfer, sizeof(TTxXferObj)); - - pTxXfer->hOs = hOs; - - return (TI_HANDLE)pTxXfer; -} - - -TI_STATUS txXfer_Destroy(TI_HANDLE hTxXfer) -{ - TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer; - - if (pTxXfer) - { - os_memoryFree (pTxXfer->hOs, pTxXfer, sizeof(TTxXferObj)); - } - - return TI_OK; -} - - -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->fXferCompleteLocalCb = NULL; - - 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].uPktsCntr, REGISTER_SIZE, NULL, NULL) - } - - return txXfer_Restart(hTxXfer); -} - - -TI_STATUS txXfer_Restart (TI_HANDLE hTxXfer) -{ - TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer; - - pTxXfer->uPktsCntr = 0; - pTxXfer->uPktsCntrTxnIndex = 0; - pTxXfer->uAggregPktsNum = 0; - - return TI_OK; -} - - -void txXfer_SetDefaults (TI_HANDLE hTxXfer, TTwdInitParams *pInitParams) -{ - TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer; - - pTxXfer->uAggregMaxPkts = pInitParams->tGeneral.uTxAggregPktsLimit; -} - - -void txXfer_SetBusParams (TI_HANDLE hTxXfer, TI_UINT32 uDmaBufLen) -{ - TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer; - - pTxXfer->uAggregMaxLen = uDmaBufLen; -} - - -void txXfer_RegisterCb (TI_HANDLE hTxXfer, TI_UINT32 CallBackID, void *CBFunc, TI_HANDLE CBObj) -{ - TTxXferObj* pTxXfer = (TTxXferObj*)hTxXfer; - - TRACE3(pTxXfer->hReport, REPORT_SEVERITY_INFORMATION, "txXfer_RegisterCb: 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; - /* Set also the local CB so we are called upon Async transaction completion to call the upper CB */ - pTxXfer->fXferCompleteLocalCb = (TTxnDoneCb)txXfer_TransferDoneCb; - break; - - default: - TRACE0(pTxXfer->hReport, REPORT_SEVERITY_ERROR, " - Illegal value\n"); - break; - } -} - - -ETxnStatus txXfer_SendPacket (TI_HANDLE hTxXfer, TTxCtrlBlk *pPktCtrlBlk) -{ - TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer; - TI_UINT32 uPktLen = ENDIAN_HANDLE_WORD(pPktCtrlBlk->tTxDescriptor.length << 2); /* swap back for endianess if needed */ - ETxnStatus eStatus; - - /* If starting a new aggregation, prepare it, and send packet if aggregation is disabled. */ - if (pTxXfer->uAggregPktsNum == 0) - { - pTxXfer->uAggregPktsNum = 1; - pTxXfer->uAggregPktsLen = uPktLen; - pTxXfer->pAggregFirstPkt = pPktCtrlBlk; - pTxXfer->pAggregLastPkt = pPktCtrlBlk; - pPktCtrlBlk->pNextAggregEntry = pPktCtrlBlk; /* First packet points to itself */ - if (pTxXfer->uAggregMaxPkts <= 1) - { - eStatus = txXfer_SendAggregatedPkts (pTxXfer, TI_TRUE); - pTxXfer->uAggregPktsNum = 0; - } - else - { - eStatus = TXN_STATUS_PENDING; - } - } - - /* Else, if new packet can be added to aggregation, add it and set status as Pending. */ - else if ((pTxXfer->uAggregPktsNum + 1 <= pTxXfer->uAggregMaxPkts) && - (pTxXfer->uAggregPktsLen + uPktLen <= pTxXfer->uAggregMaxLen)) - { - pTxXfer->uAggregPktsNum++; - pTxXfer->uAggregPktsLen += uPktLen; - pTxXfer->pAggregLastPkt->pNextAggregEntry = pPktCtrlBlk; /* Link new packet to last */ - pTxXfer->pAggregLastPkt = pPktCtrlBlk; /* Save new packet as last */ - pPktCtrlBlk->pNextAggregEntry = pTxXfer->pAggregFirstPkt; /* Point from last to first */ - eStatus = TXN_STATUS_PENDING; - } - - /* Else, we can't add the new packet, so send current aggregation and start a new one */ - else - { - txXfer_SendAggregatedPkts (pTxXfer, TI_FALSE); - eStatus = TXN_STATUS_PENDING; /* The current packet is not sent yet so return Pending */ - pTxXfer->uAggregPktsNum = 1; - pTxXfer->uAggregPktsLen = uPktLen; - pTxXfer->pAggregFirstPkt = pPktCtrlBlk; - pTxXfer->pAggregLastPkt = pPktCtrlBlk; - pPktCtrlBlk->pNextAggregEntry = pPktCtrlBlk; /* First packet points to itself */ - } - - - /* Return the Txn result - COMPLETE or PENDING. */ - /* Note: For PENDING, a callback function will be called only if registered (needed for WHA) */ - return eStatus; -} - - -void txXfer_EndOfBurst (TI_HANDLE hTxXfer) -{ - TTxXferObj *pTxXfer = (TTxXferObj *)hTxXfer; - - if (pTxXfer->uAggregPktsNum > 0) - { - /* No more packets from TxDataQ so send any aggregated packets and clear aggregation */ - txXfer_SendAggregatedPkts (pTxXfer, TI_FALSE); - pTxXfer->uAggregPktsNum = 0; - } -} - - -/******************************************************************************** -* * -* INTERNAL FUNCTIONS IMPLEMENTATION * -* * -*********************************************************************************/ - -/** - * \fn txXfer_SendAggregatedPkts - * \brief Send aggregated Tx packets to bus Txn layer - * - * Send aggregated Tx packets to bus Txn layer one by one. - * Increase the packets counter by the number of packets and send it to the FW (generates an interrupt). - * If xfer completion CB is registered and status is Complete, call CB for all packets (except last one if inseted now). - * - * \note The BusDrv combines the packets and sends them in one transaction. - * \param pTxXfer - The module's object - * \param bLastPktSentNow - If TRUE, last packet in the aggregation was inserted in current call to txXfer_SendPacket. - * \return COMPLETE if transaction completed in this context, PENDING if not, ERROR if failed - * \sa - */ -static ETxnStatus txXfer_SendAggregatedPkts (TTxXferObj *pTxXfer, TI_BOOL bLastPktSentNow) -{ - TTxCtrlBlk *pCurrPkt; - TTxnStruct *pTxn; - TPktsCntrTxn *pPktsCntrTxn; - ETxnStatus eStatus = TXN_STATUS_COMPLETE; - TI_UINT32 i; - - /* Prepare and send all aggregated packets (combined and sent in one transaction by the BusDrv) */ - pCurrPkt = pTxXfer->pAggregFirstPkt; - for (i = 0; i < pTxXfer->uAggregPktsNum; i++) - { - pTxn = (TTxnStruct *)pCurrPkt; - - /* If not last packet, set aggregation flag, clear completion CB and progress to next packet */ - if (i < pTxXfer->uAggregPktsNum - 1) - { - TXN_PARAM_SET_AGGREGATE(pTxn, TXN_AGGREGATE_ON); - pTxn->fTxnDoneCb = NULL; - pCurrPkt = pCurrPkt->pNextAggregEntry; - } - /* If last packet, clear aggregation flag and set completion CB (exist only if registered) */ - else - { - TXN_PARAM_SET_AGGREGATE(pTxn, TXN_AGGREGATE_OFF); - pTxn->fTxnDoneCb = pTxXfer->fXferCompleteLocalCb; - pTxn->hCbHandle = (TI_HANDLE)pTxXfer; - } - - /* Send packet */ - pTxn->uHwAddr = SLV_MEM_DATA; - eStatus = twIf_Transact (pTxXfer->hTwIf, pTxn); - } - -#ifdef TI_DBG - pTxXfer->aDbgCountPktAggreg[pTxXfer->uAggregPktsNum]++; - TRACE5(pTxXfer->hReport, REPORT_SEVERITY_INFORMATION, "txXfer_SendAggregatedPkts: Status=%d, NumPkts=%d, AggregLen=%d, pFirstPkt=0x%x, pLastPkt=0x%x\n", eStatus, pTxXfer->uAggregPktsNum, pTxXfer->uAggregPktsLen, pTxXfer->pAggregFirstPkt, pTxXfer->pAggregLastPkt); - if (eStatus == TXN_STATUS_ERROR) - { - TRACE5(pTxXfer->hReport, REPORT_SEVERITY_ERROR, "txXfer_SendAggregatedPkts: Status=%d, NumPkts=%d, AggregLen=%d, pFirstPkt=0x%x, pLastPkt=0x%x\n", eStatus, pTxXfer->uAggregPktsNum, pTxXfer->uAggregPktsLen, pTxXfer->pAggregFirstPkt, pTxXfer->pAggregLastPkt); - return eStatus; - } -#endif /* TI_DBG */ - - /* Write packet counter to FW (generates an interrupt). - Note: This may be removed once the host-slave HW counter functionality is verified */ - pTxXfer->uPktsCntr += pTxXfer->uAggregPktsNum; - pTxXfer->uPktsCntrTxnIndex++; - if (pTxXfer->uPktsCntrTxnIndex == CTRL_BLK_ENTRIES_NUM) - { - pTxXfer->uPktsCntrTxnIndex = 0; - } - pPktsCntrTxn = &(pTxXfer->aPktsCntrTxn[pTxXfer->uPktsCntrTxnIndex]); - pPktsCntrTxn->uPktsCntr = ENDIAN_HANDLE_LONG(pTxXfer->uPktsCntr); - pPktsCntrTxn->tTxnStruct.uHwAddr = HOST_WR_ACCESS_REG; - twIf_Transact(pTxXfer->hTwIf, &pPktsCntrTxn->tTxnStruct); - - /* If xfer completion CB is registered and last packet status is Complete, call the CB for all - * packets except the input one (covered by the return code). - */ - if (pTxXfer->fSendPacketTransferCb && (eStatus == TXN_STATUS_COMPLETE)) - { - /* Don't call CB for last packet if inserted in current Tx */ - TI_UINT32 uNumCbCalls = bLastPktSentNow ? (pTxXfer->uAggregPktsNum - 1) : pTxXfer->uAggregPktsNum; - - pCurrPkt = pTxXfer->pAggregFirstPkt; - for (i = 0; i < uNumCbCalls; i++) - { - pTxXfer->fSendPacketTransferCb (pTxXfer->hSendPacketTransferHndl, pCurrPkt); - pCurrPkt = pCurrPkt->pNextAggregEntry; - } - } - - /* Return the Txn result - COMPLETE or PENDING. */ - /* Note: For PENDING, a callback function will be called only if registered (needed for WHA) */ - return eStatus; -} - - -/** - * \fn txXfer_TransferDoneCb - * \brief Send aggregated Tx packets to bus Txn layer - * - * Call the upper layers TranferDone CB for all packets of the completed aggregation - * This function is called only if the upper layers registered their CB (used only by WHA) - * - * \note - * \param pTxXfer - The module's object - * \return COMPLETE if completed in this context, PENDING if not, ERROR if failed - * \sa - */ -static void txXfer_TransferDoneCb (TI_HANDLE hTxXfer, TTxnStruct *pTxn) -{ - TTxXferObj *pTxXfer = (TTxXferObj*)hTxXfer; - TTxCtrlBlk *pInputPkt = (TTxCtrlBlk *)pTxn; /* This is the last packet of the aggregation */ - TTxCtrlBlk *pCurrPkt; - TI_UINT32 i; - - /* Call the upper layers TranferDone CB for all packets of the completed aggregation */ - /* Note: If this CB was called it means that the upper CB exists */ - pCurrPkt = pInputPkt->pNextAggregEntry; /* The last packet of the aggregation point to the first one */ - for (i = 0; i < pTxXfer->uAggregMaxPkts; i++) - { - pTxXfer->fSendPacketTransferCb (pTxXfer->hSendPacketTransferHndl, pCurrPkt); - - /* If we got back to the input packet we went over all the aggregation */ - if (pCurrPkt == pInputPkt) - { - break; - } - - pCurrPkt = pCurrPkt->pNextAggregEntry; - } - - TRACE3(pTxXfer->hReport, REPORT_SEVERITY_INFORMATION, "txXfer_TransferDoneCb: NumPkts=%d, pInputPkt=0x%x, pCurrPkt=0x%x\n", i + 1, pInputPkt, pCurrPkt); -} - - -#ifdef TI_DBG - -void txXfer_ClearStats (TI_HANDLE hTxXfer) -{ - TTxXferObj *pTxXfer = (TTxXferObj*)hTxXfer; - - os_memoryZero (pTxXfer->hOs, &pTxXfer->aDbgCountPktAggreg, sizeof(pTxXfer->aDbgCountPktAggreg)); -} - -void txXfer_PrintStats (TI_HANDLE hTxXfer) -{ -#ifdef REPORT_LOG - TTxXferObj *pTxXfer = (TTxXferObj*)hTxXfer; - TI_UINT32 i; - - WLAN_OS_REPORT(("Print Tx Xfer module info\n")); - WLAN_OS_REPORT(("=========================\n")); - WLAN_OS_REPORT(("uAggregMaxPkts = %d\n", pTxXfer->uAggregMaxPkts)); - WLAN_OS_REPORT(("uAggregMaxLen = %d\n", pTxXfer->uAggregMaxLen)); - WLAN_OS_REPORT(("uAggregPktsNum = %d\n", pTxXfer->uAggregPktsNum)); - WLAN_OS_REPORT(("uAggregPktsLen = %d\n", pTxXfer->uAggregPktsLen)); - WLAN_OS_REPORT(("uPktsCntr = %d\n", pTxXfer->uPktsCntr)); - WLAN_OS_REPORT(("uPktsCntrTxnIndex = %d\n", pTxXfer->uPktsCntrTxnIndex)); - for (i = 1; i < DBG_MAX_AGGREG_PKTS; i++) - { - WLAN_OS_REPORT(("uCountPktAggreg-%2d = %d\n", i, pTxXfer->aDbgCountPktAggreg[i])); - } -#endif -} - -#endif /* TI_DBG */ diff --git a/wl1271/TWD/FirmwareApi/public_commands.h b/wl1271/TWD/FirmwareApi/public_commands.h deleted file mode 100644 index fae3d778..00000000 --- a/wl1271/TWD/FirmwareApi/public_commands.h +++ /dev/null @@ -1,1580 +0,0 @@ -/* - * public_commands.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/********************************************************************************************************************** - - 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_RSP, /* 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, 3 - use SSID list no filter) */ - 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*/ diff --git a/wl1271/TWD/FirmwareApi/public_descriptors.h b/wl1271/TWD/FirmwareApi/public_descriptors.h deleted file mode 100644 index 408297c2..00000000 --- a/wl1271/TWD/FirmwareApi/public_descriptors.h +++ /dev/null @@ -1,273 +0,0 @@ -/* - * public_descriptors.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/********************************************************************************************************************** - - 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; - - -/* ------------------------------------------------------- */ -/* flags field in the driverFlags of the RxIfDescriptor_t */ -/* ------------------------------------------------------- */ -/* Bit0 : EndOfBurst flag */ -/* Bit1-7 : - not in use */ -/* ------------------------------------------------------- */ - -#define DRV_RX_FLAG_END_OF_BURST 0x01 - - - -/****************************************************************************** - - 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 driverFlags; /* holds the driver flags to be used internally */ - -} RxIfDescriptor_t; - - - -#endif /* PUBLIC_DESCRIPTORS_H*/ - - - diff --git a/wl1271/TWD/FirmwareApi/public_event_mbox.h b/wl1271/TWD/FirmwareApi/public_event_mbox.h deleted file mode 100644 index fd8f9052..00000000 --- a/wl1271/TWD/FirmwareApi/public_event_mbox.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * public_event_mbox.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/********************************************************************************************************************** - - 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*/ - - diff --git a/wl1271/TWD/FirmwareApi/public_host_int.h b/wl1271/TWD/FirmwareApi/public_host_int.h deleted file mode 100644 index 3ac4270e..00000000 --- a/wl1271/TWD/FirmwareApi/public_host_int.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * public_host_int.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/********************************************************************************************************************** - - 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_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 - - diff --git a/wl1271/TWD/FirmwareApi/public_infoele.h b/wl1271/TWD/FirmwareApi/public_infoele.h deleted file mode 100644 index 96696df3..00000000 --- a/wl1271/TWD/FirmwareApi/public_infoele.h +++ /dev/null @@ -1,2402 +0,0 @@ -/* - * public_infoele.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/********************************************************************************************************************** - - 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_BURST_MODE = 0x005C, - - ACX_SET_RATE_MAMAGEMENT_PARAMS = 0x005D, - ACX_GET_RATE_MAMAGEMENT_PARAMS = 0x005E, - - 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 (0x03) - -typedef struct -{ - INFO_ELE_HDR - uint8 ipVersion; /* The IP version of the IP address: 4 - IPv4, 6 - IPv6.*/ - uint8 arpFilterEnable; /* 0x00 - No ARP features */ - /* 0x01 - Only ARP filtering */ - /* 0x03 - Both ARP filtering and Auto-ARP */ - /* For IPv6 it MUST be 0 */ - 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 - * - * \par Description - * Used for Setting/Printing Soft Gemini Parameters - * - * \sa - */ - -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_A2DP_BT_TIME, - SOFT_GEMINI_PASSIVE_SCAN_A2DP_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: 0-0xFF, 0xFF = use FW default - */ - - 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 98 - -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 */ - uint8 padding[2]; /* alignment to 32bits boundary */ -} 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_ALL_PARAMS = 0xff -} rateAdaptParam_enum; - -#ifdef HOST_COMPILE -typedef uint8 rateAdaptParam_e; -#else -typedef rateAdaptParam_enum rateAdaptParam_e; -#endif - -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[13]; -}AcxRateMangeParams; - -/****************************************************************************** - 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_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 */ - diff --git a/wl1271/TWD/FirmwareApi/public_radio.h b/wl1271/TWD/FirmwareApi/public_radio.h deleted file mode 100644 index 47ddfc39..00000000 --- a/wl1271/TWD/FirmwareApi/public_radio.h +++ /dev/null @@ -1,1792 +0,0 @@ -/* - * public_radio.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/********************************************************************************************************************** - 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]; */ -/*defined in tiDefs.h*/ -/************************************************************************/ -/* */ -/* 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) -#define HALF_NUMBER_OF_2_4_G_CHANNELS (NUMBER_OF_2_4_G_CHANNELS / 2) -#define HALF_NUMBER_OF_5G_CHANNELS ((NUMBER_OF_5G_CHANNELS + 1) / 2) - -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, - CM_TX_IQ_MM_CALIBRATION_TYPE_E, - DRPW_RFCALIBFXN_TXMIXERFREQ_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, - CHANNEL_RESPONSE_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, -/* 0x26 */ TEST_CMD_INI_FILE_RF_EXTENDED_PARAM, - - 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 */ - -}CLPCTempratureVbatStruct; - -typedef struct -{ - int16 oRadioStatus; - uint8 iCommand; /* command to check */ - - CalibrationInfo calibInfo; /* for eCMD_GET_CALIBRAIONS_INFO */ - CLPCTempratureVbatStruct CLPCTempVbatInfo; /* 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) - - -/* NVS definition start here */ - -#define NVS_TX_TYPE_INDEX 0 -#define NVS_TX_LENGTH_INDEX ((NVS_TX_TYPE_INDEX) + 1) /* 1 (26) */ -#define NVS_TX_PARAM_INDEX ((NVS_TX_LENGTH_INDEX) + 2) /* 3 (28) */ - -#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_TYPE_INDEX ((NVS_TX_PARAM_INDEX) + (NVS_TX_PARAM_LENGTH)) /* 316 (341) */ -#define NVS_RX_LENGTH_INDEX ((NVS_RX_TYPE_INDEX) + 1) /* 317 (342) */ -#define NVS_RX_PARAM_INDEX ((NVS_RX_LENGTH_INDEX) + 2) /* 319 (344) */ -#define NVS_RX_PARAM_LENGTH NUMBER_OF_RX_BIP_EFUSE_PARAMETERS_E /* 19 */ - -/* NVS version parameter length */ -#define NVS_VERSION_TYPE_INDEX ((NVS_RX_PARAM_INDEX) + (NVS_RX_PARAM_LENGTH)) /* 338 (363) */ -#define NVS_VERSION_LENGTH_INDEX ((NVS_VERSION_TYPE_INDEX) + 1) /* 339 (364) */ -#define NVS_VERSION_PARAMETER_INDEX ((NVS_VERSION_LENGTH_INDEX) + 2) /* 340 (365) */ -#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; - -/* NVS definition end here */ - - -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 -}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 - -}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; - -typedef struct -{ - int8 TxPerChannelPowerCompensation_2_4G[HALF_NUMBER_OF_2_4_G_CHANNELS]; /* 7 */ - int8 TxPerChannelPowerCompensation_5G_OFDM[HALF_NUMBER_OF_5G_CHANNELS]; /* 18 */ - uint8 Padding[3]; - -}IniFileExtendedRadioParam; - -/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/ - -/* 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; - IniFileExtendedRadioParam IniFileExtendedRadioParams; - 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 */ diff --git a/wl1271/TWD/FirmwareApi/public_types.h b/wl1271/TWD/FirmwareApi/public_types.h deleted file mode 100644 index d806b899..00000000 --- a/wl1271/TWD/FirmwareApi/public_types.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - * public_types.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/********************************************************************************************************************** - - 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*/ diff --git a/wl1271/TWD/MacServices/Export_Inc/MacServices_api.h b/wl1271/TWD/MacServices/Export_Inc/MacServices_api.h deleted file mode 100644 index e547615f..00000000 --- a/wl1271/TWD/MacServices/Export_Inc/MacServices_api.h +++ /dev/null @@ -1,524 +0,0 @@ -/* - * MacServices_api.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file MacServicesApi.h - * \brief This file include public definitions for the MacServices module, comprising its API. - * \author Yuval Adler - * \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 - *********************************************************************** - */ -/** - * \author Yuval Adler\n - * \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 ); - -/** - * \author Yuval Adler\n - * \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 ); - -/** - * \author Yuval Adler\n - * \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__ */ diff --git a/wl1271/TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h b/wl1271/TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h deleted file mode 100644 index d76f4dac..00000000 --- a/wl1271/TWD/MacServices/Export_Inc/measurementSrvDbgPrint.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * measurementSrvDbgPrint.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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__ */ - diff --git a/wl1271/TWD/MacServices/MacServices.c b/wl1271/TWD/MacServices/MacServices.c deleted file mode 100644 index 697be339..00000000 --- a/wl1271/TWD/MacServices/MacServices.c +++ /dev/null @@ -1,376 +0,0 @@ -/* - * MacServices.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file MacServices.c - * \brief This file include public definitions for the scan SRV module, comprising its API. - * \author Yuval Adler - * \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) ); - 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); -} - - - - - - diff --git a/wl1271/TWD/MacServices/MacServices.h b/wl1271/TWD/MacServices/MacServices.h deleted file mode 100644 index a92551c6..00000000 --- a/wl1271/TWD/MacServices/MacServices.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * MacServices.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file MacServices.h - * \brief This file include internal definitions for the MacServices module - * \author Yuval Adler - * \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__ */ diff --git a/wl1271/TWD/MacServices/MeasurementSrv.c b/wl1271/TWD/MacServices/MeasurementSrv.c deleted file mode 100644 index d780a79c..00000000 --- a/wl1271/TWD/MacServices/MeasurementSrv.c +++ /dev/null @@ -1,1080 +0,0 @@ -/* - * MeasurementSrv.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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)); - 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; -} - - diff --git a/wl1271/TWD/MacServices/MeasurementSrv.h b/wl1271/TWD/MacServices/MeasurementSrv.h deleted file mode 100644 index 7a852f4e..00000000 --- a/wl1271/TWD/MacServices/MeasurementSrv.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * MeasurementSrv.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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__ */ - diff --git a/wl1271/TWD/MacServices/MeasurementSrvSM.c b/wl1271/TWD/MacServices/MeasurementSrvSM.c deleted file mode 100644 index e81d41d7..00000000 --- a/wl1271/TWD/MacServices/MeasurementSrvSM.c +++ /dev/null @@ -1,1063 +0,0 @@ -/* - * MeasurementSrvSM.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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_UINT32 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, ¶mInfo); - - /* 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, ¶mInfo); - - 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; /* TODO change this to an infinite value (was 0) */ - 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_UINT32 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; -} - diff --git a/wl1271/TWD/MacServices/MeasurementSrvSM.h b/wl1271/TWD/MacServices/MeasurementSrvSM.h deleted file mode 100644 index 6c502e98..00000000 --- a/wl1271/TWD/MacServices/MeasurementSrvSM.h +++ /dev/null @@ -1,261 +0,0 @@ -/* - * MeasurementSrvSM.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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__ */ - diff --git a/wl1271/TWD/MacServices/PowerSrv.c b/wl1271/TWD/MacServices/PowerSrv.c deleted file mode 100644 index 71c33ac6..00000000 --- a/wl1271/TWD/MacServices/PowerSrv.c +++ /dev/null @@ -1,812 +0,0 @@ -/* - * PowerSrv.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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)); - 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 ); -} - diff --git a/wl1271/TWD/MacServices/PowerSrv.h b/wl1271/TWD/MacServices/PowerSrv.h deleted file mode 100644 index b5f19da9..00000000 --- a/wl1271/TWD/MacServices/PowerSrv.h +++ /dev/null @@ -1,194 +0,0 @@ -/* - * PowerSrv.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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_ */ - diff --git a/wl1271/TWD/MacServices/PowerSrvSM.c b/wl1271/TWD/MacServices/PowerSrvSM.c deleted file mode 100644 index 173a080f..00000000 --- a/wl1271/TWD/MacServices/PowerSrvSM.c +++ /dev/null @@ -1,814 +0,0 @@ -/* - * PowerSrvSM.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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)); - 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; -} - diff --git a/wl1271/TWD/MacServices/PowerSrvSM.h b/wl1271/TWD/MacServices/PowerSrvSM.h deleted file mode 100644 index 97464ac8..00000000 --- a/wl1271/TWD/MacServices/PowerSrvSM.h +++ /dev/null @@ -1,281 +0,0 @@ -/* - * PowerSrvSM.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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_ */ - diff --git a/wl1271/TWD/MacServices/PowerSrv_API.h b/wl1271/TWD/MacServices/PowerSrv_API.h deleted file mode 100644 index 9aca40e0..00000000 --- a/wl1271/TWD/MacServices/PowerSrv_API.h +++ /dev/null @@ -1,281 +0,0 @@ -/* - * PowerSrv_API.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \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_ */ diff --git a/wl1271/TWD/MacServices/ScanSrv.c b/wl1271/TWD/MacServices/ScanSrv.c deleted file mode 100644 index cdb64643..00000000 --- a/wl1271/TWD/MacServices/ScanSrv.c +++ /dev/null @@ -1,756 +0,0 @@ -/* - * ScanSrv.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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" - -/** - * \\n - * \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)); - if ( NULL == pScanSRV ) - { - WLAN_OS_REPORT( ("ERROR: Failed to create scan SRV module")); - return NULL; - } - - os_memoryZero( pScanSRV->hOS, pScanSRV, sizeof(scanSRV_t)); - - /* 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; -} - -/** - * \\n - * \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 */ - if (pScanSRV->hScanSrvTimer) - { - tmr_DestroyTimer (pScanSRV->hScanSrvTimer); - } - - /* free memory */ - fsm_Unload( pScanSRV->hOS, pScanSRV->SM ); - os_memoryFree( pScanSRV->hOS, (TI_HANDLE)pScanSRV , sizeof(scanSRV_t)); -} - -/** - * \\n - * \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; - } -} - -/** - * \\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); -} - -/** - * \\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; -} - -/** - * \\n - * \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 ); - } -} - -/** - * \\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; -} - -/** - * \\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; -} - -/** - * \\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 ); -} - -/** - * \\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 ); - } -} - - -/** - * \\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 ); -} - -/** - * \\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 ); -} - -/** - * \\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; -} - -/** - * \\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; -} - - -/** - * \\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 -/** - * \\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 - diff --git a/wl1271/TWD/MacServices/ScanSrv.h b/wl1271/TWD/MacServices/ScanSrv.h deleted file mode 100644 index 3370cefb..00000000 --- a/wl1271/TWD/MacServices/ScanSrv.h +++ /dev/null @@ -1,308 +0,0 @@ -/* - * ScanSrv.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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) */ -#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 - *********************************************************************** - */ - -/** - * \\n - * \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 ); - -/** - * \\n - * \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 ); - -/** - * \\n - * \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); - -/** - * \\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 ); - -/** - * \\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 ); - -/** - * \\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 ); - -/** - * \\n - * \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__ */ diff --git a/wl1271/TWD/MacServices/ScanSrvSM.c b/wl1271/TWD/MacServices/ScanSrvSM.c deleted file mode 100644 index 8d96feaa..00000000 --- a/wl1271/TWD/MacServices/ScanSrvSM.c +++ /dev/null @@ -1,584 +0,0 @@ -/* - * ScanSrvSM.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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; -} - -/** - * \author Yuval Adler\n - * \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; -} - - diff --git a/wl1271/TWD/MacServices/ScanSrvSM.h b/wl1271/TWD/MacServices/ScanSrvSM.h deleted file mode 100644 index 0b87e9fe..00000000 --- a/wl1271/TWD/MacServices/ScanSrvSM.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * ScanSrvSM.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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 ); - -/** - * \author Yuval Adler\n - * \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__ */ diff --git a/wl1271/TWD/MacServices/measurementSrvDbgPrint.c b/wl1271/TWD/MacServices/measurementSrvDbgPrint.c deleted file mode 100644 index aef32631..00000000 --- a/wl1271/TWD/MacServices/measurementSrvDbgPrint.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * measurementSrvDbgPrint.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/** \file 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 */ -} - diff --git a/wl1271/TWD/TWDriver/Device.h b/wl1271/TWD/TWDriver/Device.h deleted file mode 100644 index 625911e2..00000000 --- a/wl1271/TWD/TWDriver/Device.h +++ /dev/null @@ -1,419 +0,0 @@ -/* - * Device.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * MODULE: 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 */ - diff --git a/wl1271/TWD/TWDriver/Device1273.h b/wl1271/TWD/TWDriver/Device1273.h deleted file mode 100644 index ccfa7d08..00000000 --- a/wl1271/TWD/TWDriver/Device1273.h +++ /dev/null @@ -1,981 +0,0 @@ -/* - * Device1273.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/********************************************************************************************************************** - - 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_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 diff --git a/wl1271/TWD/TWDriver/TWDriver.c b/wl1271/TWD/TWDriver/TWDriver.c deleted file mode 100644 index eebfceed..00000000 --- a/wl1271/TWD/TWDriver/TWDriver.c +++ /dev/null @@ -1,1808 +0,0 @@ -/* - * TWDriver.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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" - - - -#define TWD_CB_MODULE_OWNER_MASK 0xff00 -#define TWD_CB_TYPE_MASK 0x00ff - - - - -TI_HANDLE TWD_Create (TI_HANDLE hOs) -{ - TTwd *pTWD; - - /* Allocate the TNETW_Driver module */ - pTWD = (TTwd *)os_memoryAlloc (hOs, sizeof(TTwd)); - 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, - pTWD->hTimer, - 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, pTWD->hTimer); - -#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->hTimer, - pTWD->hTxnQ, - (TRecoveryCb)TWD_StopComplete, - hTWD); -} - - TI_STATUS TWD_InitHw (TI_HANDLE hTWD, - TI_UINT8 *pbuf, - TI_UINT32 length, - TI_UINT32 uRxDmaBufLen, - TI_UINT32 uTxDmaBufLen) -{ - TTwd *pTWD = (TTwd *)hTWD; - TI_STATUS eStatus; - - TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_InitHw: called\n"); - - /* Provide bus related parameters to Xfer modules before any usage of the bus! */ - rxXfer_SetBusParams (pTWD->hRxXfer, uRxDmaBufLen); - txXfer_SetBusParams (pTWD->hTxXfer, uTxDmaBufLen); - - 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; - - /* check Parameters */ - if (( pTWD == NULL ) || ( pFileInfo == NULL )) - { - return (TI_NOK); - } - - TRACE0(pTWD->hReport, REPORT_SEVERITY_INIT , "TWD_InitFw: called\n"); - - 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); - IniFileExtendedRadioParam *pExtRadioParams = &DB_EXT_RADIO(pTWD->hCmdBld); - IniFileGeneralParam *pGenParams = &DB_GEN(pTWD->hCmdBld); - TRateMngParams *pRateMngParams = &DB_RM(pTWD->hCmdBld); - TDmaParams *pDmaParams = &DB_DMA(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; - pWlanParams->ArpRspTemplateSize = pInitParams->tGeneral.ArpRspTemplateSize; - - /* 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; - - pWlanParams->ch14TelecCca = pInitParams->tGeneral.halCtrlCh14TelecCca; - - /* Data interrupts pacing */ - pWlanParams->TxCompletePacingThreshold = pInitParams->tGeneral.TxCompletePacingThreshold; - pWlanParams->TxCompletePacingTimeout = pInitParams->tGeneral.TxCompletePacingTimeout; - pWlanParams->RxIntrPacingThreshold = pInitParams->tGeneral.RxIntrPacingThreshold; - pWlanParams->RxIntrPacingTimeout = pInitParams->tGeneral.RxIntrPacingTimeout; - - /* Number of Rx mem-blocks to allocate in FW */ - pDmaParams->NumRxBlocks = pInitParams->tGeneral.uRxMemBlksNum; - - - /* Configure ARP IP */ - pWlanParams->arpFilterType = pInitParams->tArpIpFilter.filterType; - 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 TWD modules */ - rxXfer_SetDefaults (pTWD->hRxXfer, pInitParams); - txXfer_SetDefaults (pTWD->hTxXfer, pInitParams); - txHwQueue_Config (pTWD->hTxHwQueue, pInitParams); - 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_NOT_SUPPORTED; - pWlanParams->tTwdHtCapabilities.uMaxAMSDU = MAX_MSDU_3839_OCTETS; - pWlanParams->tTwdHtCapabilities.uMaxAMPDU = pInitParams->tGeneral.uMaxAMPDU; - - pWlanParams->tTwdHtCapabilities.uAMPDUSpacing = AMPDU_SPC_8_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*)pExtRadioParams, (void*)&pInitParams->tIniFileExtRadioParams, sizeof(IniFileExtendedRadioParam)); - 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 = pInitParams->tRateMngParams.InverseCuriosityFactor; - 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; - pRateMngParams->rateMngParams.RateRetryScore = pInitParams->tRateMngParams.RateRetryScore; - pRateMngParams->rateMngParams.TxFailHighTh = pInitParams->tRateMngParams.TxFailHighTh; - pRateMngParams->rateMngParams.TxFailLowTh = pInitParams->tRateMngParams.TxFailLowTh; - - /* RATE_MNG_MAX_RETRY_POLICY_PARAMS_LEN */ - for (uIndex = 0; uIndex < 13; uIndex++) - { - pRateMngParams->rateMngParams.RateRetryPolicy[uIndex] = pInitParams->tRateMngParams.RateRetryPolicy[uIndex]; - } - - /* DCO Itrim params */ - pWlanParams->dcoItrimEnabled = pInitParams->tDcoItrimParams.enable; - pWlanParams->dcoItrimModerationTimeoutUsec = pInitParams->tDcoItrimParams.moderationTimeoutUsec; - - 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); - - /* Forward the Health-Moitor callback to the RxXfer for Rx packet errors */ - rxXfer_RegisterErrCb (pTWD->hRxXfer, 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: - txXfer_PrintStats (pTWD->hTxXfer); - break; - - case TWD_PRINT_TX_RESULT_INFO: - txResult_PrintInfo (pTWD->hTxResult); - break; - - case TWD_CLEAR_TX_RESULT_INFO: - txResult_ClearInfo (pTWD->hTxResult); - break; - - case TWD_CLEAR_TX_XFER_INFO: - txXfer_ClearStats (pTWD->hTxXfer); - 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) -{ - if (hTWD == NULL || pMemDebug == NULL) - { - return (TI_NOK); - } - - TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_INFORMATION , "TWD_readMem: called\n"); - - 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) -{ - if (hTWD == NULL || pMemDebug == NULL) - { - return (TI_NOK); - } - - TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_INFORMATION , "TWD_writeMem: called\n"); - - 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) -{ - if (hTWD == NULL || pMemDebug == NULL) - { - return TI_FALSE; - } - - TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_INFORMATION , "TWD_isValidMemoryAddr: called\n"); - - return fwDbg_isValidMemoryAddr(((TTwd *)hTWD)->hFwDbg,pMemDebug->addr,pMemDebug->length); -} - -TI_BOOL TWD_isValidRegAddr (TI_HANDLE hTWD, TFwDebugParams* pMemDebug) -{ - if (hTWD == NULL || pMemDebug == NULL ) - { - return TI_FALSE; - } - - TRACE0(((TTwd *)hTWD)->hReport, REPORT_SEVERITY_INFORMATION , "TWD_isValidRegAddr: called\n"); - - 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; - TI_UINT32 uRateMask = RATE_TO_MASK(pMib->aData.TemplateFrame.Rate); - - /* - * 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)uRateMask); - break; - - case TEMPLATE_TYPE_PROBE_RESPONSE: - tSetTemplate.type = PROBE_RESPONSE_TEMPLATE; - break; - - case TEMPLATE_TYPE_QOS_NULL_FRAME: - 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 = uRateMask; - - 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 TI_NOK; - } -#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); -} - -/** - * \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) -{ - TTwd *pTWD = (TTwd *)hTWD; - IniFileGeneralParam *pGenParams = &DB_GEN(pTWD->hCmdBld); - - return pGenParams->TXBiPFEMManufacturer; - -} - -/** - * \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) -{ - 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); -} diff --git a/wl1271/TWD/TWDriver/TWDriver.h b/wl1271/TWD/TWDriver/TWDriver.h deleted file mode 100644 index 225a1032..00000000 --- a/wl1271/TWD/TWDriver/TWDriver.h +++ /dev/null @@ -1,4750 +0,0 @@ -/* - * TWDriver.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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 - - -#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_TX_MIN_MEM_BLKS_NUM 40 /* 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_CONFIG_PARAMS_DEF_TABLE "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" -#define SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE_SRF1 "07,03,18,10,05,fb,f0,e8, 0,0,0,0,0,0,0f,3f" -#define SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE_SRF2 "07,03,18,10,05,f6,f0,e8" -#define SMART_REFLEX_CONFIG_PARAMS_DEF_TABLE_SRF3 "07,03,18,10,05,fb,f0,e8" - -#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 4 /* 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 700 /* The Tx Complete interrupt pacing timeout in microseconds! */ -#define TWD_TX_CMPLT_TIMEOUT_MIN 1 -#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_THRESHOLD_DEF_WIFI_MODE 0 /* No Rx interrupt pacing so send interrupt on every event */ - -#define TWD_RX_INTR_TIMEOUT_DEF 600 /* The Rx interrupt pacing timeout in microseconds! */ -#define TWD_RX_INTR_TIMEOUT_MIN 1 -#define TWD_RX_INTR_TIMEOUT_MAX 50000 - -/* Rx aggregation packets number limit (max packets in one aggregation) */ -#define TWD_RX_AGGREG_PKTS_LIMIT_DEF 4 -#define TWD_RX_AGGREG_PKTS_LIMIT_MIN 0 -#define TWD_RX_AGGREG_PKTS_LIMIT_MAX 4 - -/* Tx aggregation packets number limit (max packets in one aggregation) */ -#define TWD_TX_AGGREG_PKTS_LIMIT_DEF 0 -#define TWD_TX_AGGREG_PKTS_LIMIT_MIN 0 -#define TWD_TX_AGGREG_PKTS_LIMIT_MAX 32 - -/* - * Tx power level - */ -#define DBM_TO_TX_POWER_FACTOR 10 - -/* TX_POWER is in Dbm/10 units */ -#define MAX_TX_POWER 250 -#define MIN_TX_POWER 0 -#define DEF_TX_POWER 205 - - -#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_BEACON_WEIGHT_MIN 0 -#define TWD_RSSI_BEACON_WEIGHT_MAX 100 -#define TWD_RSSI_BEACON_WEIGHT_DEF 20 - -#define TWD_RSSI_PACKET_WEIGHT_MIN 0 -#define TWD_RSSI_PACKET_WEIGHT_MAX 100 -#define TWD_RSSI_PACKET_WEIGHT_DEF 10 - -#define TWD_SNR_BEACON_WEIGHT_MIN 0 -#define TWD_SNR_BEACON_WEIGHT_MAX 100 -#define TWD_SNR_BEACON_WEIGHT_DEF 20 - -#define TWD_SNR_PACKET_WEIGHT_MIN 0 -#define TWD_SNR_PACKET_WEIGHT_MAX 100 -#define TWD_SNR_PACKET_WEIGHT_DEF 10 - -#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 160 - -#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 -#define HT_INF_DUAL_CTS_PROTECTION_BITMASK 0x80 - -/* - * 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 */ -/* 5 */ TWD_CLEAR_TX_XFER_INFO /**< Clear TX Xfer 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_SUPPORTED - /* 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 */ -/* 9 */ RX_XFER_FAILURE, /**< Rx pkt xfer failure */ - -/* must be last!!! */ -/* 10 */ 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 */ -/* 8 */ ARP_RSP_TEMPLATE /**< ARP Ressponse 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_SUPPORTED - /* 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 S60 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 - */ - -/* - ============== - - IMPORTANT NOTE - Changes to this enumeration must check weather MIN and MAX values - should be updated - ============== -*/ -typedef enum -{ - MAX_MPDU_MIN_VALUE = 0, - -/* 0 */ MAX_MPDU_8191_OCTETS = MAX_MPDU_MIN_VALUE, /**< 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 */ - - MAX_MPDU_MAX_VALUE = MAX_MPDU_65535_OCTETS - -} 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; - - -typedef enum -{ - ArpFilterDisabled, - ArpFilterEnabled, - ArpFilterEnabledAutoMode = 3 -} EArpFilterType; - -/* - * -------------------------------------------------------------- - * 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 */ - struct _TTxCtrlBlk *pNextAggregEntry; /**< Pointer to the next aggregated packet 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; /**< 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 - */ -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 */ - TCoexActivity tTwdParamsCoexActivity; /**< */ - - /* 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_e 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 halCtrlCh14TelecCca; /**< */ - 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_UINT32 uRxAggregPktsLimit; /**< */ - TI_UINT32 uTxAggregPktsLimit; /**< */ - 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 ArpRspTemplateSize; /**< */ - 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_UINT8 uRxMemBlksNum; /**< */ - 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; /**< */ - TI_UINT8 uMaxAMPDU; /**< */ - -} 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 -{ - EArpFilterType filterType; /**< */ - 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; - uint8 TxFailLowTh; - uint8 TxFailHighTh; - uint8 PerAlphaShift; - uint8 PerAddShift; - uint8 PerBeta1Shift; - uint8 PerBeta2Shift; - uint8 RateCheckUp; - uint8 RateCheckDown; - uint8 RateRetryPolicy[13]; -}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 */ - IniFileExtendedRadioParam tIniFileExtRadioParams; /**< Radio Initialization Parameters */ - IniFileGeneralParam tPlatformGenParams; /**< Radio Initialization Parameters */ - RateMangeParams_t tRateMngParams; - 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, PacketClassTag_e ePacketClassTag); -/** @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 - * \param uRxDmaBufLen - The Rx DMA buffer length in bytes (needed as a limit for Rx aggregation length) - * \param uTxDmaBufLen - The Tx DMA buffer length in bytes (needed as a limit for Tx aggregation length) - * \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, - TI_UINT32 uRxDmaBufLen, - TI_UINT32 uTxDmaBufLen); -/** @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); -/** @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); - - -/** @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 */ -/*---------*/ - - -/** @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); - -/** @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); - -/** @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, - EArpFilterType filterType, - EIpVer eIpVer); - -TI_STATUS TWD_CfgArpIpFilter (TI_HANDLE hTWD, - TIpAddr tIpAddr); - -/** @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 Data_Path - * \brief Indicates that current packets burst stopped - * - * \param hTWD - TWD module object handle - * \return void - * - * \par Description - * Indicates that current packets burst stopped, so the TxXfer will send its aggregated packets to FW. - * - * \sa - */ -void TWD_txXfer_EndOfBurst (TI_HANDLE hTWD); - -/** @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 - */ -ETxnStatus 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); - -/** @ingroup Data_Path - * \brief TWD_CfgBurstMode - * - * \param hTWD - TWD module object handle - * \param bEnabled - is Burst mode enabled - * \return TI_OK - * - * \par Description - * Use this function to enable/disbale the burst mode - * - * \sa - */ -TI_STATUS TWD_CfgBurstMode (TI_HANDLE hTWD, TI_BOOL bEnabled); -TI_STATUS TWD_SetRateMngDebug(TI_HANDLE hTWD, RateMangeParams_t *pRateMngParams); -TI_STATUS TWD_GetRateMngDebug(TI_HANDLE hTWD, RateMangeReadParams_t *pParamInfo); - -#endif /* TWDRIVER_H */ diff --git a/wl1271/TWD/TWDriver/TWDriverCtrl.c b/wl1271/TWD/TWDriver/TWDriverCtrl.c deleted file mode 100644 index 8cb89e91..00000000 --- a/wl1271/TWD/TWDriver/TWDriverCtrl.c +++ /dev/null @@ -1,923 +0,0 @@ -/* - * TWDriverCtrl.c - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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); - - 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.tTwdParamsCoexActivity, 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, EArpFilterType filterType, EIpVer eIpVer) -{ - TTwd *pTWD = (TTwd *)hTWD; - - TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgArpIpAddrTable: called\n"); - - return cmdBld_CfgArpIpAddrTable (pTWD->hCmdBld, tIpAddr, (TI_UINT8)filterType, 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, TIpAddr staIp) -{ - TTwd *pTWD = (TTwd *)hTWD; - - TRACE0(pTWD->hReport, REPORT_SEVERITY_INFORMATION , "TWD_CfgArpIpFilter: called\n"); - - return cmdBld_CfgArpIpFilter (pTWD->hCmdBld, staIp, 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[2] & HT_INF_NON_GF_PRES_BITMASK) >> 2; - - uHtTxBurstLimit = 0; /* not in use */ - - uDualCtsProtection = (pHtInformationIe->aHtInformationIe[4] & HT_INF_DUAL_CTS_PROTECTION_BITMASK) >> 7; - - 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); - } -} - -ETxnStatus TWD_WdExpireEvent(TI_HANDLE hTWD) -{ - TTwd *pTWD = (TTwd*)hTWD; - - if ((pTWD->fFailureEventCb != NULL) && (pTWD->hFailureEventCb != NULL)) - { - pTWD->fFailureEventCb(pTWD->hFailureEventCb, HW_WD_EXPIRE); - } - - return TXN_STATUS_COMPLETE; -} diff --git a/wl1271/TWD/TWDriver/TWDriverInternal.h b/wl1271/TWD/TWDriver/TWDriverInternal.h deleted file mode 100644 index 5e5a82b6..00000000 --- a/wl1271/TWD/TWDriver/TWDriverInternal.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * TWDriverInternal.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - - -/** \file 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 */ - diff --git a/wl1271/TWD/TWDriver/TWDriverMsr.h b/wl1271/TWD/TWDriver/TWDriverMsr.h deleted file mode 100644 index 4b0772b3..00000000 --- a/wl1271/TWD/TWDriver/TWDriverMsr.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * TWDriverMsr.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef 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 */ diff --git a/wl1271/TWD/TWDriver/TWDriverRadio.c b/wl1271/TWD/TWDriver/TWDriverRadio.c deleted file mode 100644 index 013a31d1..00000000 --- a/wl1271/TWD/TWDriver/TWDriverRadio.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * TWDriverRadio.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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)); -} diff --git a/wl1271/TWD/TWDriver/TWDriverRate.h b/wl1271/TWD/TWDriver/TWDriverRate.h deleted file mode 100644 index f944aee1..00000000 --- a/wl1271/TWD/TWDriver/TWDriverRate.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * TWDriverRate.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef 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 */ diff --git a/wl1271/TWD/TWDriver/TWDriverScan.h b/wl1271/TWD/TWDriver/TWDriverScan.h deleted file mode 100644 index 4bc4619f..00000000 --- a/wl1271/TWD/TWDriver/TWDriverScan.h +++ /dev/null @@ -1,324 +0,0 @@ -/* - * TWDriverScan.h - * - * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef 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 */ - - - /* - *********************************************************************** - * 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 */ - TI_UINT8 uSsidListFilterEnabled; /** 1: eneable filtering according to the list; 0: disable */ - 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 */ - - - - - diff --git a/wl1271/TWD/TWDriver/TWDriverTx.c b/wl1271/TWD/TWDriver/TWDriverTx.c deleted file mode 100644 index c3f179e2..00000000 --- a/wl1271/TWD/TWDriver/TWDriverTx.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * TWDriverTx.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/**************************************************************************** - * - * 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); -} - -void TWD_txXfer_EndOfBurst (TI_HANDLE hTWD) -{ - TTwd *pTWD = (TTwd *)hTWD; - - txXfer_EndOfBurst (pTWD->hTxXfer); -} - - diff --git a/wl1271/TWD/TwIf/TwIf.c b/wl1271/TWD/TwIf/TwIf.c deleted file mode 100644 index 08565de2..00000000 --- a/wl1271/TWD/TwIf/TwIf.c +++ /dev/null @@ -1,1148 +0,0 @@ -/* - * TwIf.c - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - -/** \file 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 "timer.h" -#include "TxnDefs.h" -#include "TxnQueue.h" -#include "TwIf.h" -#include "TWDriver.h" - - -/************************************************************************ - * Defines - ************************************************************************/ -#define TXN_DONE_QUE_SIZE QUE_UNLIMITED_SIZE -#define PEND_RESTART_TIMEOUT 100 /* timeout in msec for completion of last DMA transaction during restart */ - -/* 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 */ - TPartitionTxnData tData; /* The addresses partitioning configuration data */ - -} TPartitionTxn; - -/* The addresses partitioning configuration Txn */ -typedef struct -{ - TTxnStruct tHdr; /* The generic transaction structure */ - TI_UINT32 tData; /* 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 hTimer; - 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 - - TI_BOOL bTxnDoneInRecovery; /* Indicate that current TxnDone is within recovery process */ - TI_BOOL bPendRestartTimerRunning;/* Indicate that the restart guard timer is running */ - TI_HANDLE hPendRestartTimer; /* The restart process guard timer */ - -} 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); -static void twIf_PendRestratTimeout (TI_HANDLE hTwIf, TI_BOOL bTwdInitOccured); - - -/************************************************************************ - * - * 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)); - 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); - if (pTwIf->hTxnDoneQueue) - { - que_Destroy (pTwIf->hTxnDoneQueue); - } - if (pTwIf->hPendRestartTimer) - { - tmr_DestroyTimer (pTwIf->hPendRestartTimer); - } - 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 hXxx - Handles to other modules - * \param fRecoveryCb - Callback function for recovery completed after TxnDone - * \param hRecoveryCb - Handle for fRecoveryCb - * \return void - * \sa - */ -void twIf_Init (TI_HANDLE hTwIf, - TI_HANDLE hReport, - TI_HANDLE hContext, - TI_HANDLE hTimer, - 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->hTimer = hTimer; - 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")); - - /* Allocate timer */ - pTwIf->hPendRestartTimer = tmr_CreateTimer (hTimer); - if (pTwIf->hPendRestartTimer == NULL) - { - TRACE0(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_Init: Failed to create PendRestartTimer!\n"); - return; - } - pTwIf->bPendRestartTimerRunning = TI_FALSE; - - /* 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; - ETxnStatus eStatus; - - pTwIf->eState = SM_STATE_SLEEP; - pTwIf->uAwakeReqCount = 0; - - pTwIf->uPendingTxnCount = 0; - - /* Clear done queue */ - twIf_ClearTxnDoneQueue(hTwIf); - - /* Restart WLAN queues */ - eStatus = txnQ_Restart (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN); - - /* If pending upon ongoing transaction, start guard timer in case SDIO does not call us back */ - if (eStatus == TXN_STATUS_PENDING) - { - pTwIf->bPendRestartTimerRunning = TI_TRUE; - tmr_StartTimer (pTwIf->hPendRestartTimer, twIf_PendRestratTimeout, hTwIf, PEND_RESTART_TIMEOUT, TI_FALSE); - } - - /* Return result (COMPLETE if completed or PENDING if will be completed in TxnDone context) */ - return eStatus; -} - - -/** - * \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)); - pTxnHdr = &(pPartitionRegTxn->tHdr); - - /* Zero the allocated memory to be certain that unused fields will be initialized */ - os_memoryZero(pTwIf->hOs, pPartitionRegTxn, 7*sizeof(TPartitionRegTxn)); - - /* Prepare partition transaction data */ - pPartitionRegTxn[0].tData = ENDIAN_HANDLE_LONG(pTwIf->uMemAddr1); - pPartitionRegTxn[1].tData = ENDIAN_HANDLE_LONG(pTwIf->uMemSize1); - pPartitionRegTxn[2].tData = ENDIAN_HANDLE_LONG(pTwIf->uMemAddr2); - pPartitionRegTxn[3].tData = ENDIAN_HANDLE_LONG(pTwIf->uMemSize2); - pPartitionRegTxn[4].tData = ENDIAN_HANDLE_LONG(pTwIf->uMemAddr3); - pPartitionRegTxn[5].tData = ENDIAN_HANDLE_LONG(pTwIf->uMemSize3); - pPartitionRegTxn[6].tData = 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].tData), REGISTER_SIZE, 0, 0) - twIf_SendTransaction (pTwIf, pTxnHdr); - - /* Memory size */ - pTxnHdr = &(pPartitionRegTxn[1].tHdr); - BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+0, &(pPartitionRegTxn[1].tData), REGISTER_SIZE, 0, 0) - twIf_SendTransaction (pTwIf, pTxnHdr); - - /* Registers address */ - pTxnHdr = &(pPartitionRegTxn[2].tHdr); - BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+12, &(pPartitionRegTxn[2].tData), REGISTER_SIZE, 0, 0) - twIf_SendTransaction (pTwIf, pTxnHdr); - - /* Registers size */ - pTxnHdr = &(pPartitionRegTxn[3].tHdr); - BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+8, &(pPartitionRegTxn[3].tData), REGISTER_SIZE, 0, 0) - eStatus = twIf_SendTransaction (pTwIf, pTxnHdr); - - /* Registers address */ - pTxnHdr = &(pPartitionRegTxn[4].tHdr); - BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+20, &(pPartitionRegTxn[4].tData), REGISTER_SIZE, 0, 0) - twIf_SendTransaction (pTwIf, pTxnHdr); - - /* Registers size */ - pTxnHdr = &(pPartitionRegTxn[5].tHdr); - BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+16, &(pPartitionRegTxn[5].tData), REGISTER_SIZE, 0, 0) - eStatus = twIf_SendTransaction (pTwIf, pTxnHdr); - - /* Registers address */ - pTxnHdr = &(pPartitionRegTxn[6].tHdr); - BUILD_TTxnStruct(pTxnHdr, PARTITION_REGISTERS_ADDR+24, &(pPartitionRegTxn[6].tData), 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) - { - os_memoryFree (pTwIf->hOs, pPartitionRegTxn,7*sizeof(TPartitionRegTxn)); - } -} - - -static void twIf_PartitionTxnDoneCb (TI_HANDLE hTwIf, void *hTxn) -{ - TTwIfObj *pTwIf = (TTwIfObj*) hTwIf; - - /* Free the partition transaction buffer after completed (see transaction above) */ - 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 - TI_UINT32 data = 0; - - /* Verify that the Txn HW-Address is 4-bytes aligned */ - if (pTxn->uHwAddr & 0x3) - { - TRACE2(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_SendTransaction: Unaligned HwAddr! HwAddr=0x%x, Params=0x%x\n", pTxn->uHwAddr, pTxn->uTxnParams); - return TXN_STATUS_ERROR; - } -#endif - - context_EnterCriticalSection (pTwIf->hContext); - /* increment pending Txn counter */ - pTwIf->uPendingTxnCount++; - context_LeaveCriticalSection (pTwIf->hContext); - - /* 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++; } - - COPY_WLAN_LONG(&data,&(pTxn->aBuf[0])); - TRACE8(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_SendTransaction: Status = %d, Params=0x%x, HwAddr=0x%x, Len0=%d, Len1=%d, Len2=%d, Len3=%d, Data=0x%x \n", eStatus, pTxn->uTxnParams, pTxn->uHwAddr, pTxn->aLen[0], pTxn->aLen[1], pTxn->aLen[2], pTxn->aLen[3],data); -#endif - - /* If Txn status is PENDING issue Start event to the SM */ - if (eStatus == TXN_STATUS_PENDING) - { - twIf_HandleSmEvent (pTwIf, SM_EVENT_START); - } - - /* Else (COMPLETE or ERROR) */ - else - { - context_EnterCriticalSection (pTwIf->hContext); - /* decrement pending Txn counter in case of sync transact*/ - pTwIf->uPendingTxnCount--; - context_LeaveCriticalSection (pTwIf->hContext); - - /* 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: During Recovery\n"); - pTwIf->bTxnDoneInRecovery = TI_TRUE; - /* Request schedule to continue handling in driver context (will call twIf_HandleTxnDone()) */ - context_RequestSchedule (pTwIf->hContext, pTwIf->uContextId); - 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) - { - TI_STATUS eStatus; - - /* In critical section, enqueue the completed transaction in the TxnDoneQ. */ - context_EnterCriticalSection (pTwIf->hContext); - eStatus = que_Enqueue (pTwIf->hTxnDoneQueue, (TI_HANDLE)pTxn); - if (eStatus != TI_OK) - { - TRACE3(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_TxnDoneCb(): Enqueue failed, pTxn=0x%x, HwAddr=0x%x, Len0=%d\n", pTxn, pTxn->uHwAddr, pTxn->aLen[0]); - } - context_LeaveCriticalSection (pTwIf->hContext); - } - else - { - context_EnterCriticalSection (pTwIf->hContext); - /* 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--; - } - context_LeaveCriticalSection (pTwIf->hContext); - - } - - /* 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; - - /* In case of recovery, call the recovery callback and exit */ - if (pTwIf->bTxnDoneInRecovery) - { - TRACE0(pTwIf->hReport, REPORT_SEVERITY_INFORMATION, "twIf_HandleTxnDone: call RecoveryCb\n"); - pTwIf->bTxnDoneInRecovery = TI_FALSE; - if (pTwIf->bPendRestartTimerRunning) - { - tmr_StopTimer (pTwIf->hPendRestartTimer); - pTwIf->bPendRestartTimerRunning = TI_FALSE; - } - pTwIf->fRecoveryCb(pTwIf->hRecoveryCb); - return; - } - - /* Loop while there are completed transactions to handle */ - while (1) - { - /* In critical section, dequeue completed transaction from the TxnDoneQ. */ - context_EnterCriticalSection (pTwIf->hContext); - pTxn = (TTxnStruct *) que_Dequeue (pTwIf->hTxnDoneQueue); - context_LeaveCriticalSection (pTwIf->hContext); - - /* If no more transactions to handle, exit */ - if (pTxn != NULL) - { - context_EnterCriticalSection (pTwIf->hContext); - /* Decrement pending Txn counter */ - if (pTwIf->uPendingTxnCount > 0) /* in case of callback on recovery after restart */ - { - pTwIf->uPendingTxnCount--; - } - context_LeaveCriticalSection (pTwIf->hContext); - - 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_EnterCriticalSection (pTwIf->hContext); - pTxn = (TTxnStruct *) que_Dequeue (pTwIf->hTxnDoneQueue); - context_LeaveCriticalSection (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; - } - } -} - - -/** - * \fn twIf_PendRestratTimeout - * \brief Pending restart process timeout handler - * - * Called if timer expires upon fail to complete the last bus transaction that was - * pending during restart process. - * Calls the recovery callback to continue the restart process. - * - * \note - * \param hTwIf - The module's object - * \return void - * \sa - */ -static void twIf_PendRestratTimeout (TI_HANDLE hTwIf, TI_BOOL bTwdInitOccured) -{ - TTwIfObj *pTwIf = (TTwIfObj*)hTwIf; - - TRACE0(pTwIf->hReport, REPORT_SEVERITY_ERROR, "twIf_PendRestratTimeout: restart timer expired!\n"); - - pTwIf->bPendRestartTimerRunning = TI_FALSE; - - /* Clear the Txn queues since TxnDone wasn't called so it wasn't done by the TxnQ module */ - txnQ_ClearQueues (pTwIf->hTxnQ, TXN_FUNC_ID_WLAN); - - /* Call the recovery callback to continue the restart process */ - pTwIf->fRecoveryCb(pTwIf->hRecoveryCb); -} - - -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) -{ -#ifdef REPORT_LOG - 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(("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")); -#endif -} - - -void twIf_PrintQueues (TI_HANDLE hTwIf) -{ - TTwIfObj *pTwIf = (TTwIfObj*)hTwIf; - - txnQ_PrintQueues(pTwIf->hTxnQ); -} - -#endif /* TI_DBG */ diff --git a/wl1271/TWD/TwIf/TwIf.h b/wl1271/TWD/TwIf/TwIf.h deleted file mode 100644 index b0451cf8..00000000 --- a/wl1271/TWD/TwIf/TwIf.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * TwIf.h - * - * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name Texas Instruments nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - - -/** \file 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 hTimer, - 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__*/ |