VOID p2pStateAbort_AP_CHANNEL_DETECT(IN P_ADAPTER_T prAdapter, IN P_P2P_FSM_INFO_T prP2pFsmInfo, IN P_P2P_SPECIFIC_BSS_INFO_T prP2pSpecificBssInfo, IN ENUM_P2P_STATE_T eNextState) { P_P2P_CHNL_REQ_INFO_T prChnlReqInfo = (P_P2P_CHNL_REQ_INFO_T) NULL; P_P2P_CONNECTION_SETTINGS_T prP2pConnSettings = (P_P2P_CONNECTION_SETTINGS_T) NULL; do { if (eNextState == P2P_STATE_REQING_CHANNEL) { UINT_8 ucPreferedChnl = 0; ENUM_BAND_T eBand = BAND_NULL; ENUM_CHNL_EXT_T eSco = CHNL_EXT_SCN; prChnlReqInfo = &(prP2pFsmInfo->rChnlReqInfo); /* Determine the channel for AP. */ if (cnmPreferredChannel(prAdapter, &eBand, &ucPreferedChnl, &eSco) == FALSE) { prP2pConnSettings = prAdapter->rWifiVar.prP2PConnSettings; if ((ucPreferedChnl = prP2pConnSettings->ucOperatingChnl) == 0) { if (scnQuerySparseChannel(prAdapter, &eBand, &ucPreferedChnl) == FALSE) { /* What to do? */ ASSERT(FALSE); /* TODO: Pick up a valid channel from channel list. */ ucPreferedChnl = 1; eBand = BAND_2G4; } } } prChnlReqInfo->eChannelReqType = CHANNEL_REQ_TYPE_GO_START_BSS; prChnlReqInfo->ucReqChnlNum = prP2pSpecificBssInfo->ucPreferredChannel = ucPreferedChnl; prChnlReqInfo->eBand = prP2pSpecificBssInfo->eRfBand = eBand; prChnlReqInfo->eChnlSco = prP2pSpecificBssInfo->eRfSco = eSco; } else { p2pFuncCancelScan(prAdapter, &(prP2pFsmInfo->rScanReqInfo)); } } while (FALSE); return; } /* p2pStateAbort_AP_CHANNEL_DETECT */
/*----------------------------------------------------------------------------*/ VOID rlmFuncInitialChannelList(IN P_ADAPTER_T prAdapter) { P_P2P_CONNECTION_SETTINGS_T prP2pConnSetting = (P_P2P_CONNECTION_SETTINGS_T) NULL; P_DOMAIN_INFO_ENTRY prDomainInfoEntry = (P_DOMAIN_INFO_ENTRY) NULL; P_DOMAIN_SUBBAND_INFO prDomainSubBand = (P_DOMAIN_SUBBAND_INFO) NULL; P_CHANNEL_ENTRY_FIELD_T prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T) NULL; UINT_32 u4Idx = 0, u4IdxII = 0; UINT_8 ucBufferSize = P2P_MAX_SUPPORTED_CHANNEL_LIST_SIZE; #if 0 UINT_8 ucSocialChnlSupport = 0, ucAutoChnl = 0; #endif do { ASSERT_BREAK(prAdapter != NULL); prP2pConnSetting = prAdapter->rWifiVar.prP2PConnSettings; #if 0 ucAutoChnl = prP2pConnSetting->ucOperatingChnl; #endif prDomainInfoEntry = rlmDomainGetDomainInfo(prAdapter); ASSERT_BREAK((prDomainInfoEntry != NULL) && (prP2pConnSetting != NULL)); prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T) prP2pConnSetting->aucChannelEntriesField; for (u4Idx = 0; u4Idx < MAX_SUBBAND_NUM; u4Idx++) { prDomainSubBand = &prDomainInfoEntry->rSubBand[u4Idx]; if (((prDomainSubBand->ucBand == BAND_5G) && (!prAdapter->fgEnable5GBand)) || (prDomainSubBand->ucBand == BAND_NULL)) { continue; } if (ucBufferSize < (P2P_ATTRI_LEN_CHANNEL_ENTRY + prDomainSubBand->ucNumChannels)) { /* Buffer is not enough to include all supported channels. */ break; /* for */ } prChannelEntryField->ucRegulatoryClass = prDomainSubBand->ucRegClass; prChannelEntryField->ucNumberOfChannels = prDomainSubBand->ucNumChannels; for (u4IdxII = 0; u4IdxII < prDomainSubBand->ucNumChannels; u4IdxII++) { prChannelEntryField->aucChannelList[u4IdxII] = prDomainSubBand->ucFirstChannelNum + (u4IdxII * prDomainSubBand->ucChannelSpan); #if 0 switch (prChannelEntryField->aucChannelList[u4IdxII]) { case 1: ucSocialChnlSupport = 1; break; case 6: ucSocialChnlSupport = 6; break; case 11: ucSocialChnlSupport = 11; break; default: break; } #endif } if (ucBufferSize >= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryField->ucNumberOfChannels)) { ucBufferSize -= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryField->ucNumberOfChannels); } else { break; } prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T) ((UINT_32) prChannelEntryField + P2P_ATTRI_LEN_CHANNEL_ENTRY + (UINT_32) prChannelEntryField-> ucNumberOfChannels); } #if 0 if (prP2pConnSetting->ucListenChnl == 0) { prP2pConnSetting->ucListenChnl = P2P_DEFAULT_LISTEN_CHANNEL; if (ucSocialChnlSupport != 0) { /* 1. User Not Set LISTEN channel. * 2. Social channel is not empty. */ prP2pConnSetting->ucListenChnl = ucSocialChnlSupport; } } #endif /* TODO: 20110921 frog - */ /* If LISTEN channel is not set, * a random supported channel would be set. * If no social channel is supported, DEFAULT channel would be set. */ prP2pConnSetting->ucRfChannelListSize = P2P_MAX_SUPPORTED_CHANNEL_LIST_SIZE - ucBufferSize; #if 0 if (prP2pConnSetting->ucOperatingChnl == 0) { /* User not set OPERATE channel. */ if (scnQuerySparseChannel(prAdapter, NULL, &ucAutoChnl)) { break; /* while */ } ucBufferSize = prP2pConnSetting->ucRfChannelListSize; prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T) prP2pConnSetting->aucChannelEntriesField; while (ucBufferSize != 0) { if (prChannelEntryField->ucNumberOfChannels != 0) { ucAutoChnl = prChannelEntryField->aucChannelList[0]; break; /* while */ } else { prChannelEntryField = (P_CHANNEL_ENTRY_FIELD_T) ((UINT_32) prChannelEntryField + P2P_ATTRI_LEN_CHANNEL_ENTRY + (UINT_32) prChannelEntryField-> ucNumberOfChannels); ucBufferSize -= (P2P_ATTRI_LEN_CHANNEL_ENTRY + prChannelEntryField->ucNumberOfChannels); } } } #endif /* We assume user would not set a channel not in the channel list. * If so, the operating channel still depends on target deivce supporting capability. */ /* TODO: 20110921 frog - */ /* If the Operating channel is not set, a channel from supported channel list is set automatically. * If there is no supported channel in channel list, a DEFAULT channel is set. */ } while (FALSE); #if 0 prP2pConnSetting->ucOperatingChnl = ucAutoChnl; #endif return; } /* rlmFuncInitialChannelList */