• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * MacServices_api.h
3  *
4  * Copyright(c) 1998 - 2009 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 MacServicesApi.h
35  *  \brief This file include public definitions for the MacServices module, comprising its API.
36  *  \author Yuval Adler
37  *  \date 6-Oct-2005
38  */
39 
40 #ifndef __MACSERVICESAPI_H__
41 #define __MACSERVICESAPI_H__
42 
43 #include "osApi.h"
44 
45 /*
46  ***********************************************************************
47  *	Constant definitions.
48  ***********************************************************************
49  */
50 
51 /*
52  ***********************************************************************
53  *	Enums.
54  ***********************************************************************
55  */
56 
57 /*
58  ***********************************************************************
59  *	Typedefs.
60  ***********************************************************************
61  */
62 
63 
64 
65 /*
66  ***********************************************************************
67  *	Structure definitions.
68  ***********************************************************************
69  */
70 
71 /*
72  ***********************************************************************
73  *	External data definitions.
74  ***********************************************************************
75  */
76 
77 /*
78  ***********************************************************************
79  *	External functions definitions
80  ***********************************************************************
81  */
82 /**
83  * \author Yuval Adler\n
84  * \date 6-Oct-2004\n
85  * \brief Creates MacServices module
86  *
87  * Function Scope \e Public.\n
88  * \param hOS - handle to the OS object.\n
89  */
90 TI_HANDLE MacServices_create( TI_HANDLE hOS );
91 
92 /**
93  * \author Yuval Adler\n
94  * \date 6-Oct-2004\n
95  * \brief Destroys MacServices module
96  *
97  * Function Scope \e Public.\n
98  * \param hMacServices - handle to the MacServices object.\n
99  */
100 void MacServices_destroy( TI_HANDLE hMacServices );
101 
102 /**
103  * \author Yuval Adler\n
104  * \date  6-Oct-2004\n
105  * \brief Initializes the MacServices module
106  *
107  * Function Scope \e Public.\n
108  * \param hMacServices - handle to the Mac Services object.\n
109  * \param hReport - handle to the report object.\n
110  * \param hTWD - handle to the HAL ctrl object.\n
111  * \param hCmdBld - handle to the HAL ctrl object.\n
112  * \param hEventMbpx - handle to the HAL ctrl object.\n
113  */
114 void MacServices_init (TI_HANDLE hMacServices,
115                        TI_HANDLE hReport,
116                        TI_HANDLE hTWD,
117                        TI_HANDLE hCmdBld,
118                        TI_HANDLE hEventMbox,
119                        TI_HANDLE hTimer);
120 void MacServices_config (TI_HANDLE hMacServices, TTwdInitParams *pInitParams);
121 void MacServices_restart (TI_HANDLE hMacServices);
122 
123 void MacServices_registerFailureEventCB (TI_HANDLE hMacServices, void * failureEventCB, TI_HANDLE hFailureEventObj);
124 
125 
126 /***********************************************************************
127  *	Scan SRV API functions
128  ***********************************************************************/
129 
130 
131 /**
132  * \author Ronen Kalish\n
133  * \date 29-Dec-2004\n
134  * \brief Registers a complete callback for scan complete notifications.
135  *
136  * Function Scope \e Public.\n
137  * \param hMacServices - handle to the MacServices object.\n
138  * \param scanCompleteCB - the complete callback function.\n
139  * \param hScanCompleteObj - handle to the object passed to the scan complete callback function.\n
140  */
141 void MacServices_scanSRV_registerScanCompleteCB( TI_HANDLE hMacServices,
142                                      TScanSrvCompleteCb scanCompleteCB, TI_HANDLE hScanCompleteObj );
143 
144 
145 
146 /**
147  * \author Ronen Kalish\n
148  * \date 29-Dec-2004\n
149  * \brief Performs a scan
150  *
151  * Function Scope \e Public.\n
152  * \param hMacServices - handle to the MacServices object.\n
153  * \param scanParams - the scan specific parameters.\n
154  * \param eScanTag - tag used for result and scan complete tracking
155  * \param bHighPriority - whether to perform a high priority (overlaps DTIM) scan.\n
156  * \param bDriverMode - whether to try to enter driver mode (with PS on) before issuing the scan command.\n
157  * \param bScanOnDriverModeError - whether to proceed with the scan if requested to enter driver mode and failed.\n
158  * \param bSendNullData - whether to send Null data when exiting driver mode on scan complete.\n
159  * \param psRequest - Parameter sent to PowerSaveServer on PS request to indicate PS on or "keep current"
160  * \param commandResponseFunc - CB function which called after downloading the command. \n
161  * \param commandResponseObj -  The CB function Obj (Notice : last 2 params are NULL in Legacy run). \n
162   * \return TI_OK if successful (various, TBD codes if not).\n
163  */
164 TI_STATUS MacServices_scanSRV_scan( TI_HANDLE hMacServices, TScanParams *scanParams, EScanResultTag eScanTag,
165                                     TI_BOOL bHighPriority, TI_BOOL bDriverMode, TI_BOOL bScanOnDriverModeError,
166 						E80211PsMode psRequest, TI_BOOL bSendNullData,
167 						TCmdResponseCb commandResponseFunc, TI_HANDLE commandResponseObj );
168 
169 /**
170  * \author Ronen Kalish\n
171  * \date 29-Dec-2004\n
172  * \brief Stops a scan in progress
173  *
174  * Function Scope \e Public.\n
175  * \param hMacServices - handle to the MacServices object.\n
176  * \param eScanTag - scan tag, used for scan complete and result tracking
177  * \param bSendNullData - indicates whether to send Null data when exiting driver mode.\n
178  * \param commandResponseFunc - CB function which called after downloading the command. \n
179  * \param commandResponseObj -  The CB function Obj (Notice : last 2 params are NULL in Legacy run). \n
180  * \return TI_OK if successful (various, TBD codes if not).\n
181  */
182 TI_STATUS MacServices_scanSRV_stopScan( TI_HANDLE hMacServices, EScanResultTag eScanTag, TI_BOOL bSendNullData,
183                                         TCmdResponseCb commandResponseFunc, TI_HANDLE commandResponseObj );
184 
185 /**
186  * \author Ronen Kalish\n
187  * \date 17-Jan-2005\n
188  * \brief Notifies the scan SRV of a FW reset (that had originally been reported by a different module).\n
189  *
190  * Function Scope \e Public.\n
191  * \param hMacServices - handle to the MacServices object.\n
192  * \return TI_OK if successful (various, TBD codes if not).\n
193  */
194 TI_STATUS MacServices_scanSRV_stopOnFWReset( TI_HANDLE hMacServices );
195 
196 /**
197  * \author Ronen Kalish\n
198  * \date 29-Dec-2004\n
199  * \brief callback function used by the power manager to notify driver mode result
200  *
201  * Function Scope \e Public.\n
202  * \param hScanSRV - handle to the scan SRV object.\n
203  * \param psStatus - the power save request status.\n
204  */
205 void MacServices_scanSRV_powerSaveCB( TI_HANDLE hScanSRV, TI_UINT8 PSMode,TI_UINT8 psStatus );
206 
207 /**
208  * \author Ronen Kalish\n
209  * \date 29-Dec-2004\n
210  * \brief Callback function used by the HAL ctrl to notify scan complete
211  *
212  * Function Scope \e Public.\n
213  * \param hScanSRV - handle to the scan SRV object.\n
214  * \param str - pointer to scan result buffer (holding SPS status for SPS scan only!).\n
215  * \param strLen - scan result buffer length (should ALWAYS be 2, even for non SPS scans).\n
216  */
217 void MacServices_scanSRV_scanCompleteCB( TI_HANDLE hScanSRV, char* str, TI_UINT32 strLen );
218 
219 /**
220  * \author Ronen Kalish\n
221  * \date 29-Dec-2004\n
222  * \brief called when a scan timer expires. Completes the scan and starts a recovery process.
223  *
224  * Function Scope \e Public.\n
225  * \param hScanSRV - handle to the scan SRV object.\n
226  */
227 void MacServices_scanSRV_scanTimerExpired (TI_HANDLE hScanSRV, TI_BOOL bTwdInitOccured);
228 
229 void MacServices_scanSrv_UpdateDtimTbtt (TI_HANDLE hMacServices,
230                                          TI_UINT8  uDtimPeriod,
231                                          TI_UINT16 uBeaconInterval);
232 
233 #ifdef TI_DBG
234 /**
235  * \author Shirit Brook\n
236  * \date God knows when...\n
237  * \brief Prints Scan Server SM status.\n
238  *
239  * Function Scope \e Public.\n
240  * \param hMacServices - handle to the Mac Services object.\n
241  */
242 void MacServices_scanSrv_printDebugStatus(TI_HANDLE hMacServices);
243 #endif
244 
245 /*Power server API*/
246 
247 
248 /**
249   * \author Assaf Azulay
250  * \date 24-Oct-2005\n
251  * \brief request PS by User
252  *
253  * Function Scope \e Public.\n
254  * Parameters:\n
255  * 1) hPowerSrv 						- handle to the PowerSrv object.\n
256  * 2) psMode							- Power save/Active request.\n
257  * 3) sendNullDataOnExit				- \n
258  * 4) powerSaveCompleteCBObject		- handle to the Callback functin module.\n
259  * 5) powerSaveCompleteCB				- Calback function - for success/faild notification.\n
260  * 6) powerSavecmdResponseCB			- Calback function - for GWSI success/faild notification.\n
261  * Return Value: TI_STATUS - TI_OK / PENDING / TI_NOK.\n
262  * \b Description:\n
263  * This function is a user mode request from the Power Save Server./n
264  * it will create a Request from typ "USER_REQUEST" and will try to perform the user request for PS/Active./n
265  * this will be done in respect of priority to Driver request./n
266  */
267 TI_STATUS MacServices_powerSrv_SetPsMode(TI_HANDLE 	                hMacServices,
268                                 		 E80211PsMode	            psMode,
269  									     TI_BOOL  						sendNullDataOnExit,
270  						        		 void * 					powerSaveCompleteCBObject,
271  						        		 TPowerSaveCompleteCb  		powerSaveCompleteCB,
272  						        		 TPowerSaveResponseCb	    powerSavecmdResponseCB);
273 
274 
275 /**
276   * \author Assaf Azulay
277  * \date 24-Oct-2005\n
278  * \brief SW configure, use to override the current PowerMode (what ever it will be) to
279  *        active/PS combined with awake/power-down. use for temporary change the system policy.
280  *
281  * Function Scope \e Public.\n
282  * Parameters:\n
283  * 1) TI_HANDLE - handle to the powerSrv object.\n
284  * 2) powerSrv_RequestFor_802_11_PS_e - the driver mode obliged to be in 802.11 PS or not change.\n
285  * 3) PowerCtrl_PowerLevel_e - the desired driver power level (allowed: AWAKE or POWER DOWN).\n
286  * 4) TI_HANDLE theObjectHandle - the handle the object that need the PS success/fail notification.\n
287  * 5) ps802_11_NotificationCB_t - the callback function.\n
288  * 6) char* - the clinet name that ask for driver mode.\n
289  * Return Value: TI_STATUS - if success (already in power save) then TI_OK,\n
290  *                           if pend (wait to ACK form AP for the null data frame) then PENDING\n
291  *                           if PS isn't enabled then POWER_SAVE_802_11_NOT_ALLOWED\n
292  *                           else TI_NOK.\n
293  * \b Description:\n
294  * enter in to configuration of the driver that in higher priority from the user.\n
295  * the configuration is:\n
296  *  - to enter to802.11 PS or not (if not this isn't a request to get out from 802.11 PS).\n
297  *  - to change the HW power level to awake or power-down if not already there.
298  *    this is a must request.\n
299 */
300 TI_STATUS MacServices_powerSrv_ReservePS(	TI_HANDLE 	                hMacServices,
301                                             E80211PsMode 	            psMode,
302                                             TI_BOOL  						sendNullDataOnExit,
303                                             void * 						powerSaveCBObject,
304                                             TPowerSaveCompleteCb 		powerSaveCompleteCB);
305 
306 
307 /**
308  * \author Assaf Azulay
309  * \date 24-Oct-2005\n
310  * \brief end the temporary change of system policy, and returns to the user system policy.
311  *
312  * Function Scope \e Public.\n
313  * Parameters:\n
314  * 1) TI_HANDLE - handle to the powerSrv object.\n
315  * 2) char* - the clinet name that ask for driver mode.\n
316  * Return Value: TI_STATUS - TI_OK on success else TI_NOK.\n
317  * \b Description:\n
318  * enter in to configuration of the driver that in higher priority from the user.\n
319  * the configuration is:\n
320  * end the user mode configuration (driver mode priority) and returns the user configuration
321  * (user mode priority).
322 */
323 TI_STATUS MacServices_powerSrv_ReleasePS( 	TI_HANDLE 	hMacServices,
324 									TI_BOOL  						sendNullDataOnExit,
325  						 			void *  						powerSaveCBObject,
326  									TPowerSaveCompleteCb  			powerSaveCompleteCB);
327 
328 
329 /**
330  * \author Assaf Azulay
331  * \date 24-Oct-2005\n
332  * \brief reflects the actual state of the state machine
333  *
334  * Function Scope \e Public.\n
335  * Parameters:\n
336  * 1) TI_HANDLE - handle to the powerSrv object.\n
337  * Return Value:\n
338  * TI_BOOL - thre is in PS false otherwise.\n
339 */
340 TI_BOOL MacServices_powerSrv_getPsStatus(TI_HANDLE hMacServices);
341 
342 
343 /**
344  * \author Assaf Azulay
345  * \date 24-Oct-2005\n
346  * \sets the rate as got from user else sets default value.\n
347  *
348  * Function Scope \e Public.\n
349  * Parameters:\n
350  * 1) TI_HANDLE 	- handle to the powerSrv object.\n
351  * 2) TI_UINT16		- desierd rate .\n
352  * Return Value:\n
353  * void.\n
354 */
355 void MacServices_powerSrv_SetRateModulation(TI_HANDLE hMacServices, TI_UINT16  rate);
356 /**
357  * \Return the alrweady seted rate.\n
358  *
359  * Function Scope \e Public.\n
360  * Parameters:\n
361  * TI_HANDLE 	- handle to the powerSrv object.\n
362  * Return Value: TI_UINT16		- desierd rate .\n
363  * void.\n
364 */
365 TI_UINT32 MacServices_powerSrv_GetRateModulation(TI_HANDLE hMacServices);
366 
367 
368 
369 
370 /***********************************************************************
371  *	Measurement SRV API functions
372  ***********************************************************************/
373 
374 /**
375  * \author Ronen Kalish\n
376  * \date 09-November-2005\n
377  * \brief Starts a measurement operation.\n
378  *
379  * Function Scope \e Public.\n
380  * \param hMacServices - handle to the MacServices object.\n
381  * \param pMsrRequest - a structure containing measurement parameters.\n
382  * \param timeToRequestExpiryMs - the time (in milliseconds) the measurement SRV has to start the request.\n
383  * \param cmdResponseCBFunc - callback function to used for command response.\n
384  * \param cmdResponseCBObj - handle to pass to command response CB.\n
385  * \param cmdCompleteCBFunc - callback function to be used for command complete.\n
386  * \param cmdCompleteCBObj - handle to pass to command complete CB.\n
387  * \return TI_OK if successful (various, TBD codes if not).\n
388  */
389 TI_STATUS MacServices_measurementSRV_startMeasurement( TI_HANDLE hMacServices,
390                                                        TMeasurementRequest* pMsrRequest,
391 													   TI_UINT32 timeToRequestExpiryMs,
392                                                        TCmdResponseCb cmdResponseCBFunc,
393                                                        TI_HANDLE cmdResponseCBObj,
394                                                        TMeasurementSrvCompleteCb cmdCompleteCBFunc,
395                                                        TI_HANDLE cmdCompleteCBObj );
396 
397 /**
398  * \author Ronen Kalish\n
399  * \date 09-November-2005\n
400  * \brief Stops a measurement operation in progress.\n
401  *
402  * Function Scope \e Public.\n
403  * \param hMacServices - handle to the MacServices object.\n
404  * \param bSendNullData - whether to send NULL data when exiting driver mode.\n
405  * \param cmdResponseCBFunc - callback function to used for command response.\n
406  * \param cmdResponseCBObj - handle to pass to command response CB.\n
407  * \return TI_OK if successful (various, TBD codes if not).\n
408  */
409 TI_STATUS MacServices_measurementSRV_stopMeasurement( TI_HANDLE hMacServices,
410 													  TI_BOOL bSendNullData,
411                                                       TCmdResponseCb cmdResponseCBFunc,
412                                                       TI_HANDLE cmdResponseCBObj );
413 
414 /**
415  * \author Ronen Kalish\n
416  * \date 09-November-2005\n
417  * \brief Notifies the measurement SRV of a FW reset (recovery).\n
418  *
419  * Function Scope \e Public.\n
420  * \param hMacServices - handle to the MacServices object.\n
421  */
422 void MacServices_measurementSRV_FWReset( TI_HANDLE hMacServices );
423 
424 /**
425  * \author Ronen Kalish\n
426  * \date 09-November-2005\n
427  * \brief callback function used by the power manager to notify driver mode result
428  *
429  * Function Scope \e Public.\n
430  * \param hMeasurementSRV - handle to the measurement SRV object.\n
431  * \param PSMode - the power save mode the STA is currently in.\n
432  * \param psStatus - the power save request status.\n
433  */
434 void MacServices_measurementSRV_powerSaveCB( TI_HANDLE hMeasurementSRV, TI_UINT8 PSMode,TI_UINT8 psStatus );
435 
436 /**
437  * \author Ronen Kalish\n
438  * \date 14-November-2005\n
439  * \brief callback function used by the HAL for measure start event (sent when the FW
440  * has started measurement operation, i.e. switched channel and changed RX filters).\n
441  *
442  * Function Scope \e Public.\n
443  * \param hMeasurementSRV - handle to the measurement SRV object.\n
444  */
445 void MacServices_measurementSRV_measureStartCB( TI_HANDLE hMeasurementSRV );
446 
447 /**
448  * \author Ronen Kalish\n
449  * \date 14-November-2005\n
450  * \brief callback function used by the HAL for measure stop event (sent when the FW
451  * has finished measurement operation, i.e. switched channel to serving channel and changed back RX filters).\n
452  *
453  * Function Scope \e Public.\n
454  * \param hMeasurementSRV - handle to the measurement SRV object.\n
455  */
456 void MacServices_measurementSRV_measureCompleteCB( TI_HANDLE hMeasurementSRV );
457 
458 /**
459  * \author Ronen Kalish\n
460  * \date 14-November-2005\n
461  * \brief callback function used by the HAL for AP discovery stop event (sent when the FW
462  * has finished AP discovery operation).\n
463  *
464  * Function Scope \e Public.\n
465  * \param hMeasurementSRV - handle to the measurement SRV object.\n
466  */
467 void MacServices_measurementSRV_apDiscoveryCompleteCB( TI_HANDLE hMeasurementSRV );
468 
469 /**
470  * \author Ronen Kalish\n
471  * \date 16-November-2005\n
472  * \brief Callback for channel load get param call.\n
473  *
474  * Function Scope \e Public.\n
475  * \param hMeasurementSRV - handle to the measurement SRV object.\n
476  * \param status - the get_param call status.\n
477  * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
478  */
479 void MacServices_measurementSRV_channelLoadParamCB( TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf );
480 
481 /**
482  * \date 03-January-2005\n
483  * \brief Dummy callback for channel load get param call. Used to clear the channel load tracker.\n
484  *
485  * Function Scope \e Public.\n
486  * \param hMeasurementSRV - handle to the measurement SRV object.\n
487  * \param status - the get_param call status.\n
488  * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
489  */
490 void MacServices_measurementSRV_dummyChannelLoadParamCB( TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf );
491 
492 /**
493  * \author Ronen Kalish\n
494  * \date 16-November-2005\n
495  * \brief Callback for noise histogram get param call.\n
496  *
497  * Function Scope \e Public.\n
498  * \param hMeasurementSRV - handle to the measurement SRV object.\n
499  * \param status - the get_param call status.\n
500  * \param CB_buf - pointer to the results buffer (already on the measurement SRV object)
501  */
502 void MacServices_measurementSRV_noiseHistCallBack(TI_HANDLE hMeasurementSRV, TI_STATUS status, TI_UINT8* CB_buf);
503 
504 /**
505  * \author Ronen Kalish\n
506  * \date 14-November-2005\n
507  * \brief called when a measurement FW guard timer expires.
508  *
509  * Function Scope \e Public.\n
510  * \param hMeasuremntSRV - handle to the measurement SRV object.\n
511  */
512 void MacServices_measurementSRV_startStopTimerExpired (TI_HANDLE hMeasurementSRV, TI_BOOL bTwdInitOccured);
513 
514 /**
515  * \author Ronen Kalish\n
516  * \date 15-November-2005\n
517  * \brief called when a measurement type timer expires.\n
518  *
519  * Function Scope \e Public.\n
520  * \param hMeasuremntSRV - handle to the measurement SRV object.\n
521  */
522 void MacServices_measurementSRV_requestTimerExpired (TI_HANDLE hMeasurementSRV, TI_BOOL bTwdInitOccured);
523 
524 #endif /* __MACSERVICESAPI_H__ */
525