TWD/TWDriver/TWDriverScan.h
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * TWDriverScan.h
       
     3  *
       
     4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
       
     5  * All rights reserved.      
       
     6  * 
       
     7  * This program and the accompanying materials are made available under the 
       
     8  * terms of the Eclipse Public License v1.0 or BSD License which accompanies
       
     9  * this distribution. The Eclipse Public License is available at
       
    10  * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
       
    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 #ifndef TWDRIVERSCAN_H
       
    40 #define TWDRIVERSCAN_H
       
    41 
       
    42 /** \file  TWDriverScan.h 
       
    43  *  \brief TWDriver Scan APIs
       
    44  *
       
    45  *  \see
       
    46  */
       
    47 
       
    48 #include "tidef.h"
       
    49 #include "TWDriverRate.h"
       
    50 #include "public_commands.h"
       
    51 
       
    52 /*****************************************************************************************
       
    53                           Scan Definitions
       
    54                           ---------------
       
    55 This file is included by the TWDriver.h , it should not be included apart. !!!!!!!
       
    56 *****************************************************************************************/
       
    57 
       
    58 
       
    59 /*
       
    60  ***********************************************************************
       
    61  *  Constant definitions.
       
    62  ***********************************************************************
       
    63  */
       
    64 #define MAX_NUMBER_OF_CHANNELS_PER_SCAN                     16
       
    65 #define SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND         MAX_NUMBER_OF_CHANNELS_PER_SCAN
       
    66 #define SCAN_MAX_NUM_OF_SPS_CHANNELS_PER_COMMAND            16
       
    67 #define SCAN_DEFAULT_MIN_CHANNEL_DWELL_TIME                 30000
       
    68 #define SCAN_DEFAULT_MAX_CHANNEL_DWELL_TIME                 60000
       
    69 #define SCAN_DEFAULT_EARLY_TERMINATION_EVENT                SCAN_ET_COND_DISABLE
       
    70 #define SCAN_DEFAULT_EARLY_TERMINATION_NUM_OF_FRAMES        0
       
    71 
       
    72 #define PERIODIC_SCAN_MAX_SSID_NUM      					8
       
    73 #define PERIODIC_SCAN_MAX_INTERVAL_NUM  					16
       
    74 #define PERIODIC_SCAN_MAX_CHANNEL_NUM   					37 /* G-14 + A-23 */
       
    75 
       
    76 #define MAX_SSID_LEN  										32
       
    77 
       
    78  /*
       
    79  ***********************************************************************
       
    80  *  Enums.
       
    81  ***********************************************************************
       
    82  */
       
    83 /** \enum EScanType
       
    84  * \brief Scan Type
       
    85  *
       
    86  * \par Description
       
    87  * This Enumeration defines the available scan types.
       
    88  *
       
    89  * \sa TFileInfo
       
    90  */
       
    91 typedef enum
       
    92 {
       
    93 /*	0	*/	SCAN_TYPE_NORMAL_PASSIVE = 0,   /**< Normal passive scan 	*/
       
    94 /*	1	*/	SCAN_TYPE_NORMAL_ACTIVE,        /**< Normal active scan 	*/
       
    95 /*	2	*/	SCAN_TYPE_SPS,                  /**< Scheduled Passive scan */
       
    96 /*	3	*/	SCAN_TYPE_TRIGGERED_PASSIVE,    /**< Triggered Passive scan */
       
    97 /*	4	*/	SCAN_TYPE_TRIGGERED_ACTIVE,     /**< Triggered Active scan 	*/
       
    98 /*	5	*/	SCAN_TYPE_NO_SCAN,              /**< No Scan to perform 	*/
       
    99 /*	6	*/	SCAN_TYPE_PACTSIVE              /**< Passive + Active Scan (used for DFS - driver internal use only!!!) */
       
   100 
       
   101 } EScanType;
       
   102 
       
   103 /** \enum EScanEtCondition
       
   104  * \brief Scan Early Termonation Condition
       
   105  *
       
   106  * \par Description
       
   107  * This Enumeration defines the different early termination causes.
       
   108  *
       
   109  * \sa TFileInfo
       
   110  */
       
   111 typedef enum
       
   112 {
       
   113     SCAN_ET_COND_DISABLE     = 0x00,        /**< No early termination is not disabled (Do not perform an early termination scan)*/
       
   114     SCAN_ET_COND_BEACON      = 0x10,        /**< Early termination scan on beacon reception 									*/
       
   115     SCAN_ET_COND_PROBE_RESP  = 0x20,        /**< Early termination scan on probe response reception 							*/
       
   116     SCAN_ET_COND_ANY_FRAME   = 0x30,        /**< Early termination scan on both beacon or probe response reception 				*/
       
   117     SCAN_ET_COND_NUM_OF_CONDS= 0x4          /**< Number of early termination conditions 										*/ 
       
   118 
       
   119 } EScanEtCondition;
       
   120 
       
   121 /** \enum EScanResultTag
       
   122  * \brief Scan Debug Tags
       
   123  * 
       
   124  * \par Description
       
   125  * Enumeration of the differnet Scan Result Tags possible
       
   126  * 
       
   127  * \sa	
       
   128  */
       
   129 typedef enum
       
   130 {
       
   131 /*	0	*/	SCAN_RESULT_TAG_CURENT_BSS = 0,			/**< */
       
   132 /*	1	*/	SCAN_RESULT_TAG_APPLICATION_ONE_SHOT,	/**< */
       
   133 /*	2	*/	SCAN_RESULT_TAG_DRIVER_PERIODIC,		/**< */
       
   134 /*	3	*/	SCAN_RESULT_TAG_APPLICATION_PEIODIC,	/**< */
       
   135 /*	4	*/	SCAN_RESULT_TAG_MEASUREMENT,			/**< */
       
   136 /*	5	*/	SCAN_RESULT_TAG_IMMEDIATE,				/**< */
       
   137 /*	6	*/	SCAN_RESULT_TAG_CONTINUOUS,				/**< */
       
   138  /*	7	*/	SCAN_RESULT_TAG_MAX_NUMBER				/**< */
       
   139 
       
   140 } EScanResultTag;
       
   141 
       
   142 /** \enum ESsidVisability
       
   143  * \brief SSID Visablility Type
       
   144  * 
       
   145  * \par Description
       
   146  * 
       
   147  * \sa
       
   148  */
       
   149 typedef enum
       
   150 {
       
   151 /*	0	*/	SCAN_SSID_VISABILITY_PUBLIC = 0,		/**< Visible	*/
       
   152 /*	1	*/	SCAN_SSID_VISABILITY_HIDDEN				/**< Hidden		*/
       
   153 } ESsidVisability;
       
   154 
       
   155 /***********************************************************************
       
   156  *  Structure definitions.
       
   157  ***********************************************************************
       
   158  */
       
   159 /** \struct TSsid
       
   160  * \brief SSID Parameters
       
   161  * 
       
   162  * \par Description
       
   163  * 
       
   164  * \sa
       
   165  */ 
       
   166 typedef struct
       
   167 {
       
   168     TI_UINT8    len;		  			/**< SSID Length		*/   		
       
   169     char        str[ MAX_SSID_LEN ];	/**< SSID string buffer	*/
       
   170 
       
   171 }  TSsid;
       
   172 
       
   173 /** \struct TScanNormalChannelEntry
       
   174  * \brief Scan Normal Channel Entry
       
   175  * 
       
   176  * \par Description
       
   177  * This structure defines single channel parameters for normal scan operation other than SPS (inc. triggered)
       
   178  * 
       
   179  * \sa
       
   180  */ 
       
   181 typedef struct
       
   182 {
       
   183     TMacAddr               bssId;                  	/**< BSSID (MAC address) to filter */
       
   184     TI_UINT32              maxChannelDwellTime;     /**< Maximum time to stay on the channel if some frames were 
       
   185 													* received but the early termination limit has not been reached (microseconds) 
       
   186 													*/
       
   187     TI_UINT32              minChannelDwellTime;     /**< Minimum time to stay on the channel if no frames were received (microseconds) */
       
   188     EScanEtCondition       earlyTerminationEvent;   /**< Early termination frame type */
       
   189     TI_UINT8               ETMaxNumOfAPframes;      /**< Number of frames from the early termination frame types according to the early 
       
   190 													* Termination Event setting, after which scan is stopped on this channel	
       
   191 													*/    
       
   192     TI_UINT8               txPowerDbm;              /**< Power level used to transmit (for active scan only) (0: no change; 1-5: predefined power level */
       
   193     TI_UINT8               channel;                 /**< Channel to scan */
       
   194 
       
   195 } TScanNormalChannelEntry;
       
   196 
       
   197 /** \struct TScanSpsChannelEntry
       
   198  * \brief Scan SPS Channel Entry
       
   199  * 
       
   200  * \par Description
       
   201  * This structure defines single channel parameters for an SPS scan operation
       
   202  * 
       
   203  * \sa
       
   204  */ 
       
   205 typedef struct
       
   206 {
       
   207     TMacAddr               bssId;               	/**< BSSID (source is MAC address) to filter */
       
   208     TI_UINT32              scanDuration;            /**< Length of time to start scanning the channel (TSF lower 4 bytes) */
       
   209     TI_UINT32              scanStartTime;           /**< Exact time to start scanning the channel (TSF lower 4 bytes) */
       
   210     EScanEtCondition       earlyTerminationEvent;   /**< Scan early termination frame type */
       
   211     TI_UINT8               ETMaxNumOfAPframes;      /**< Number of frames from the early termination frame types according to 
       
   212 													* the early Termination Event setting, after which scan is stopped on this channel
       
   213 													*/
       
   214     TI_UINT8               channel;                 /**< Channel to scan */
       
   215 
       
   216 } TScanSpsChannelEntry;
       
   217 
       
   218 /** \struct TScanChannelEntry
       
   219  * \brief Scan Channel Entry
       
   220  * 
       
   221  * \par Description
       
   222  * Holds single channel parameters single-channel parameters for all scan types,
       
   223  * either for normal scan or for SPS scan
       
   224  * 
       
   225  * \sa
       
   226  */ 
       
   227 typedef union
       
   228 {
       
   229     TScanNormalChannelEntry   normalChannelEntry;	/**< Normal scan parameters: channel parameters for all scan types other than SPS 	*/
       
   230     TScanSpsChannelEntry      SPSChannelEntry;      /**< SPS scan parameters: channel parameters for SPS type 	*/
       
   231 
       
   232 } TScanChannelEntry;
       
   233 
       
   234 /** \struct TScanParams
       
   235  * \brief scan operation parameters
       
   236  * 
       
   237  * \par Description
       
   238  * This structure defines parameters for a scan operation
       
   239  * 
       
   240  * \sa
       
   241  */ 
       
   242 typedef struct
       
   243 {
       
   244     TSsid                  desiredSsid;    		/**< The SSID to search (optional) 												*/
       
   245     EScanType              scanType;            /**< Desired scan type (normal - active or passive, SPS, triggered - active or passive)	*/
       
   246     ERadioBand             band;             	/**< Band to scan (A / BG) 														*/
       
   247     TI_UINT8               probeReqNumber;     	/**< Number of probe requests to send on each channel (for active scan) 		*/
       
   248     ERateMask              probeRequestRate;    /**< The rate at which to send the probe requests 								*/
       
   249     TI_UINT8               Tid;                 /**< Time at which to trigger the scan (for triggered scan)						*/
       
   250     TI_UINT64              latestTSFValue;      /**< For SPS scan: the latest TSF at which a frame was received. Used to detect 
       
   251 												* TSF error (AP recovery). 
       
   252 												*/
       
   253     TI_UINT32              SPSScanDuration;    	/**< For SPS scan ONLY: the time duration of the scan (in milliseconds), used to 
       
   254 												* Set timer according to. Used to set scan-complete timer 
       
   255 												*/
       
   256     TI_UINT8               numOfChannels;       /**< Number of channels to scan 														*/
       
   257     TScanChannelEntry      channelEntry[ MAX_NUMBER_OF_CHANNELS_PER_SCAN ];	/**< Channel data array, actual size according to the above field. */
       
   258 
       
   259 } TScanParams;
       
   260 
       
   261 /** \struct TPeriodicScanSsid
       
   262  * \brief Periodic Scan SSID
       
   263  * 
       
   264  * \par Description
       
   265  * This structure defines parameters for Periodic scan for SSID
       
   266  * 
       
   267  * \sa
       
   268  */ 
       
   269 typedef struct
       
   270 {
       
   271     ESsidVisability eVisability;	/**< Indicates if SSID Visible or not	*/	
       
   272     TSsid           tSsid;			/**< The Parameters of Scaned SSID 		*/
       
   273 } TPeriodicScanSsid;
       
   274 
       
   275 /** \struct TPeriodicChannelEntry
       
   276  * \brief Periodic Channel Entry
       
   277  * 
       
   278  * \par Description
       
   279  * This structure defines a Channel Entry of Periodic scan
       
   280  * (each scanned channel has its own Channel Entry)
       
   281  * 
       
   282  * \sa
       
   283  */
       
   284 typedef struct
       
   285 {
       
   286     ERadioBand      eBand;			  	/**< Channel's Radio Band									*/  	
       
   287     TI_UINT32       uChannel;			/**< Channel's Number										*/
       
   288     EScanType       eScanType;			/**< The Type of Scan Performed on the channel				*/
       
   289     TI_UINT32       uMinDwellTimeMs;	/**< minimum time to dwell on the channel, in microseconds	*/
       
   290     TI_UINT32       uMaxDwellTimeMs;	/**< maximum time to dwell on the channel, in microseconds	*/
       
   291     TI_UINT32       uTxPowerLevelDbm;	/**< Channel's Power Level In Dbm/10 units 		 			*/
       
   292 } TPeriodicChannelEntry;
       
   293 
       
   294 /** \struct TPeriodicScanParams
       
   295  * \brief Periodic Scan Parameters
       
   296  * 
       
   297  * \par Description
       
   298  * This structure defines all the parameters of Periodic scan
       
   299  * 
       
   300  * \sa
       
   301  */
       
   302 typedef struct
       
   303 {
       
   304     TI_UINT32               uSsidNum;												/**< Number of Desired SSID scanned			 					*/
       
   305     TPeriodicScanSsid       tDesiredSsid[ PERIODIC_SCAN_MAX_SSID_NUM ];				/**< Buffer of size of maximum possible Periodic Scanned SSIDs. 
       
   306 																					* This buffer holds the Parameters of Desired SSIDs (for each SSID: 
       
   307 																					* visibility, length, string buffer) --> number of init entries in 
       
   308 																					* buffer: uSsidNum	
       
   309 																					*/
       
   310     TI_UINT32               uCycleNum;												/**< number of Scan cycles to run 						   		*/ 								
       
   311     TI_UINT32               uCycleIntervalMsec[ PERIODIC_SCAN_MAX_INTERVAL_NUM ];	/**< Intervals (in Msec) between two sequential  scan cycle    	*/
       
   312     TI_INT8                 iRssiThreshold;											/**< RSSI threshold 											*/
       
   313     TI_INT8                 iSnrThreshold;											/**< SNR threshold	 											*/
       
   314     TI_UINT32               uFrameCountReportThreshold;								/**< Report after N results are received 						*/
       
   315     TI_BOOL                 bTerminateOnReport;										/**< Indicates if to Terminate after report 					*/
       
   316     ScanBssType_e           eBssType;												/**< Scan BSS Type												*/
       
   317     TI_UINT32               uProbeRequestNum;										/**< Number of probe requests to transmit per SSID				*/
       
   318     TI_UINT32               uChannelNum;											/**< Number of Scaned Channels									*/
       
   319     TPeriodicChannelEntry   tChannels[ PERIODIC_SCAN_MAX_CHANNEL_NUM ];				/**< Buffer of size of maximum possible Periodic Scanned Channels. 
       
   320 																					* This buffer holds the Parameters of each Scanned Channel	
       
   321 																					*/
       
   322 } TPeriodicScanParams;
       
   323 
       
   324 #endif /* TWDRIVERSCAN_H */
       
   325 
       
   326 
       
   327 
       
   328 
       
   329