Home | History | Annotate | Download | only in Sta_Management
      1 /*
      2  * currBss.h
      3  *
      4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.
      5  * All rights reserved.
      6  *
      7  * Redistribution and use in source and binary forms, with or without
      8  * modification, are permitted provided that the following conditions
      9  * are met:
     10  *
     11  *  * Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  *  * Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in
     15  *    the documentation and/or other materials provided with the
     16  *    distribution.
     17  *  * Neither the name Texas Instruments nor the names of its
     18  *    contributors may be used to endorse or promote products derived
     19  *    from this software without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32  */
     33 
     34 /** \file currBss.h
     35  *  \brief Current BSS module API
     36  *
     37  *  \see currBss.c
     38  */
     39 
     40 /****************************************************************************
     41  *                                                                          *
     42  *   MODULE:  Current BSS                                               *
     43  *   PURPOSE: Current BSS Module API                                    *
     44  *                                                                          *
     45  ****************************************************************************/
     46 
     47 #ifndef _CURR_BSS_H_
     48 #define _CURR_BSS_H_
     49 
     50 #include "siteMgrApi.h"
     51 #include "roamingMngrTypes.h"
     52 #include "paramOut.h"
     53 
     54 /* Constants */
     55 
     56 #define MAX_NUM_OF_RSSI_SNR_TRIGGERS 8
     57 
     58 /* Enumerations */
     59 
     60 /**
     61 * Current BSS module configurable parameters type
     62 */
     63 typedef enum
     64 {
     65     CURR_BSS_TYPE = 0,          /**< BSS or IBSS */
     66     CURR_BSS_CONNECTED_STATE,   /**< Connected or not connected, roaming enabled or not */
     67     CURR_BSS_LOW_RSSI_SCAN_COND,/**< Set by AP Connection when Roaming Manager configures low RSSI threshold for BG scan */
     68     CURR_BSS_HI_RSSI_SCAN_COND, /**< Set by AP Connection when Roaming Manager configures normal RSSI threshold for BG scan */
     69     CURR_BSS_QUALITY_THRESHOLD, /**< Set by AP Connection when Roaming Manager configures event of type 'Low RSSI' */
     70     CURR_BSS_NO_BSS_THRESHOLDS, /**< Set by AP Connection when Roaming Manager configures event of type 'BSS Loss' */
     71     CURR_BSS_NUM_OF_TEST_REPEAT,/**< Set by AP Connection when Roaming Manager configures event of type 'BSS Loss' */
     72     CURR_BSS_CONSEC_NACK,       /**< Set by AP Connection when Roaming Manager configures event of type 'Consecutive nack' */
     73     CURR_BSS_INFO               /**< Requested by AP Connection: includes quality and last beacon info */
     74 } currBSS_configParam_e;
     75 
     76 
     77 /* Structures */
     78 
     79 typedef struct triggerDataEx
     80 {
     81     TI_UINT8  data;
     82     TI_UINT16 clientID;
     83 } triggerDataEx_t;
     84 
     85 
     86 typedef struct triggerDesc
     87 {
     88 	TI_UINT16	clientID;
     89 	TI_HANDLE	fCB;
     90 	TI_HANDLE	hCB;
     91     TI_BOOL	    WasRegisteredByApp;
     92 } triggerDesc_t;
     93 
     94 
     95 /**
     96 * Current BSS control block
     97 * Following structure defines parameters that can be configured externally,
     98 * internal variables, and handlers of other modules used by Current BSS module
     99 */
    100 
    101 typedef struct _currBSS_t
    102 {
    103     /* Internal variables and configurable parameters */
    104     ScanBssType_e type;                   /**< Set by SME module; EBSS, IBSS or none */
    105     ERadioBand  band;                   /**< Set by SME module */
    106     TI_UINT8    channel;                /**< Set by AP Connection, SME and Switch Channel modules */
    107     TI_BOOL     isConnected;            /**< Default: not connected */
    108     bssEntry_t  currAPInfo;             /**< Set by SME upon request from AP Connection */
    109 
    110     TI_INT8     lowRssiThreshold;       /**< Last configured threshold for Low-RSSI */
    111     TI_INT8     lowSnrThreshold;        /**< Last configured threshold Low-SNR */
    112     TI_INT8     lowQualityForBkgrdScan; /**< Indicator used to increase the background scan period when quality is low */
    113     TI_INT8     highQualityForBkgrdScan;/**< Indicator used to reduce the background scan period when quality is normal */
    114     TI_UINT8    numExpectedTbttForBSSLoss;/**< last configured value without Soft Gemini compensation */
    115     TI_UINT8    maxTxRetryThreshold;    /**< last configured threshold for max Tx retry */
    116 
    117     TI_BOOL     bUseSGParams;           /**< Whether to use the Soft Gemini compensation on the roaming triggers (currently: BSS Loss) */
    118                                         /**< This compensation is needed since BT Activity might over-run beacons                       */
    119     TI_UINT32   SGcompensationPercent;  /**< the percentage of increasing the TbttForBSSLoss value when SG is enabled */
    120     TI_UINT8    uDefaultKeepAlivePeriod;/**< The default keep-alive period in seconds */
    121     TI_UINT8    keepAliveBuffer[ WLAN_WITH_SNAP_QOS_HEADER_MAX_SIZE ];
    122                                         /**< Buffer to store null-data keep-alive template */
    123 
    124     triggerDesc_t aTriggersDesc[MAX_NUM_OF_RSSI_SNR_TRIGGERS]; /* static table to be used for trigger event registration*/
    125     TI_UINT8	  RoamingOperationalMode;                      /* 0 - manual , 1 - Auto */
    126 
    127     /* Handlers of other modules used by AP Connection */
    128     TI_HANDLE   hOs;
    129     TI_HANDLE   hPowerMngr;
    130     TI_HANDLE   hAPConn;
    131     TI_HANDLE   hSme;
    132     TI_HANDLE   hTWD;
    133     TI_HANDLE   hMlme;
    134     TI_HANDLE   hReport;
    135     TI_HANDLE   hRegulatoryDomain;
    136     TI_HANDLE   hSiteMgr;
    137 	TI_HANDLE   hConn;
    138     TI_HANDLE   hScanMngr;
    139     TI_HANDLE   hEvHandler;
    140     TI_HANDLE   hTxCtrl;
    141 } currBSS_t;
    142 
    143 
    144 /* Typedefs */
    145 
    146 typedef void (*TCurrBssDataCb) (TI_HANDLE hCurrBSS, TI_UINT8 *data, TI_UINT8 dataLength);
    147 
    148 /* External data definitions */
    149 
    150 /* External functions definitions */
    151 
    152 /* Function prototypes */
    153 
    154 TI_HANDLE currBSS_create(TI_HANDLE hOs);
    155 void      currBSS_init (TStadHandlesList *pStadHandles);
    156 TI_STATUS currBSS_SetDefaults (TI_HANDLE hCurrBSS, TCurrBssInitParams *pInitParams);
    157 TI_STATUS currBSS_unload(TI_HANDLE hCurrBSS);
    158 
    159 void currBSS_updateConnectedState(TI_HANDLE hCurrBSS, TI_BOOL isConnected, ScanBssType_e type);
    160 TI_STATUS currBSS_updateRoamingTriggers(TI_HANDLE hCurrBSS,
    161                                         roamingMngrThresholdsConfig_t *params);
    162 void currBSS_SGconfigureBSSLoss(TI_HANDLE hCurrBSS,
    163                                         TI_UINT32 SGcompensationPercent , TI_BOOL bUseSGParams);
    164 bssEntry_t *currBSS_getBssInfo(TI_HANDLE hCurrBSS);
    165 
    166 TI_STATUS currBSS_getRoamingParams(TI_HANDLE hCurrBSS,
    167                                    TI_UINT8 * aNumExpectedTbttForBSSLoss,
    168                                    TI_INT8 * aLowQualityForBackgroungScanCondition,
    169                                    TI_INT8 * aNormalQualityForBackgroungScanCondition);
    170 
    171 TI_STATUS currBSS_probRespReceivedCallb(TI_HANDLE hCurrBSS,
    172                                         TRxAttr *pRxAttr,
    173                                         TMacAddr *bssid,
    174                                         mlmeFrameInfo_t *pFrameInfo,
    175 										TI_UINT8 *dataBuffer,
    176                                         TI_UINT16 bufLength);
    177 
    178 TI_STATUS currBSS_beaconReceivedCallb(TI_HANDLE hCurrBSS,
    179                                         TRxAttr *pRxAttr,
    180                                         TMacAddr *bssid,
    181                                         mlmeFrameInfo_t *pFrameInfo,
    182 										TI_UINT8 *dataBuffer,
    183                                         TI_UINT16 bufLength);
    184 
    185 void currBSS_restartRssiCounting(TI_HANDLE hCurrBSS);
    186 
    187 void currBSS_GetDefaultKeepAlivePeriod(TI_HANDLE hCurrBSS, TI_UINT8* uDefaultKeepAlivePeriod);
    188 
    189 void currBss_DbgPrintTriggersTable(TI_HANDLE hCurrBSS);
    190 
    191 #endif /*  _CURR_BSS_H_*/
    192 
    193