4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
35 * \brief This is the powerSrv module implementation.
36 * \author Assaf Azulay
40 /****************************************************************************
43 * PURPOSE: powerSrv Module implementation. *
45 ****************************************************************************/
47 #define __FILE_ID__ FILE_ID_113
53 #include "PowerSrv_API.h"
54 #include "PowerSrvSM.h"
55 #include "eventMbox_api.h"
58 /*****************************************************************************
60 *****************************************************************************/
64 /****************************************************************************************
65 ** Private Function prototypes **
66 ****************************************************************************************/
67 static void powerSrv802_11PsReport (TI_HANDLE hPowerSrv, char* str , TI_UINT32 strLen);
68 TI_STATUS powerSrvProcessRequest (TI_HANDLE hPowerSrv, powerSrvMode_e requestMode);
69 void powerSrvCreatePssRequest (TI_HANDLE hPowerSrv,
70 powerSrvMode_e requestMode,
71 powerSrvRequestState_e requestState,
73 TI_BOOL sendNullDataOnExit,
74 void * powerSaveCBObject,
75 powerSaveCmpltCB_t powerSaveCompleteCB,
76 powerSaveCmdResponseCB_t powerSaveCmdResponseCB);
78 /***************************************************************************************
80 ****************************************************************************************/
84 /****************************************************************************************
86 ****************************************************************************************
87 DESCRIPTION: Power Server module creation function, called by the MAC Services create in creation phase
88 performs the following:
89 - Allocate the Power Server handle
90 - Creates the Power Server State Machine
92 INPUT: - hOs - Handle to OS
97 RETURN: Handle to the Power Server module on success, NULL otherwise
98 ****************************************************************************************/
99 TI_HANDLE powerSrv_create(TI_HANDLE hOs)
101 powerSrv_t * pPowerSrv = NULL;
102 pPowerSrv = (powerSrv_t*) os_memoryAlloc (hOs, sizeof(powerSrv_t));
103 if ( pPowerSrv == NULL )
105 WLAN_OS_REPORT(("powerSrv_create - Memory Allocation Error!\n"));
109 os_memoryZero (hOs, pPowerSrv, sizeof(powerSrv_t));
111 pPowerSrv->hOS = hOs;
113 /*creation of the State Machine*/
114 pPowerSrv->hPowerSrvSM = powerSrvSM_create(hOs);
115 if ( pPowerSrv->hPowerSrvSM == NULL )
117 WLAN_OS_REPORT(("powerSrv_create - Error in create PowerSrvSM module!\n"));
118 powerSrv_destroy(pPowerSrv);
127 /****************************************************************************************
129 ****************************************************************************************
130 DESCRIPTION: Power Server module destroy function, c
131 - delete Power Server allocation
132 - call the destroy function of the State machine
134 INPUT: - hPowerSrv - Handle to the Power Server
139 RETURN: TI_STATUS - TI_OK on success else TI_NOK.
140 ****************************************************************************************/
141 TI_STATUS powerSrv_destroy(TI_HANDLE hPowerSrv)
143 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
145 if ( pPowerSrv->hPowerSrvSM != NULL )
147 powerSrvSM_destroy(pPowerSrv->hPowerSrvSM);
150 os_memoryFree(pPowerSrv->hOS , pPowerSrv , sizeof(powerSrv_t));
156 /****************************************************************************************
158 ****************************************************************************************
159 DESCRIPTION: Power Server module initialize function, called by the MAC Services in initialization phase
160 performs the following:
161 - init the Power server to active state.
162 - call the init function of the state machine.
164 INPUT: - hPowerSrv - handle to the PowerSrv object.
165 - hReport - handle to the Report object.
166 - hEventMbox - handle to the Event Mbox object.
167 - hCmdBld - handle to the Command Builder object.
170 RETURN: TI_STATUS - TI_OK on success else TI_NOK.
171 ****************************************************************************************/
172 TI_STATUS powerSrv_init (TI_HANDLE hPowerSrv,
174 TI_HANDLE hEventMbox,
178 powerSrv_t* pPowerSrv = (powerSrv_t*)hPowerSrv;
180 pPowerSrv->hReport = hReport;
181 pPowerSrv->hEventMbox = hEventMbox;
184 init PowerSrv state machine.
186 powerSrvSM_init (pPowerSrv->hPowerSrvSM, hReport, hCmdBld, hTimer);
188 pPowerSrv->currentMode = USER_MODE;
190 /*init all request with init values*/
191 powerSrvCreatePssRequest(hPowerSrv,
199 powerSrvCreatePssRequest(hPowerSrv,
207 pPowerSrv->userLastRequestMode = (powerSrvMode_e)POWER_SAVE_OFF;
208 pPowerSrv->pCurrentRequest = & pPowerSrv->userRequest;
214 eventMbox_RegisterEvent (hEventMbox,
215 TWD_OWN_EVENT_PS_REPORT,
216 (void *)powerSrv802_11PsReport,
219 eventMbox_UnMaskEvent (hEventMbox, TWD_OWN_EVENT_PS_REPORT, NULL, NULL);
221 TRACE0(pPowerSrv->hReport, REPORT_SEVERITY_INIT, "powerSrv Initialized \n");
226 /****************************************************************************************
228 ****************************************************************************************
229 DESCRIPTION: Restart the scan SRV module upon recovery.
230 - init the Power server to active state.
231 - call the init function of the state machine.
233 INPUT: - hPowerSrv - handle to the PowerSrv object.
236 RETURN: TI_STATUS - TI_OK on success else TI_NOK.
237 ****************************************************************************************/
238 TI_STATUS powerSrv_restart( TI_HANDLE hPowerSrv)
240 powerSrv_t* pPowerSrv = (powerSrv_t*)hPowerSrv;
241 PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)pPowerSrv->hPowerSrvSM;
243 init PowerSrv state machine.
246 the PowerSrvSM start in active mode (POWER_SRV_STATE_ACTIVE)
247 the PowerSrvSM::currentState must be sync with the PowerSrv::desiredPowerModeProfile (POWER_MODE_ACTIVE).
249 pPowerSrvSM->currentState = POWER_SRV_STATE_ACTIVE;
250 pPowerSrv->currentMode = USER_MODE;
251 tmr_StopTimer (pPowerSrvSM->hPwrSrvSmTimer);
253 /*init all request with init values*/
254 powerSrvCreatePssRequest(hPowerSrv,
262 powerSrvCreatePssRequest(hPowerSrv,
270 pPowerSrv->userLastRequestMode = (powerSrvMode_e)POWER_SAVE_OFF;
271 pPowerSrv->pCurrentRequest = & pPowerSrv->userRequest;
276 eventMbox_RegisterEvent (pPowerSrv->hEventMbox,
277 TWD_OWN_EVENT_PS_REPORT,
278 (void *)powerSrv802_11PsReport,
281 eventMbox_UnMaskEvent (pPowerSrv->hEventMbox, TWD_OWN_EVENT_PS_REPORT, NULL, NULL);
286 /****************************************************************************************
288 ****************************************************************************************
289 DESCRIPTION: Power Server module configuration function, called by the MAC Services in configure phase
290 performs the following:
291 - init the Power server to active state.
292 - call the init function of the state machine.
294 INPUT: - hPowerSrv - handle to the PowerSrv object.
295 - pPowerSrvInitParams - the Power Server initialize parameters.
298 RETURN: TI_STATUS - TI_OK on success else TI_NOK.
299 ****************************************************************************************/
300 TI_STATUS powerSrv_config( TI_HANDLE hPowerSrv,
301 TPowerSrvInitParams *pPowerSrvInitParams)
303 powerSrv_t* pPowerSrv = (powerSrv_t*)hPowerSrv;
306 config PowerSrv state machine.
308 powerSrvSM_config( pPowerSrv->hPowerSrvSM,
309 pPowerSrvInitParams);
313 /****************************************************************************************
314 * powerSrv_SetPsMode *
315 ****************************************************************************************
316 DESCRIPTION: This function is a user mode request from the Power Save Server.
317 it will create a Request from the "USER_REQUEST" and will try to perform the user request for PS/Active.
318 this will be done in respect of priority to Driver request.
320 INPUT: - hPowerSrv - handle to the PowerSrv object.
321 - psMode - Power save/Active request
322 - sendNullDataOnExit -
323 - powerSaveCBObject - handle to the Callback function module.
324 - powerSaveCompleteCB - Callback function - for success/faild notification.
326 RETURN: TI_STATUS - TI_OK / PENDING / TI_NOK.
327 ****************************************************************************************/
328 TI_STATUS powerSrv_SetPsMode( TI_HANDLE hPowerSrv,
330 TI_BOOL sendNullDataOnExit,
331 void * powerSaveCBObject,
332 powerSaveCmpltCB_t powerSaveCompleteCB,
333 powerSaveCmdResponseCB_t powerSavecmdResponseCB)
336 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
338 /*creating the request from type - "user"*/
339 powerSrvCreatePssRequest(hPowerSrv,
346 powerSavecmdResponseCB);
348 /*the request will be handled if the Power server is not in Driver mode.*/
349 if ( pPowerSrv->currentMode==USER_MODE )
351 status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->userRequest.requestMode);
355 pPowerSrv->userRequest.requestState = PENDING_REQUEST;
356 status = POWER_SAVE_802_11_PENDING;
363 /****************************************************************************************
364 * powerSrv_ReservePS *
365 ****************************************************************************************
366 DESCRIPTION: This function is a driver mode request to set the 802.11 Power Save state and reserve the module.
367 The module should not be in driver mode when this request is made.
368 If this function is called when the module is already in driver mode the result is unexpected.
369 If the request cannot be fulfilled because of currently executing user mode request,
370 then the function will return PENDING and the powerSaveCompleteCB function will be called when the request is fulfilled.
371 If the request can be fulfilled immediately and the Power Save state required is the current state
372 (This is always the case when PSMode = KEEP_CURRENT),
373 then the module will be reserved and the function will return TI_OK - the callback function will not be called.??
374 If the request can be fulfilled immediately and requires a Power Save state transition,
375 then the return value will be TI_OK and the powerSaveCompleteCB function will be called by the Power Save Server
376 when the request is complete.
378 INPUT: - hPowerSrv - handle to the PowerSrv object.
379 - psMode - Power save/Active request
380 - sendNullDataOnExit -
381 - powerSaveCBObject - handle to the Callback function module.
382 - powerSaveCompleteCB - Callback function - for success/faild notification.
384 RETURN: TI_STATUS - TI_OK / PENDING / TI_NOK.
385 ****************************************************************************************/
386 TI_STATUS powerSrv_ReservePS( TI_HANDLE hPowerSrv,
388 TI_BOOL sendNullDataOnExit,
389 void * powerSaveCBObject,
390 powerSaveCmpltCB_t powerSaveCompleteCB)
392 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
395 /*creating the request from type - "driver"*/
396 if ( psMode == POWER_SAVE_KEEP_CURRENT )
398 psMode = pPowerSrv->userRequest.psMode;
401 powerSrvCreatePssRequest(hPowerSrv,
409 /*try to execute the request*/
410 status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->driverRequest.requestMode);
416 /****************************************************************************************
417 * powerSrv_ReleasePS *
418 ****************************************************************************************
419 DESCRIPTION: This function is used to release a previous driver mode request issued with the ReservPS API.
420 it creates a Driver request and the server act like it is a normal driver request.
421 the server will send the request with a simple optimization - if there is a pending or
422 new user request - the request will be added in the driver request, in this way when the
423 user request will be executed there will be nothing to do, in the same manner if there
424 are no user / driver request to execute we will send the last user request in Driver mode.
429 INPUT: - hPowerSrv - handle to the PowerSrv object.
430 - sendNullDataOnExit -
431 - powerSaveCBObject - handle to the Callback function module.
432 - powerSaveCompleteCB - Callback function - for success/faild notification.
434 RETURN: TI_STATUS - TI_OK / PENDING / TI_NOK.
435 ****************************************************************************************/
436 TI_STATUS powerSrv_ReleasePS( TI_HANDLE hPowerSrv,
437 TI_BOOL sendNullDataOnExit,
438 void * powerSaveCBObject,
439 powerSaveCmpltCB_t powerSaveCompleteCB)
441 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
444 /*creating the request from type - "driver"*/
446 if (pPowerSrv->driverRequest.requestMode == POWER_SAVE_802_11_PENDING)
448 powerSrvCreatePssRequest(hPowerSrv,
456 return POWER_SAVE_802_11_IS_CURRENT;
459 /*creating the request from type - "driver"*/
460 powerSrvCreatePssRequest(hPowerSrv,
463 POWER_SAVE_KEEP_CURRENT,
468 if ( pPowerSrv->userRequest.requestState == NEW_REQUEST ||
469 pPowerSrv->userRequest.requestState == PENDING_REQUEST )
471 pPowerSrv->driverRequest.psMode = pPowerSrv->userRequest.psMode;
475 pPowerSrv->driverRequest.psMode = (E80211PsMode)pPowerSrv->userLastRequestMode;
480 status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->driverRequest.requestMode);
481 /*if the request was not executed we should not change the mode*/
482 if (status != POWER_SAVE_802_11_PENDING)
484 pPowerSrv->currentMode = USER_MODE;
491 /****************************************************************************************
492 * powerSrv_getPsStatus *
493 *****************************************************************************************
494 DESCRIPTION: This function returns the true state of power.
496 INPUT: - hPowerSrv - handle to the PowerSrv object.
499 RETURN: TI_BOOL - true if the SM is in PS state - false otherwise
500 ****************************************************************************************/
501 TI_BOOL powerSrv_getPsStatus(TI_HANDLE hPowerSrv)
503 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
504 PowerSrvSMStates_e smState;
505 smState = powerSrvSM_getCurrentState(pPowerSrv->hPowerSrvSM);
506 return(smState == POWER_SRV_STATE_PS );
510 /****************************************************************************************
511 * powerSrv_SetRateModulation *
512 *****************************************************************************************
513 DESCRIPTION: Sets the rate modulation according to the current Radio Mode.
515 INPUT: - hPowerSrv - handle to the PowerSrv object.
516 - dot11mode_e - The current radio mode (A or G)
519 RETURN: TI_BOOL - true if the SM is in PS state - false otherwise
520 ****************************************************************************************/
521 void powerSrv_SetRateModulation(TI_HANDLE hPowerSrv, TI_UINT16 rate)
523 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
524 powerSrvSM_setRateModulation(pPowerSrv->hPowerSrvSM,rate);
530 * \Gets the rate modulation.
532 * Function Scope \e Public.\n
534 * 1) TI_HANDLE - handle to the PowerSrvSM object.\n
535 * 2) dot11mode_e - The current radio mode (A or G)
538 TI_UINT32 powerSrv_GetRateModulation(TI_HANDLE hPowerSrv)
540 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
541 return powerSrvSM_getRateModulation(pPowerSrv->hPowerSrvSM);
547 /*****************************************************************************
548 ** Private Function prototypes **
549 *****************************************************************************/
552 /****************************************************************************************
553 * powerSrv802_11PsReport *
554 ****************************************************************************************
555 DESCRIPTION: This function is the call back for the TWD control when a PS event triggered
556 This function is responsible for the process "keep alive".
557 the function handles the event and sends it to the state machine, after sending the events
558 the function handles the next request with respect to driver request priority.
559 if a request is already done then we will call the request call back (if exist!).
564 INPUT: - hPowerSrv - handle to the PowerSrv object.
566 - strLen - string length
570 ****************************************************************************************/
571 static void powerSrv802_11PsReport(TI_HANDLE hPowerSrv, char* str , TI_UINT32 strLen)
573 powerSrv_t * pPowerSrv = (powerSrv_t*)hPowerSrv;
574 TI_UINT8 PowerSaveStatus;
575 E80211PsMode currentPsMode;
576 TI_STATUS status = TI_OK;
579 os_memoryCopy(pPowerSrv->hOS, (void *)&PowerSaveStatus, (void *)str, strLen);
581 TRACE1( pPowerSrv->hReport, REPORT_SEVERITY_INFORMATION, "PS callback with status: %d\n", PowerSaveStatus);
583 /* Handling the event*/
584 switch ( (EventsPowerSave_e)PowerSaveStatus )
586 case ENTER_POWER_SAVE_FAIL:
587 case EXIT_POWER_SAVE_FAIL:
588 TRACE0( pPowerSrv->hReport, REPORT_SEVERITY_WARNING, "Power save enter or exit failed!\n");
589 powerSrvSM_SMApi(pPowerSrv->hPowerSrvSM,POWER_SRV_EVENT_FAIL);
592 case ENTER_POWER_SAVE_SUCCESS:
593 case EXIT_POWER_SAVE_SUCCESS:
594 powerSrvSM_SMApi(pPowerSrv->hPowerSrvSM,POWER_SRV_EVENT_SUCCESS);
595 /*update the last user request if the request was a user request*/
596 if ( pPowerSrv->currentMode == USER_MODE )
598 pPowerSrv->userLastRequestMode= (powerSrvMode_e)pPowerSrv->userRequest.psMode;
603 TRACE1( pPowerSrv->hReport, REPORT_SEVERITY_ERROR, "Unrecognized status at PS callback %d\n", PowerSaveStatus );
607 /*this reflects the true power save state - power save IFF state machine in PS state.*/
608 if ( (EventsPowerSave_e)PowerSaveStatus == ENTER_POWER_SAVE_SUCCESS )
610 currentPsMode = POWER_SAVE_ON;
614 currentPsMode = POWER_SAVE_OFF;
617 /*in case of request has been already handled - calling the CB*/
618 if ( pPowerSrv->pCurrentRequest->requestState == HANDLED_REQUEST )
620 if ( pPowerSrv->pCurrentRequest->powerSrvCompleteCB != NULL )
622 pPowerSrv->pCurrentRequest->powerSrvCompleteCB( pPowerSrv->pCurrentRequest->powerSaveCBObject,
624 (EventsPowerSave_e)PowerSaveStatus);
629 /*starting again to handle waiting requests */
630 /*priority to driver request*/
631 if ( pPowerSrv->driverRequest.requestState == NEW_REQUEST ||
632 pPowerSrv->driverRequest.requestState == PENDING_REQUEST )
634 status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->driverRequest.requestMode);
638 if ( pPowerSrv->currentMode==USER_MODE )
640 if ( pPowerSrv->userRequest.requestState == NEW_REQUEST||
641 pPowerSrv->userRequest.requestState == PENDING_REQUEST )
643 status = powerSrvProcessRequest(hPowerSrv,pPowerSrv->userRequest.requestMode);
648 if ( status == POWER_SAVE_802_11_IS_CURRENT )/*in case of already or habdled*/
650 if ( pPowerSrv->pCurrentRequest->powerSrvCompleteCB != NULL )
652 pPowerSrv->pCurrentRequest->powerSrvCompleteCB(pPowerSrv->pCurrentRequest->powerSaveCBObject,
653 pPowerSrv->pCurrentRequest->psMode,
654 ((pPowerSrv->pCurrentRequest->psMode == POWER_SAVE_ON) ?
655 ENTER_POWER_SAVE_SUCCESS :
656 EXIT_POWER_SAVE_SUCCESS));
664 /****************************************************************************************
665 * powerSrvProcessRequest *
666 ****************************************************************************************
667 DESCRIPTION: This function receive the request before sending it to the state machine, checks if it
668 possible to be applied and pass it to the state machine.
672 INPUT: - hPowerSrv - handle to the PowerSrv object.
673 - requestMode - Driver or User mode
677 RETURN: TI_STATUS - TI_OK / PENDING / TI_NOK.
678 ****************************************************************************************/
679 TI_STATUS powerSrvProcessRequest (TI_HANDLE hPowerSrv, powerSrvMode_e requestMode)
681 PowerSrvSMStates_e powerSrvSmState;
682 powerSrvRequest_t* pPrcessedRequest;
683 TI_STATUS smApiStatus;
684 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
688 /*determine what is the current request*/
689 if ( requestMode == DRIVER_MODE )
691 pPrcessedRequest = &(pPowerSrv->driverRequest);
695 pPrcessedRequest = &(pPowerSrv->userRequest);
698 /*in case that the state machine is in a pending state and it is a driver
699 request we will return Pending and not call the SM. the request will
700 be processed in the next event - according to the 802_11_Report.*/
701 powerSrvSmState = powerSrvSM_getCurrentState(pPowerSrv->hPowerSrvSM);
703 if ( (powerSrvSmState == POWER_SRV_STATE_PEND_ACTIVE ||
704 powerSrvSmState == POWER_SRV_STATE_PEND_PS) &&
705 pPowerSrv->pCurrentRequest->requestMode == DRIVER_MODE )
707 pPrcessedRequest->requestState = PENDING_REQUEST;
708 return POWER_SAVE_802_11_PENDING;
710 /*Set the correct request to the SM*/
711 powerSrvSm_setSmRequest(pPowerSrv->hPowerSrvSM ,pPrcessedRequest);
713 /*call the SM with the correct request*/
715 if ( pPrcessedRequest->psMode == POWER_SAVE_ON )
717 smApiStatus = powerSrvSM_SMApi(pPowerSrv->hPowerSrvSM,POWER_SRV_EVENT_REQUEST_PS);
721 smApiStatus = powerSrvSM_SMApi(pPowerSrv->hPowerSrvSM,POWER_SRV_EVENT_REQUEST_ACTIVE);
724 /*if =! pending updating the current request pointer.*/
725 if ( pPrcessedRequest->requestState != PENDING_REQUEST )
727 pPowerSrv->pCurrentRequest = pPrcessedRequest;
728 pPowerSrv->currentMode = pPowerSrv->pCurrentRequest->requestMode;
736 /****************************************************************************************
737 * powerSrvCreatePssRequest *
738 ****************************************************************************************
739 DESCRIPTION: This function create a request acording to it's type:
744 INPUT: - hPowerSrv - handle to the PowerSrv object.
745 - requestMode - request type : Driver/User
746 - psMode - Power save/Active request
747 - sendNullDataOnExit -
748 - powerSaveCBObject - handle to the Callback functin module.
749 - powerSaveCompleteCB - Calback function - for success/faild notification.
753 ****************************************************************************************/
754 void powerSrvCreatePssRequest (TI_HANDLE hPowerSrv,
755 powerSrvMode_e requestMode,
756 powerSrvRequestState_e requestState,
758 TI_BOOL sendNullDataOnExit,
759 void * powerSaveCBObject,
760 powerSaveCmpltCB_t powerSaveCompleteCB,
761 powerSaveCmdResponseCB_t powerSaveCmdResponseCB)
763 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
764 if ( requestMode==USER_MODE )
766 pPowerSrv->userRequest.requestState = requestState;
767 pPowerSrv->userRequest.requestMode = requestMode;
768 pPowerSrv->userRequest.psMode = psMode;
769 pPowerSrv->userRequest.sendNullDataOnExit = sendNullDataOnExit;
770 pPowerSrv->userRequest.powerSaveCBObject = powerSaveCBObject;
771 pPowerSrv->userRequest.powerSrvCompleteCB = powerSaveCompleteCB;
772 pPowerSrv->userRequest.powerSaveCmdResponseCB = powerSaveCmdResponseCB;
774 else /*driver request*/
776 pPowerSrv->driverRequest.requestState = requestState;
777 pPowerSrv->driverRequest.requestMode = requestMode;
778 pPowerSrv->driverRequest.psMode = psMode;
779 pPowerSrv->driverRequest.sendNullDataOnExit = sendNullDataOnExit;
780 pPowerSrv->driverRequest.powerSaveCBObject = powerSaveCBObject;
781 pPowerSrv->driverRequest.powerSrvCompleteCB = powerSaveCompleteCB;
782 pPowerSrv->driverRequest.powerSaveCmdResponseCB = NULL;
788 /****************************************************************************************
789 * powerSrvRegisterFailureEventCB *
790 ****************************************************************************************
791 DESCRIPTION: Registers a failure event callback for scan error notifications.
794 INPUT: - hPowerSrv - handle to the PowerSrv object.
795 - failureEventCB - the failure event callback function.\n
796 - hFailureEventObj - handle to the object passed to the failure event callback function.
800 ****************************************************************************************/
801 void powerSrvRegisterFailureEventCB( TI_HANDLE hPowerSrv,
802 void * failureEventCB, TI_HANDLE hFailureEventObj )
804 powerSrv_t *pPowerSrv = (powerSrv_t*)hPowerSrv;
806 pPowerSrv->failureEventFunc = (TFailureEventCb)failureEventCB;
807 pPowerSrv->failureEventObj = hFailureEventObj;
809 /* register the failure event CB also with the PS SM */
810 powerSrvSM_RegisterFailureEventCB( pPowerSrv->hPowerSrvSM, failureEventCB, hFailureEventObj );