/* ========================================================================== Description: This routine is called at initialization. It returns a channel number that complies to regulation domain and less interference with current enviornment. Return: ch - channel number that NOTE: The retruned channel number is guaranteed to comply to current regulation domain that recorded in pAd->CommonCfg.CountryRegion Usage: 1.) iwpriv ra0 set AutoChannelSel=1 Ues the number of AP and inference status to choose 2.) iwpriv ra0 set AutoChannelSel=2 Ues the False CCA count and Rssi to choose ========================================================================== */ UCHAR APAutoSelectChannel( IN PRTMP_ADAPTER pAd, IN ChannelSel_Alg Alg) { UCHAR ch = 0, i; /* passive scan channel 1-14. collect statistics */ /* In the autochannel select case. AP didn't get channel yet. So have no way to determine which Band AP used by channel number. */ /* Init some structures before doing AutoChannelSelect() */ APAutoChannelInit(pAd); if (( Alg == ChannelAlgRandom ) && (pAd->pChannelInfo->IsABand == TRUE)) { /*for Dfs */ ch = SelectClearChannelRandom(pAd); } else { #ifdef MICROWAVE_OVEN_SUPPORT pAd->CommonCfg.MO_Cfg.bEnable = FALSE; AsicMeasureFalseCCA(pAd); #endif /*find RSSI in each channel */ for (i=0; i<pAd->ChannelListNum; i++) { AsicSwitchChannel(pAd, pAd->ChannelList[i].Channel, TRUE); AsicLockChannel(pAd, pAd->ChannelList[i].Channel);/*do nothing */ pAd->ApCfg.current_channel_index = i; pAd->ApCfg.AutoChannel_Channel = pAd->ChannelList[i].Channel; #ifdef AP_QLOAD_SUPPORT if (QLOAD_DOES_ALARM_OCCUR(pAd)) { /* QLOAD ALARM, ever alarm from QLOAD module */ OS_WAIT(400); /* wait for 400 ms at each channel. */ } else #endif /* AP_QLOAD_SUPPORT */ { OS_WAIT(200); /* wait for 200 ms at each channel. */ } UpdateChannelInfo(pAd, i,Alg); } ch = SelectBestChannel(pAd, Alg); } return ch; }
/* ========================================================================== Description: This routine is called at initialization. It returns a channel number that complies to regulation domain and less interference with current enviornment. Return: ch - channel number that NOTE: The retruned channel number is guaranteed to comply to current regulation domain that recorded in pAd->CommonCfg.CountryRegion Usage: 1.) iwpriv ra0 set AutoChannelSel=1 Ues the number of AP and inference status to choose 2.) iwpriv ra0 set AutoChannelSel=2 Ues the False CCA count and Rssi to choose ========================================================================== */ UCHAR APAutoSelectChannel( IN PRTMP_ADAPTER pAd, IN ChannelSel_Alg Alg) { UCHAR ch = 0, i; // passive scan channel 1-14. collect statistics // In the autochannel select case. AP didn't get channel yet. // So have no way to determine which Band AP used by channel number. // // Init some structures before doing AutoChannelSelect() // APAutoChannelInit(pAd); if (( Alg == ChannelAlgRandom ) && (pAd->pChannelInfo->IsABand == TRUE)) { //for Dfs ch = SelectClearChannelRandom(pAd); } else { //find RSSI in each channel // for (i=0; i<pAd->ChannelListNum; i++) { AsicSwitchChannel(pAd, pAd->ChannelList[i].Channel, TRUE); AsicLockChannel(pAd, pAd->ChannelList[i].Channel);//do nothing pAd->ApCfg.current_channel_index = i; pAd->ApCfg.AutoChannel_Channel = pAd->ChannelList[i].Channel; #ifdef AP_QLOAD_SUPPORT if (QLOAD_DOES_ALARM_OCCUR(pAd)) { /* QLOAD ALARM, ever alarm from QLOAD module */ OS_WAIT(400); // wait for 400 ms at each channel. } else #endif { OS_WAIT(200); // wait for 200 ms at each channel. } UpdateChannelInfo(pAd, i,Alg); } ch = SelectBestChannel(pAd, Alg); } return ch; }