summaryrefslogtreecommitdiff
path: root/wilink_6_1/TWD/TWDriver/TWDriverScan.h
blob: 2aa7a4b328e5ce1f17f5a20eee4712928306b226 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
/*
 * TWDriverScan.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 TWDRIVERSCAN_H
#define TWDRIVERSCAN_H

/** \file  TWDriverScan.h 
 *  \brief TWDriver Scan APIs
 *
 *  \see
 */

#include "tidef.h"
#include "TWDriverRate.h"
#include "public_commands.h"

/*****************************************************************************************
                          Scan Definitions
                          ---------------
This file is included by the TWDriver.h , it should not be included apart. !!!!!!!
*****************************************************************************************/


/*
 ***********************************************************************
 *  Constant definitions.
 ***********************************************************************
 */
#define MAX_NUMBER_OF_CHANNELS_PER_SCAN                     16
#define SCAN_MAX_NUM_OF_NORMAL_CHANNELS_PER_COMMAND         MAX_NUMBER_OF_CHANNELS_PER_SCAN
#define SCAN_MAX_NUM_OF_SPS_CHANNELS_PER_COMMAND            16
#define SCAN_DEFAULT_MIN_CHANNEL_DWELL_TIME                 30000
#define SCAN_DEFAULT_MAX_CHANNEL_DWELL_TIME                 60000
#define SCAN_DEFAULT_EARLY_TERMINATION_EVENT                SCAN_ET_COND_DISABLE
#define SCAN_DEFAULT_EARLY_TERMINATION_NUM_OF_FRAMES        0

#define PERIODIC_SCAN_MAX_SSID_NUM      					8
#define PERIODIC_SCAN_MAX_INTERVAL_NUM  					16
#define PERIODIC_SCAN_MAX_CHANNEL_NUM   					37 /* G-14 + A-23 */

#define MAX_SSID_LEN  										32

 /*
 ***********************************************************************
 *  Enums.
 ***********************************************************************
 */
/** \enum EScanType
 * \brief Scan Type
 *
 * \par Description
 * This Enumeration defines the available scan types.
 *
 * \sa TFileInfo
 */
typedef enum
{
/*	0	*/	SCAN_TYPE_NORMAL_PASSIVE = 0,   /**< Normal passive scan 	*/
/*	1	*/	SCAN_TYPE_NORMAL_ACTIVE,        /**< Normal active scan 	*/
/*	2	*/	SCAN_TYPE_SPS,                  /**< Scheduled Passive scan */
/*	3	*/	SCAN_TYPE_TRIGGERED_PASSIVE,    /**< Triggered Passive scan */
/*	4	*/	SCAN_TYPE_TRIGGERED_ACTIVE,     /**< Triggered Active scan 	*/
/*	5	*/	SCAN_TYPE_NO_SCAN,              /**< No Scan to perform 	*/
/*	6	*/	SCAN_TYPE_PACTSIVE              /**< Passive + Active Scan (used for DFS - driver internal use only!!!) */

} EScanType;

/** \enum EScanEtCondition
 * \brief Scan Early Termonation Condition
 *
 * \par Description
 * This Enumeration defines the different early termination causes.
 *
 * \sa TFileInfo
 */
typedef enum
{
    SCAN_ET_COND_DISABLE     = 0x00,        /**< No early termination is not disabled (Do not perform an early termination scan)*/
    SCAN_ET_COND_BEACON      = 0x10,        /**< Early termination scan on beacon reception 									*/
    SCAN_ET_COND_PROBE_RESP  = 0x20,        /**< Early termination scan on probe response reception 							*/
    SCAN_ET_COND_ANY_FRAME   = 0x30,        /**< Early termination scan on both beacon or probe response reception 				*/
    SCAN_ET_COND_NUM_OF_CONDS= 0x4          /**< Number of early termination conditions 										*/ 

} EScanEtCondition;

/** \enum EScanResultTag
 * \brief Scan Debug Tags
 * 
 * \par Description
 * Enumeration of the differnet Scan Result Tags possible
 * 
 * \sa	
 */
typedef enum
{
/*	0	*/	SCAN_RESULT_TAG_CURENT_BSS = 0,			/**< */
/*	1	*/	SCAN_RESULT_TAG_APPLICATION_ONE_SHOT,	/**< */
/*	2	*/	SCAN_RESULT_TAG_DRIVER_PERIODIC,		/**< */
/*	3	*/	SCAN_RESULT_TAG_APPLICATION_PEIODIC,	/**< */
/*	4	*/	SCAN_RESULT_TAG_MEASUREMENT,			/**< */
/*	5	*/	SCAN_RESULT_TAG_IMMEDIATE,				/**< */
/*	6	*/	SCAN_RESULT_TAG_CONTINUOUS,				/**< */
 /*	7	*/	SCAN_RESULT_TAG_MAX_NUMBER				/**< */

} EScanResultTag;

/** \enum ESsidVisability
 * \brief SSID Visablility Type
 * 
 * \par Description
 * 
 * \sa
 */
typedef enum
{
/*	0	*/	SCAN_SSID_VISABILITY_PUBLIC = 0,		/**< Visible	*/
/*	1	*/	SCAN_SSID_VISABILITY_HIDDEN				/**< Hidden		*/
} ESsidVisability;

/***********************************************************************
 *  Structure definitions.
 ***********************************************************************
 */
/** \struct TSsid
 * \brief SSID Parameters
 * 
 * \par Description
 * 
 * \sa
 */ 
typedef struct
{
    TI_UINT8    len;		  			/**< SSID Length		*/   		
    char        str[ MAX_SSID_LEN ];	/**< SSID string buffer	*/

}  TSsid;

