2 * \brief This file include private definitions for the scan SRV module.
6 /****************************************************************************
7 **+-----------------------------------------------------------------------+**
9 **| Copyright(c) 1998 - 2008 Texas Instruments. All rights reserved. |**
10 **| All rights reserved. |**
12 **| Redistribution and use in source and binary forms, with or without |**
13 **| modification, are permitted provided that the following conditions |**
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 |**
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. |**
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. |**
38 **+-----------------------------------------------------------------------+**
39 ****************************************************************************/
44 #include "MacServices_api.h"
46 #include "whalCtrl_api.h"
47 #include "ScanSrvSM.h"
50 ***********************************************************************
51 * Constant definitions.
52 ***********************************************************************
54 /* guard time for scan (added to calculated scan duration) */
55 #define SCAN_SRV_FW_GUARD_TIME_MS 62000
56 /* module name for driver mode requests */
57 #define SCAN_SRV_NAME "SSRV"
61 ***********************************************************************
63 ***********************************************************************
68 ***********************************************************************
70 ***********************************************************************
74 ***********************************************************************
75 * Structure definitions.
76 ***********************************************************************
80 * \brief This structure contains the scan SRV object data
84 TI_HANDLE hOS; /**< OS object handle */
85 TI_HANDLE hReport; /**< report object handle */
86 TI_HANDLE hPowerSrv; /**< power Server object handle */
87 TI_HANDLE hHalCtrl; /**< HAL ctrl object handle */
88 scan_srvCompleteCB_t scanCompleteNotificationFunc; /**<
89 * upper layer (scan concentrator) scan complete
92 TI_HANDLE scanCompleteNotificationObj; /**<
93 * upper layer (scan concentrator) scan complete
97 CmdResponseCB_t commandResponseFunc; /**<
98 * upper layer command response CB. Passed down into the HAL
99 * and called when the scan command has been received by the FW
101 TI_HANDLE commandResponseObj; /**<
102 * object parameter passed to the commandResposeFunc by the HAL
105 failureEventCB_t failureEventFunc; /**<
106 * upper layer Failure Event CB.
107 * called when the scan command has been Timer Expiry
109 TI_HANDLE failureEventObj; /**<
110 * object parameter passed to the failureEventFunc
113 UINT16 SPSScanResult; /**<
114 * bitmap indicating which channels were scanned
117 BOOLEAN bTSFError; /** indicates whether a TSF error occured */ /**<
118 * scan result: indicates a TSF error event and
119 * which channels were scanned in SPS
121 BOOLEAN bDtimOverlapping; /**< Indicates whether the scan is overlapping DTIM */
122 BOOLEAN bExitFromDriverMode; /**<
123 * Indicates whether to exit driver mode once scan
126 BOOLEAN bSendNullData; /**<
127 * Indicates whether to send Null data when exiting driver
128 * mode once scan is finished
130 BOOLEAN bScanOnDriverModeFailure; /**<
131 * Indicates whether to scan if driver mode entry
134 BOOLEAN bHighPriority; /**<
135 * Indicates whether to request high priority
136 * (overlapping DTIM) scan
138 BOOLEAN bSPSScan; /**<
139 * whether the running scan type is SPS (TRUE)
140 * or something else (FALSE). Used to stop a
143 scan_Params_t* scanParams; /**< scan parameters */
144 TI_HANDLE timer; /**< scan operation timer */
145 BOOLEAN bTimerRunning; /**< whether the above timer is running */
146 BOOLEAN bInRequest; /**<
147 * Indicates whether the SM is run within
148 * the scan request context (if so, to avoid
149 * re-entrance, the complete function shouldn't
150 * be called on failure, but rather an invalid
151 * status should be returned)
153 TI_STATUS returnStatus; /**<
154 * Holds the return code to the upper layer
155 * Used to save errors during SM operation.
158 fsm_stateMachine_t* SM; /**<
159 * state machines for different
162 scan_SRVSMStates_e SMState; /**<
163 * state machine current states
164 * for different scan types
166 PowerMgr_802_11_PsMode_e psRequest; /**<
167 * Indicates if PS was requested or not
170 UINT32 numberOfNoScanCompleteToRecovery;
172 * The number of consecutive no scan complete
173 * that will trigger a recovery notification
175 UINT32 currentNumberOfConsecutiveNoScanCompleteEvents;
177 * The number of consecutivre no scan complete
180 BOOLEAN bNoScanCompleteFlag; /**<
181 * Indicates if the last event was start scan
182 * (true) or no scan complete (false) to be able
183 * to nullify correctly the above counter */
184 UINT32 uTriggeredScanTimeOut; /**<
185 * Time out for starting triggered scan between
190 ***********************************************************************
191 * External data definitions.
192 ***********************************************************************
196 ***********************************************************************
197 * External functions definitions
198 ***********************************************************************
202 * \author Yuval Adler\n
203 * \date 16-Oct-2004\n
204 * \brief Creates the scan SRV object
206 * Function Scope \e Public.\n
207 * \param hOS - handle to the OS object.\n
208 * \return a handle to the scan SRV object, NULL if an error occurred.\n
210 TI_HANDLE MacServices_scanSRV_create( TI_HANDLE hOS );
213 * \author Yuval Adler\n
214 * \date 29-Dec-2004\n
215 * \brief Finalizes the scan SRV module (releasing memory and timer)
217 * Function Scope \e Public.\n
218 * \param hScanSRV - handle to the scan SRV object.\n
220 void MacServices_scanSRV_destroy( TI_HANDLE hScanSRV );
223 * \author Yuval Adler\n
224 * \date 29-Dec-2004\n
225 * \brief Initializes the scan SRV module, registers SCAN_COMPLETE to HAL.
227 * Function Scope \e Public.\n
228 * \param hScanSRV - handle to the scan SRV object.\n
229 * \param hReport - handle to the report object.\n
230 * \param hPowerMngr - handle to the power manager object.\n
231 * \param hHalCtrl - handle to the HAL ctrl object.\n
233 void MacServices_scanSRV_init( TI_HANDLE hMacServices, TI_HANDLE hReport, TI_HANDLE hHalCtrl);
236 * \author Ronen Kalish\n
237 * \date 26-July-2006\n
238 * \brief Configures the scan SRV module with initialization values
240 * Function Scope \e Public.\n
241 * \param hScanSRV - handle to the scan SRV object.\n
242 * \param hReport - handle to the report object.\n
243 * \param hHalCtrl - handle to the HAL ctrl object.\n
245 void MacServices_scanSrv_config( TI_HANDLE hMacServices, scanSrvInitParams_t* pInitParams );
248 * \author Ronen Kalish\n
249 * \date 29-Dec-2004\n
250 * \brief Calculates the maximal time required for a scan operation
252 * Function Scope \e Public.\n
253 * \param hScanSRV - handle to the scan SRV object.\n
254 * \param scanParams - the scan parameters
255 * \param bConsiderDTIM - whether this scan overlaps DTIM
256 * \return the time (in milliseconds)
258 UINT32 MacServices_scanSRVcalculateScanTimeout( TI_HANDLE hScanSrv, scan_Params_t* scanParams, BOOLEAN bConsiderDTIM );
261 * \author Ronen Kalish\n
262 * \date 16-Jan-2005\n
263 * \brief Convert time units (1024 usecs) to millisecs
265 * Function Scope \e Private.\n
266 * \param tu - the time in time units
267 * \return the time in milliseconds
269 UINT32 MacServices_scanSRVConvertTUToMsec( UINT32 tu );
272 * \author Yuval Adler\n
273 * \date 27-Sep-2005\n
274 * \brief This function is the CB which is called as response to 'StartScan' or 'StopScan' \n.
275 * here we check if there is a GWSI command response , and call it if necessary .\n
276 * Function Scope \e Private.\n
277 * \param hScanSrv - handle to the scan SRV object.\n
278 * \param MboxStatus - mailbox status. \n
281 void MacServices_scanSRVCommandMailBoxCB(TI_HANDLE hScanSrv,UINT16 MboxStatus);
285 * \brief Registers a failure event callback for scan error notifications.
287 * Function Scope \e Public.\n
288 * \param hMacServices - handle to the MacServices object.\n
289 * \param failureEventCB - the failure event callback function.\n
290 * \param hFailureEventObj - handle to the object passed to the failure event callback function.\n
292 void scanSRV_registerFailureEventCB( TI_HANDLE hScanSRV,
293 void * failureEventCB, TI_HANDLE hFailureEventObj );
295 void scanSRV_restart( TI_HANDLE hScanSRV);
297 #endif /* __SCANSRV_H__ */