Home | History | Annotate | Download | only in scanCncn
      1 /** \file ScanCncn.h
      2  *  \brief This file include private definitions for the scan concentrator module.
      3  *  \author Ronen Kalish
      4  *  \date 30-Dec-2004
      5  */
      6  /****************************************************************************
      7 **+-----------------------------------------------------------------------+**
      8 **|                                                                       |**
      9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved.      |**
     10 **| All rights reserved.                                                  |**
     11 **|                                                                       |**
     12 **| Redistribution and use in source and binary forms, with or without    |**
     13 **| modification, are permitted provided that the following conditions    |**
     14 **| are met:                                                              |**
     15 **|                                                                       |**
     16 **|  * Redistributions of source code must retain the above copyright     |**
     17 **|    notice, this list of conditions and the following disclaimer.      |**
     18 **|  * Redistributions in binary form must reproduce the above copyright  |**
     19 **|    notice, this list of conditions and the following disclaimer in    |**
     20 **|    the documentation and/or other materials provided with the         |**
     21 **|    distribution.                                                      |**
     22 **|  * Neither the name Texas Instruments nor the names of its            |**
     23 **|    contributors may be used to endorse or promote products derived    |**
     24 **|    from this software without specific prior written permission.      |**
     25 **|                                                                       |**
     26 **| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   |**
     27 **| "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     |**
     28 **| LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |**
     29 **| A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  |**
     30 **| OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |**
     31 **| SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      |**
     32 **| LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |**
     33 **| DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |**
     34 **| THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |**
     35 **| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |**
     36 **| OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |**
     37 **|                                                                       |**
     38 **+-----------------------------------------------------------------------+**
     39 ****************************************************************************/
     40 
     41 #ifndef __SCANCNCN_H__
     42 #define __SCANCNCN_H__
     43 
     44 #include "osApi.h"
     45 #include "MacServices_api.h"
     46 #include "ScanCncnApi.h"
     47 #include "fsm.h"
     48 #include "ScanCncnDrvSM.h"
     49 
     50 
     51 
     52 /*
     53  ***********************************************************************
     54  *	Constant definitions.
     55  ***********************************************************************
     56  */
     57 
     58 /* allocation vector */
     59 #define SCAN_ALLOC_OBJECT           0
     60 #define SCAN_ALLOC_APP_SM           1
     61 #define SCAN_ALLOC_DRV_SM           2
     62 #define SCAN_ALLOC_CONT_SM          3
     63 #define SCAN_ALLOC_IMMED_SM         4
     64 #define SCAN_ALLOC_OID_SM			5
     65 
     66 /* Used in parameter: bAbortOrStop in scanConcentrator_t. */
     67 #define SCAN_CNCN_ABORT         FALSE
     68 #define SCAN_CNCN_STOP          TRUE
     69 
     70 
     71 /*
     72  ***********************************************************************
     73  *	Enums.
     74  ***********************************************************************
     75  */
     76 
     77 /*
     78  ***********************************************************************
     79  *	Typedefs.
     80  ***********************************************************************
     81  */
     82 
     83 /*
     84  ***********************************************************************
     85  *	Structure definitions.
     86  ***********************************************************************
     87  */
     88 
     89 /** \struct scanConcentrator_t
     90  * \brief This structure contains the scan concentrator object data
     91  */
     92 typedef struct
     93 {
     94     /* handles to other modules */
     95     TI_HANDLE               hOS;                    /**< OS object handle */
     96 	TI_HANDLE				hHalCtrl;				/**< Hal Ctrl object handle */
     97     TI_HANDLE               hReport;                /**< report object handle */
     98     TI_HANDLE               hRegulatoryDomain;      /**< regulatory domain object handle */
     99     TI_HANDLE               hSiteManager;           /**< site manager object handle */
    100     TI_HANDLE               hSCR;                   /**< SCR object handle */
    101     TI_HANDLE               hMacServices;           /**< Mac SRV object handle */
    102     TI_HANDLE               hAPConn;                /**< AP connection object handle */
    103     TI_HANDLE               hEventSrv;              /**< Event SRV object handle */
    104     TI_HANDLE               hMlme;                  /**< MLME object handle */
    105     TI_HANDLE               hCtrlData;              /**< Data CTRL object handle (for retrieving current BSSID) */
    106 	TI_HANDLE				hHealthMonitor;			/**< Health Monitor , Originally at scanSrv */
    107 
    108     /* Scan complete callbacks */
    109     scan_resultCB_t         scanResultCB[ SCAN_SCC_NUM_OF_CLIENTS ];          /**<
    110                                                                                * scan complete callback function
    111                                                                                * pointers, for various clients
    112                                                                                */
    113     TI_HANDLE               scanResultCBObj[ SCAN_SCC_NUM_OF_CLIENTS ];       /**<
    114                                                                                * scan complete callback objects,
    115                                                                                * for various clients
    116                                                                                */
    117     scan_cncnResultStatus_e scanResult[ SCAN_SCC_NUM_OF_CLIENTS ];            /**<
    118                                                                                * clients' scan results, used to
    119                                                                                * keep information when abort or
    120                                                                                * stop or requested or a FW reset
    121                                                                                * occurs
    122                                                                                */
    123     UINT16                  SPSScanResult;                                    /**<
    124                                                                                * Indicated which channels were
    125                                                                                * actually scanned (valid only
    126                                                                                * for SPS scan */
    127 
    128     /* state machines */
    129     fsm_stateMachine_t*     clientSM[ SCAN_SCC_NUM_OF_CLIENTS ];              /**<
    130                                                                                * state machines for different
    131                                                                                * scan types
    132                                                                                */
    133     UINT8                   clientSMState[ SCAN_SCC_NUM_OF_CLIENTS ];         /**<
    134                                                                                * state machine current states
    135                                                                                * for different scan types
    136                                                                                */
    137 
    138     /* Scan requests */
    139     scan_CncnClient_e       currentRunningScanClient;                         /**<
    140                                                                                * the current client for which
    141                                                                                * a scan is in progress
    142                                                                                */
    143     scan_Params_t           clientScanParams[ SCAN_SCC_NUM_OF_CLIENTS ];      /**<
    144                                                                                * scan parameters copy for
    145                                                                                * different clients
    146                                                                                */
    147     scan_Type_e             drvScanRequestType;                               /**<
    148                                                                                * the scan type requested by the
    149                                                                                * driver scan. Saved if a passive
    150                                                                                * scan is done before the requested
    151                                                                                * scan type
    152                                                                                */
    153     ssid_t                  drvScanSsid;                                      /**<
    154                                                                                * the desired SSID requested by the
    155                                                                                * driver scan. Saved to allow replacing
    156                                                                                * original with broadcast for passive
    157                                                                                * scan, to find country IE in any beacon
    158                                                                                */
    159     UINT32                  drvScanMinDwellTime[ SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND ];
    160                                                                               /**<
    161                                                                                * The min dwell time for all channels
    162                                                                                * requested by driver scan. Saved if a
    163                                                                                * passive scan is performed before the
    164                                                                                *requested scan type.
    165                                                                                */
    166     UINT32                  drvScanMaxDwellTime[ SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND ];
    167                                                                               /**<
    168                                                                                * The max dwell time for all channels
    169                                                                                * requested by driver scan. Saved if a
    170                                                                                * passive scan is performed before the
    171                                                                                *requested scan type.
    172                                                                                */
    173     BOOLEAN                 bAbortOrStop;                                     /**<
    174                                                                                * FLASE if the cancel reason is
    175                                                                                * abort (from SCR), TRUE if stop
    176                                                                                * (from requesting client)
    177                                                                                */
    178     BOOLEAN                 bInRequest;                                       /**<
    179                                                                                * Indicates whether the SM is run
    180                                                                                * within the scan request context
    181                                                                                * (if so, to avoid re-entrance,
    182                                                                                * the complete function shouldn't
    183                                                                                * be called on failure, but rather
    184                                                                                * an invalid status should be returned)
    185                                                                                */
    186     BOOLEAN					bUseSGParams;									  /**<
    187 																			   * Indicates whether to use the new params
    188 																			   * of the soft gemini module. This parameter
    189 																			   * is TRUE when SG is enabled and FALSE otherwise
    190 																			   */
    191 	UINT32					SGcompensationPercent;		 					  /**<
    192 																			   * the percentage of increasing the dwell time
    193 																			   * on each channel when SG is enabled (that is
    194 																			   * bUseSGParams == TRUE)
    195 																			   */
    196 	UINT32					SGcompensationMaxTime;							  /**<
    197 																			   * maximum time in microsecond from which we
    198 																			   * won't increase the dwelling time on the
    199 																			   * channel when SG is enabled
    200 																			   */
    201 	UINT8					SGnumOfProbeRequest;							  /**<
    202 																			   * number of Probes to send
    203 																			   * when SG is enabled
    204 																			   */
    205 
    206     /* connection status */
    207     connectionStatus_e      connectionStatus;   /**< the current connection status - connected / not connected / IBSS */
    208     scanConcentratorInitParams_t    initParams; /**<
    209                                                  * parameters read from the registry (min and max dwell time
    210                                                  * for driver passive scan
    211                                                  */
    212 /* OID scan SM */
    213 	fsm_stateMachine_t*		hOidSM;				/**< Handle to the OID scan SM - patch for WinCE support */
    214 	UINT8				    oidSMState;			/**< current state for the OID scan SM - patch for WinCE support */
    215 	scan_Params_t			oidScanParams;		/**< Storage spcae for OID scan parameters */
    216 	BOOLEAN					bOidScanRunning;	/**< Inidcates whether an OID scan is currently taking place */
    217 	UINT32					oidScanLastTimeStamp; /**< The last time at which an OID scan was performed */
    218 } scanConcentrator_t;
    219 
    220 /*
    221  ***********************************************************************
    222  *	External data definitions.
    223  ***********************************************************************
    224  */
    225 
    226 /*
    227  ***********************************************************************
    228  *	External functions definitions
    229  ***********************************************************************
    230  */
    231 
    232 /**
    233  * \author Ronen Kalish\n
    234  * \date 05-Jan-2005\n
    235  * \brief Frees the scan concentrator memory, according to the init vector.
    236  *
    237  * Function Scope \e Public.\n
    238  * \param hScanCncn - handle to the scan concentrator object.\n
    239  * \param initVec - a vector holding on bits for allocated components and off bits for non allocated components
    240  */
    241 void scanConcentrator_freeMem( TI_HANDLE hScanCncn, UINT16 initVec );
    242 
    243 /**
    244  * \author Ronen Kalish\n
    245  * \date 09-Jan-2005\n
    246  * \brief Verifies that specified channels are allowed for the specified scan type, and removes those that are not.\n
    247  *
    248  * Function Scope \e Private.\n
    249  * \param hScanCncn - handle to the scan concentrator object.\n
    250  * \param pScanParams - a pointer to the structure holding the scan params (inc. channels and scan type)
    251  */
    252 void scanConcentrator_verifyChannelsWithRegDomain( TI_HANDLE hScanCncn, scan_Params_t* pScanParams );
    253 
    254 /**
    255  * \author Ronen Kalish\n
    256  * \date 09-Jan-2005\n
    257  * \brief Verifies if a certain channel is allowed according to the given bitmap.\n
    258  *
    259  * Function Scope \e Private.\n
    260  * \param hScanCncn - handle to the scan concentrator object.\n
    261  * \param pScanParams - a pointer to the structure holding the scan params (inc. channels and scan type)
    262  * \return TRUE if the channel is allowed, FALSE otherwise.\n
    263  */
    264 BOOLEAN scanConcentrator_isChannelAllowed( UINT8 channel, UINT8* pChannelBitmap );
    265 
    266 /**
    267  * \author Ronen Kalish\n
    268  * \date 10-Jan-2005\n
    269  * \brief Extracts channel indexes from the bitmap to the list.
    270  *
    271  * Function Scope \e Private.\n
    272  * \param band - the band at which the scan is to be performed (to limit max channel number)
    273  * \param pChannelBitmap - the channel bitmap (input).\n
    274  * \param pChannelBitmap - the channel list (output).\n
    275  * \param pNumOfChannels - the number of channels (input - size of channel list, output - actual number of channels).\n
    276  */
    277 void scanConcentrator_ExtractBitmapToList( radioBand_e band, UINT8* pChannelBitmap,
    278                                            UINT8* pChannelList, UINT8* pNumOfChannels );
    279 
    280 #endif /* __SCANCNCN_H__ */
    281