TI_STATUS TWD_RegisterEvent (TI_HANDLE hTWD, TI_UINT32 event, void *fCb, TI_HANDLE hCb) { TTwd *pTWD = (TTwd *)hTWD; return eventMbox_RegisterEvent (pTWD->hEventMbox, event, fCb, hCb); }
/**************************************************************************************** * powerSrvSM_init * **************************************************************************************** DESCRIPTION: Power Server module initialize function, called by the MAC Services in initialization phase performs the following: - init the Power server to active state. - call the init function of the state machine. INPUT: - hPowerSrv - handle to the PowerSrv object. - hReport - handle to the Report object. - hEventMbox - handle to the Event Mbox object. - hCmdBld - handle to the Command Builder object. OUTPUT: RETURN: TI_STATUS - TI_OK on success else TI_NOK. ****************************************************************************************/ TI_STATUS powerSrv_init (TI_HANDLE hPowerSrv, TI_HANDLE hReport, TI_HANDLE hEventMbox, TI_HANDLE hCmdBld, TI_HANDLE hTimer) { powerSrv_t* pPowerSrv = (powerSrv_t*)hPowerSrv; pPowerSrv->hReport = hReport; pPowerSrv->hEventMbox = hEventMbox; /* init PowerSrv state machine. */ powerSrvSM_init (pPowerSrv->hPowerSrvSM, hReport, hCmdBld, hTimer); pPowerSrv->currentMode = USER_MODE; /*init all request with init values*/ powerSrvCreatePssRequest(hPowerSrv, USER_MODE, HANDLED_REQUEST, POWER_SAVE_OFF, TI_FALSE, NULL, NULL, NULL); powerSrvCreatePssRequest(hPowerSrv, DRIVER_MODE, HANDLED_REQUEST, POWER_SAVE_OFF, TI_FALSE, NULL, NULL, NULL); pPowerSrv->userLastRequestMode = (powerSrvMode_e)POWER_SAVE_OFF; pPowerSrv->pCurrentRequest = & pPowerSrv->userRequest; /* register for Event */ eventMbox_RegisterEvent (hEventMbox, TWD_OWN_EVENT_PS_REPORT, (void *)powerSrv802_11PsReport, hPowerSrv); eventMbox_UnMaskEvent (hEventMbox, TWD_OWN_EVENT_PS_REPORT, NULL, NULL); TRACE0(pPowerSrv->hReport, REPORT_SEVERITY_INIT, "powerSrv Initialized \n"); return TI_OK; }
/**************************************************************************************** * powerSrv_restart * **************************************************************************************** DESCRIPTION: Restart the scan SRV module upon recovery. - init the Power server to active state. - call the init function of the state machine. INPUT: - hPowerSrv - handle to the PowerSrv object. OUTPUT: RETURN: TI_STATUS - TI_OK on success else TI_NOK. ****************************************************************************************/ TI_STATUS powerSrv_restart( TI_HANDLE hPowerSrv) { powerSrv_t* pPowerSrv = (powerSrv_t*)hPowerSrv; PowerSrvSM_t *pPowerSrvSM = (PowerSrvSM_t*)pPowerSrv->hPowerSrvSM; /* init PowerSrv state machine. */ /* the PowerSrvSM start in active mode (POWER_SRV_STATE_ACTIVE) the PowerSrvSM::currentState must be sync with the PowerSrv::desiredPowerModeProfile (POWER_MODE_ACTIVE). */ pPowerSrvSM->currentState = POWER_SRV_STATE_ACTIVE; pPowerSrv->currentMode = USER_MODE; tmr_StopTimer (pPowerSrvSM->hPwrSrvSmTimer); /*init all request with init values*/ powerSrvCreatePssRequest(hPowerSrv, USER_MODE, HANDLED_REQUEST, POWER_SAVE_OFF, TI_FALSE, NULL, NULL, NULL); powerSrvCreatePssRequest(hPowerSrv, DRIVER_MODE, HANDLED_REQUEST, POWER_SAVE_OFF, TI_FALSE, NULL, NULL, NULL); pPowerSrv->userLastRequestMode = (powerSrvMode_e)POWER_SAVE_OFF; pPowerSrv->pCurrentRequest = & pPowerSrv->userRequest; /* register for Event */ eventMbox_RegisterEvent (pPowerSrv->hEventMbox, TWD_OWN_EVENT_PS_REPORT, (void *)powerSrv802_11PsReport, hPowerSrv); eventMbox_UnMaskEvent (pPowerSrv->hEventMbox, TWD_OWN_EVENT_PS_REPORT, NULL, NULL); return TI_OK; }
/** * \\n * \date 08-November-2005\n * \brief Initializes the measurement SRV object * * Function Scope \e Public.\n * \param hMeasurementSRV - handle to the measurement SRV object.\n * \param hReport - handle to the report object.\n * \param hCmdBld - handle to the Command Builder object.\n * \param hPowerSaveSRV - handle to the power save SRV object.\n */ TI_STATUS MacServices_measurementSRV_init (TI_HANDLE hMeasurementSRV, TI_HANDLE hReport, TI_HANDLE hCmdBld, TI_HANDLE hEventMbox, TI_HANDLE hPowerSaveSRV, TI_HANDLE hTimer) { measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV; TI_INT32 i; /* store handles */ pMeasurementSRV->hReport = hReport; pMeasurementSRV->hCmdBld = hCmdBld; pMeasurementSRV->hEventMbox = hEventMbox; pMeasurementSRV->hPowerSaveSRV = hPowerSaveSRV; pMeasurementSRV->hTimer = hTimer; /* Initialize the state machine */ measurementSRVSM_init (hMeasurementSRV); /* allocate the module timers */ pMeasurementSRV->hStartStopTimer = tmr_CreateTimer (pMeasurementSRV->hTimer); if (pMeasurementSRV->hStartStopTimer == NULL) { return TI_NOK; } pMeasurementSRV->bStartStopTimerRunning = TI_FALSE; for (i = 0; i < MAX_NUM_OF_MSR_TYPES_IN_PARALLEL; i++) { pMeasurementSRV->hRequestTimer[i] = tmr_CreateTimer (pMeasurementSRV->hTimer); if (pMeasurementSRV->hRequestTimer[i] == NULL) { return TI_NOK; } pMeasurementSRV->bRequestTimerRunning[i] = TI_FALSE; } /* register HAL callbacks */ /* Register and Enable the Measure Start event in HAL */ eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_START, (void *)MacServices_measurementSRV_measureStartCB, hMeasurementSRV); eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_START, NULL, NULL); /* Register and Enable the Measurement Complete event in HAL. This event will be received when the Measurement duration expired, or after Stop Measure command. */ eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_COMPLETE, (void *)MacServices_measurementSRV_measureCompleteCB, hMeasurementSRV); eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_MEASUREMENT_COMPLETE, NULL, NULL); /* Register and Enable the AP Discovery Complete event in HAL */ eventMbox_RegisterEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_AP_DISCOVERY_COMPLETE, (void *)MacServices_measurementSRV_apDiscoveryCompleteCB, hMeasurementSRV); eventMbox_UnMaskEvent (pMeasurementSRV->hEventMbox, TWD_OWN_EVENT_AP_DISCOVERY_COMPLETE, NULL, NULL); return TI_OK; }