/** * \fn setDefaultProbeReqTemplate * \brief set Default Probe Req Template tp the FW. * * set Default Probe Req Template tp the FW. * * \param hSiteMgr - Handle to site manager * \return None * \sa */ void setDefaultProbeReqTemplate(TI_HANDLE hSiteMgr) { siteMgr_t *pSiteMgr = (siteMgr_t *) hSiteMgr; TSetTemplate tTemplateStruct; probeReqTemplate_t tProbeReqTemplate; TSsid tBroadcastSSID; /* * Setting probe request temapltes for both bands. * allocating EMPTY 32 bytes for the SSID IE, to reserve space for different SSIDs the FW will set */ tBroadcastSSID.len = MAX_SSID_LEN; os_memorySet(pSiteMgr->hOs, &(tBroadcastSSID.str[0]), 0, MAX_SSID_LEN); tTemplateStruct.ptr = (TI_UINT8 *) & tProbeReqTemplate; tTemplateStruct.type = PROBE_REQUEST_TEMPLATE; tTemplateStruct.eBand = RADIO_BAND_2_4_GHZ; tTemplateStruct.uRateMask = RATE_MASK_UNSPECIFIED; buildProbeReqTemplate(hSiteMgr, &tTemplateStruct, &tBroadcastSSID, RADIO_BAND_2_4_GHZ); TWD_CmdTemplate(pSiteMgr->hTWD, &tTemplateStruct, NULL, NULL); tTemplateStruct.eBand = RADIO_BAND_5_0_GHZ; buildProbeReqTemplate(hSiteMgr, &tTemplateStruct, &tBroadcastSSID, RADIO_BAND_5_0_GHZ); TWD_CmdTemplate(pSiteMgr->hTWD, &tTemplateStruct, NULL, NULL); }
/** * \brief Set Template Frame * * \param hTWD - TWD module object handle * \param pMib - Pointer to Input MIB Structure * \return TI_OK on success or TI_NOK on failure * * \par Description * Static function * Configure/Interrogate/Modulate the Frame Rate if needed (according to Templete Type) * and then write the MIB TemplateFrame to the FW * * \sa */ static TI_STATUS TWD_WriteMibTemplateFrame (TI_HANDLE hTWD, TMib* pMib) { TTwd *pTWD = (TTwd *)hTWD; TSetTemplate tSetTemplate; TI_UINT32 uRateMask = RATE_TO_MASK(pMib->aData.TemplateFrame.Rate); /* * Construct the template MIB element */ switch(pMib->aData.TemplateFrame.FrameType) { case TEMPLATE_TYPE_BEACON: tSetTemplate.type = BEACON_TEMPLATE; break; case TEMPLATE_TYPE_PROBE_REQUEST: tSetTemplate.type = PROBE_REQUEST_TEMPLATE; tSetTemplate.eBand = RADIO_BAND_2_4_GHZ; /* needed for GWSI, if so band must also be passed to choose correct template (G or A) */ break; case TEMPLATE_TYPE_NULL_FRAME: tSetTemplate.type = NULL_DATA_TEMPLATE; MacServices_powerSrv_SetRateModulation (pTWD->hMacServices, (TI_UINT16)uRateMask); break; case TEMPLATE_TYPE_PROBE_RESPONSE: tSetTemplate.type = PROBE_RESPONSE_TEMPLATE; break; case TEMPLATE_TYPE_QOS_NULL_FRAME: tSetTemplate.type = QOS_NULL_DATA_TEMPLATE; break; case TEMPLATE_TYPE_PS_POLL: tSetTemplate.type = PS_POLL_TEMPLATE; break; default: return PARAM_NOT_SUPPORTED; } tSetTemplate.len = pMib->aData.TemplateFrame.Length; tSetTemplate.ptr = (TI_UINT8 *) &(pMib->aData.TemplateFrame.Data); tSetTemplate.uRateMask = uRateMask; return TWD_CmdTemplate (hTWD, &tSetTemplate, NULL, NULL); }
/** * \fn powerMgrKLConfigureMessage * \brief Configures keep-alive message (template and parameters) * * Configures a keepa-live message from internal database. * * \param hPowerMgrKL - handle to the power-manager keep-alive object * \param uMessageIndex - index of message to configure (from internal database) * \return TI_OK if succesful, TI_NOK otherwise * \sa powerMgrKL_start, powerMgrKL_setParam */ TI_STATUS powerMgrKLConfigureMessage (TI_HANDLE hPowerMgrKL, TI_UINT32 uMessageIndex) { TPowerMgrKL *pPowerMgrKL = (TPowerMgrKL*)hPowerMgrKL; TI_STATUS status = TI_OK; /* if the keep-alive for this index is enabled */ if (TI_TRUE == pPowerMgrKL->tCurrentConfig.templates[ uMessageIndex ].keepAliveParams.enaDisFlag) { /* configure template - first the template itself */ TSetTemplate tTemplate; tTemplate.type = KEEP_ALIVE_TEMPLATE; tTemplate.index = uMessageIndex; os_memoryCopy (pPowerMgrKL->hOs, &(pPowerMgrKL->tempBuffer), &(pPowerMgrKL->wlanHeader), pPowerMgrKL->wlanHeaderLength); /* copy WLAN header - was built on connection */ os_memoryCopy (pPowerMgrKL->hOs, &(pPowerMgrKL->tempBuffer[ pPowerMgrKL->wlanHeaderLength ]), &(pPowerMgrKL->tCurrentConfig.templates[ uMessageIndex ].msgBuffer[ 0 ]), pPowerMgrKL->tCurrentConfig.templates[ uMessageIndex ].msgBufferLength); /* copy template data */ tTemplate.ptr = &(pPowerMgrKL->tempBuffer[ 0 ]); tTemplate.len = pPowerMgrKL->tCurrentConfig.templates[ uMessageIndex ].msgBufferLength + pPowerMgrKL->wlanHeaderLength; tTemplate.uRateMask = RATE_MASK_UNSPECIFIED; status = TWD_CmdTemplate (pPowerMgrKL->hTWD, &tTemplate, NULL, NULL); if (TI_OK != status) { return status; } /* and than the parameters */ status = TWD_CfgKeepAlive (pPowerMgrKL->hTWD, &(pPowerMgrKL->tCurrentConfig.templates[ uMessageIndex ].keepAliveParams)); if (TI_OK != status) { return status; } } /* keep-alive for this index is disabled - just disable it */ else { status = TWD_CfgKeepAlive (pPowerMgrKL->hTWD, &(pPowerMgrKL->tCurrentConfig.templates[ uMessageIndex ].keepAliveParams)); if (TI_OK != status) { return status; } } return status; }
/** * Called when the SCR callbacks with a RUN response or if the SCR * returned a RUN response when we requested it. * * @date 05-Jan-2006 */ static TI_STATUS measurementMgrSM_acStartMeasurement(void * pData) { measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) pData; /* Cryptic: the first struct is the requestHandler request while */ /* the second one is the measurementSRV request */ MeasurementRequest_t * pRequestArr[MAX_NUM_REQ]; TMeasurementRequest request; paramInfo_t *pParam; TI_UINT8 numOfRequestsInParallel; TI_UINT8 requestIndex; TI_UINT32 timePassed; TI_BOOL requestedBeaconMeasurement= TI_FALSE; TI_STATUS status; TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Starting Measurement operation\n"); pParam = (paramInfo_t *)os_memoryAlloc(pMeasurementMgr->hOs, sizeof(paramInfo_t)); if (!pParam) { return TI_NOK; } request.channel = pMeasurementMgr->measuredChannelID; request.startTime = 0; /* ignored by MeasurementSRV for now - for .11k */ request.numberOfTypes = 0; TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Measured Channel = %d\n", pMeasurementMgr->measuredChannelID); pParam->paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES; pParam->content.channelCapabilityReq.channelNum = pMeasurementMgr->measuredChannelID; pParam->content.channelCapabilityReq.scanOption = ACTIVE_SCANNING; if (pMeasurementMgr->measuredChannelID <= MAX_CHANNEL_IN_BAND_2_4) { request.band = RADIO_BAND_2_4_GHZ; pParam->content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ; } else { request.band = RADIO_BAND_5_0_GHZ; pParam->content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ; } regulatoryDomain_getParam(pMeasurementMgr->hRegulatoryDomain, pParam); request.txPowerDbm = pParam->content.channelCapabilityRet.maxTxPowerDbm; request.eTag = SCAN_RESULT_TAG_MEASUREMENT; os_memoryFree(pMeasurementMgr->hOs, pParam, sizeof(paramInfo_t)); TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Querying Request Handler for the next request in the queue\n"); /* Getting the next request/requests from the request handler */ status = requestHandler_getNextReq(pMeasurementMgr->hRequestH, TI_TRUE, pRequestArr, &numOfRequestsInParallel); if (status != TI_OK) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_ERROR, ": Failed getting next request from Request Handler\n"); return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState), MEASUREMENTMGR_EVENT_COMPLETE, pMeasurementMgr); } /* Save the number of requests in parallel so that once the */ /* measurement operation ends we can get rid of this amount of requests */ /* from the requestHandler */ pMeasurementMgr->currentNumOfRequestsInParallel = numOfRequestsInParallel; for (requestIndex = 0; requestIndex < numOfRequestsInParallel; requestIndex++) { if (pRequestArr[requestIndex]->Type == MSR_TYPE_BEACON_MEASUREMENT) { requestedBeaconMeasurement = TI_TRUE; if (pRequestArr[requestIndex]->ScanMode == MSR_SCAN_MODE_BEACON_TABLE) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Beacon Table request encountered, building report now\n"); /* building Report for beacon table request */ pMeasurementMgr->buildReport(pMeasurementMgr, *pRequestArr[requestIndex], NULL); continue; } } /* save the request so we can reference it when results arrive */ pMeasurementMgr->currentRequest[request.numberOfTypes] = pRequestArr[requestIndex]; /* add the measurement type to the request's list */ request.msrTypes[request.numberOfTypes].duration = pRequestArr[requestIndex]->DurationTime; request.msrTypes[request.numberOfTypes].scanMode = pRequestArr[requestIndex]->ScanMode; request.msrTypes[request.numberOfTypes].msrType = pRequestArr[requestIndex]->Type; TRACE3(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ":\n\nMeasurement Request #%d Details: Type = %d, Duration = %d\n\n", request.numberOfTypes+1, request.msrTypes[request.numberOfTypes].msrType, request.msrTypes[request.numberOfTypes].duration); request.numberOfTypes++; } if (requestedBeaconMeasurement == TI_TRUE) { /* build a probe request template and send it to the HAL */ TSetTemplate templateStruct; probeReqTemplate_t probeReqTemplate; TSsid broadcastSSID; templateStruct.ptr = (TI_UINT8 *) &probeReqTemplate; templateStruct.type = PROBE_REQUEST_TEMPLATE; templateStruct.eBand = request.band; templateStruct.uRateMask = RATE_MASK_UNSPECIFIED; broadcastSSID.len = 0; TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Sending probe request template...\n"); buildProbeReqTemplate( pMeasurementMgr->hSiteMgr, &templateStruct, &broadcastSSID, request.band ); #ifdef XCC_MODULE_INCLUDED { /* Insert Radio Mngt Capability IE according XCC4*/ TI_UINT32 len = 0; measurementMgr_radioMngtCapabilityBuild (pMeasurementMgr, templateStruct.ptr + templateStruct.len, (TI_UINT8*)&len); templateStruct.len += len; } #endif TWD_CmdTemplate (pMeasurementMgr->hTWD, &templateStruct, NULL, NULL); } /* Check if the maximum time to wait for the measurement request to */ /* finish has already passed */ timePassed = os_timeStampMs(pMeasurementMgr->hOs) - pMeasurementMgr->currentRequestStartTime; if (timePassed > MSR_START_MAX_DELAY) { TRACE2(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Maximum delay to perform measurement operation has passed (%d / %d)\n", MSR_START_MAX_DELAY, (os_timeStampMs(pMeasurementMgr->hOs) - pMeasurementMgr->currentRequestStartTime)); pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequestsInParallel, MSR_REJECT_MAX_DELAY_PASSED); return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState), MEASUREMENTMGR_EVENT_COMPLETE, pMeasurementMgr); } /* Yalla, start measuring */ TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Finished preparing request. Handing over to MeasurementSRV...\n"); TWD_StartMeasurement (pMeasurementMgr->hTWD, &request, MSR_START_MAX_DELAY - timePassed, NULL, NULL, measurementMgr_MeasurementCompleteCB, pMeasurementMgr); return TI_OK; }