/** \struct TScanNormalChannelEntry
 * \brief Scan Normal Channel Entry
 * 
 * \par Description
 * This structure defines single channel parameters for normal scan operation other than SPS (inc. triggered)
 * 
 * \sa
 */ 
typedef struct
{
    TMacAddr               bssId;                  	/**< BSSID (MAC address) to filter */
    TI_UINT32              maxChannelDwellTime;     /**< Maximum time to stay on the channel if some frames were 
													* received but the early termination limit has not been reached (microseconds) 
													*/
    TI_UINT32              minChannelDwellTime;     /**< Minimum time to stay on the channel if no frames were received (microseconds) */
    EScanEtCondition       earlyTerminationEvent;   /**< Early termination frame type */
    TI_UINT8               ETMaxNumOfAPframes;      /**< Number of frames from the early termination frame types according to the early 
													* Termination Event setting, after which scan is stopped on this channel	
													*/    
    TI_UINT8               txPowerDbm;              /**< Power level used to transmit (for active scan only) (0: no change; 1-5: predefined power level */
    TI_UINT8               channel;                 /**< Channel to scan */

} TScanNormalChannelEntry;

/** \struct TScanSpsChannelEntry
 * \brief Scan SPS Channel Entry
 * 
 * \par Description
 * This structure defines single channel parameters for an SPS scan operation
 * 
 * \sa
 */ 
typedef struct
{
    TMacAddr               bssId;               	/**< BSSID (source is MAC address) to filter */
    TI_UINT32              scanDuration;            /**< Length of time to start scanning the channel (TSF lower 4 bytes) */
    TI_UINT32              scanStartTime;           /**< Exact time to start scanning the channel (TSF lower 4 bytes) */
    EScanEtCondition       earlyTerminationEvent;   /**< Scan early termination frame type */
    TI_UINT8               ETMaxNumOfAPframes;      /**< Number of frames from the early termination frame types according to 
													* the early Termination Event setting, after which scan is stopped on this channel
													*/
    TI_UINT8               channel;                 /**< Channel to scan */

} TScanSpsChannelEntry;

/** \struct TScanChannelEntry
 * \brief Scan Channel Entry
 * 
 * \par Description
 * Holds single channel parameters single-channel parameters for all scan types,
 * either for normal scan or for SPS scan
 * 
 * \sa
 */ 
typedef union
{
    TScanNormalChannelEntry   normalChannelEntry;	/**< Normal scan parameters: channel parameters for all scan types other than SPS 	*/
    TScanSpsChannelEntry      SPSChannelEntry;      /**< SPS scan parameters: channel parameters for SPS type 	*/

} TScanChannelEntry;

/** \struct TScanParams
 * \brief scan operation parameters
 * 
 * \par Description
 * This structure defines parameters for a scan operation
 * 
 * \sa
 */ 
typedef struct
{
    TSsid                  desiredSsid;    		/**< The SSID to search (optional) 												*/
    EScanType              scanType;            /**< Desired scan type (normal - active or passive, SPS, triggered - active or passive)	*/
    ERadioBand             band;             	/**< Band to scan (A / BG) 														*/
    TI_UINT8               probeReqNumber;     	/**< Number of probe requests to send on each channel (for active scan) 		*/
    ERateMask              probeRequestRate;    /**< The rate at which to send the probe requests 								*/
    TI_UINT8               Tid;                 /**< Time at which to trigger the scan (for triggered scan)						*/
    TI_UINT64              latestTSFValue;      /**< For SPS scan: the latest TSF at which a frame was received. Used to detect 
												* TSF error (AP recovery). 
												*/
    TI_UINT32              SPSScanDuration;    	/**< For SPS scan ONLY: the time duration of the scan (in milliseconds), used to 
												* Set timer according to. Used to set scan-complete timer 
												*/
    TI_UINT8               numOfChannels;       /**< Number of channels to scan 														*/
    TScanChannelEntry      channelEntry[ MAX_NUMBER_OF_CHANNELS_PER_SCAN ];	/**< Channel data array, actual size according to the above field. */

} TScanParams;

/** \struct TPeriodicScanSsid
 * \brief Periodic Scan SSID
 * 
 * \par Description
 * This structure defines parameters for Periodic scan for SSID
 * 
 * \sa
 */ 
typedef struct
{
    ESsidVisability eVisability;	/**< Indicates if SSID Visible or not	*/	
    TSsid           tSsid;			/**< The Parameters of Scaned SSID 		*/
} TPeriodicScanSsid;

/** \struct TPeriodicChannelEntry
 * \brief Periodic Channel Entry
 * 
 * \par Description
 * This structure defines a Channel Entry of Periodic scan
 * (each scanned channel has its own Channel Entry)
 * 
 * \sa
 */
typedef struct
{
    ERadioBand      eBand;			  	/**< Channel's Radio Band									*/  	
    TI_UINT32       uChannel;			/**< Channel's Number										*/
    EScanType       eScanType;			/**< The Type of Scan Performed on the channel				*/
    TI_UINT32       uMinDwellTimeMs;	/**< minimum time to dwell on the channel, in microseconds	*/
    TI_UINT32       uMaxDwellTimeMs;	/**< maximum time to dwell on the channel, in microseconds	*/
    TI_UINT32       uTxPowerLevelDbm;	/**< Channel's Power Level In Dbm/10 units 		 			*/
} TPeriodicChannelEntry;

/** \struct TPeriodicScanParams
 * \brief Periodic Scan Parameters
 * 
 * \par Description
 * This structure defines all the parameters of Periodic scan
 * 
 * \sa
 */
typedef struct
{
    TI_UINT32               uSsidNum;												/**< Number of Desired SSID scanned			 					*/
    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 */