sys/dev/netif/ath/hal/ath_hal/ar5416/ar5416_cal.c
static int16_t
ar5416GetNf(struct ath_hal *ah, struct ieee80211_channel *chan)
{
	int16_t nf, nfThresh;

	if (ar5212IsNFCalInProgress(ah)) {
		HALDEBUG(ah, HAL_DEBUG_ANY,
		    "%s: NF didn't complete in calibration window\n", __func__);
		nf = 0;
	} else {
		/* Finished NF cal, check against threshold */
		int16_t nfarray[NUM_NOISEFLOOR_READINGS] = { 0 };
		HAL_CHANNEL_INTERNAL *ichan = ath_hal_checkchannel(ah, chan);
			
		/* TODO - enhance for multiple chains and ext ch */
		ath_hal_getNoiseFloor(ah, nfarray);
		nf = nfarray[0];
		if (ar5416GetEepromNoiseFloorThresh(ah, chan, &nfThresh)) {
			if (nf > nfThresh) {
				HALDEBUG(ah, HAL_DEBUG_ANY,
				    "%s: noise floor failed detected; "
				    "detected %d, threshold %d\n", __func__,
				    nf, nfThresh);
				/*
				 * NB: Don't discriminate 2.4 vs 5Ghz, if this
				 *     happens it indicates a problem regardless
				 *     of the band.
				 */
				chan->ic_state |= IEEE80211_CHANSTATE_CWINT;
				nf = 0;
			}
		} else {
			nf = 0;
		}
		ar5416UpdateNFHistBuff(AH5416(ah)->ah_cal.nfCalHist, nfarray);
		ichan->rawNoiseFloor = nf;
	}
	return nf;
}
/*
 * Read the NF and check it against the noise floor threshhold
 */
Read the NF and check it against the noise floor threshhold
Read the NF and check it against the noise floor threshhold
static int16_t
ar5416GetNf(struct ath_hal *ah, struct ieee80211_channel *chan)
{
	int16_t nf, nfThresh;
	if (ar5212IsNFCalInProgress(ah)) {
		HALDEBUG(ah, HAL_DEBUG_ANY,
		    "%s: NF didn't complete in calibration window\n", __func__);
		nf = 0;
	} else {
		int16_t nfarray[NUM_NOISEFLOOR_READINGS] = { 0 };
		HAL_CHANNEL_INTERNAL *ichan = ath_hal_checkchannel(ah, chan);
		ath_hal_getNoiseFloor(ah, nfarray);
		nf = nfarray[0];
		if (ar5416GetEepromNoiseFloorThresh(ah, chan, &nfThresh)) {
			if (nf > nfThresh) {
				HALDEBUG(ah, HAL_DEBUG_ANY,
				    "%s: noise floor failed detected; "
				    "detected %d, threshold %d\n", __func__,
				    nf, nfThresh);
				chan->ic_state |= IEEE80211_CHANSTATE_CWINT;
				nf = 0;
			}
		} else {
			nf = 0;
		}
		ar5416UpdateNFHistBuff(AH5416(ah)->ah_cal.nfCalHist, nfarray);
		ichan->rawNoiseFloor = nf;
	}
	return nf;
}
static int16_t ar5416GetNf ( struct ath_hal * ah , struct ieee80211_channel * chan ) { int16_t nf , nfThresh ; if ( ar5212IsNFCalInProgress ( ah ) ) { HALDEBUG ( ah , HAL_DEBUG_ANY , " \n " , __func__ ) ; nf = 0 ; } else { int16_t nfarray [ NUM_NOISEFLOOR_READINGS ] = { 0 } ; HAL_CHANNEL_INTERNAL * ichan = ath_hal_checkchannel ( ah , chan ) ; ath_hal_getNoiseFloor ( ah , nfarray ) ; nf = nfarray [ 0 ] ; if ( ar5416GetEepromNoiseFloorThresh ( ah , chan , & nfThresh ) ) { if ( nf > nfThresh ) { HALDEBUG ( ah , HAL_DEBUG_ANY , " " " \n " , __func__ , nf , nfThresh ) ; chan -> ic_state |= IEEE80211_CHANSTATE_CWINT ; nf = 0 ; } } else { nf = 0 ; } ar5416UpdateNFHistBuff ( AH5416 ( ah ) -> ah_cal . nfCalHist , nfarray ) ; ichan -> rawNoiseFloor = nf ; } return nf ; }
Read the NF and check it against the noise floor threshhold
Read the NF and check it against the noise floor threshhold
/* Finished NF cal, check against threshold */ /* TODO - enhance for multiple chains and ext ch */ /*
				 * NB: Don't discriminate 2.4 vs 5Ghz, if this
				 *     happens it indicates a problem regardless
				 *     of the band.
				 */